swift
statusmessage.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_MISC_STATUSMESSAGE_H
7 #define SWIFT_MISC_STATUSMESSAGE_H
8 
9 #include <QReadWriteLock>
10 
11 #include "misc/logcategorylist.h"
12 #include "misc/mixin/mixinicon.h"
13 #include "misc/mixin/mixinstring.h"
14 #include "misc/orderable.h"
15 #include "misc/propertyindexref.h"
16 #include "misc/stringutils.h"
17 #include "misc/swiftmiscexport.h"
18 #include "misc/timestampbased.h"
19 #include "misc/typetraits.h"
20 
22 
23 namespace swift::misc
24 {
25  namespace private_ns
26  {
28  SWIFT_MISC_EXPORT QString arg(QStringView format, const QStringList &args);
29  } // namespace private_ns
30 
35  {
36  SeverityDebug,
37  SeverityInfo,
38  SeverityWarning,
39  SeverityError
40  };
41 
49  public mixin::MetaType<CStrongStringView>,
50  public mixin::EqualsByCompare<CStrongStringView>,
51  public mixin::LessThanByCompare<CStrongStringView>,
52  public mixin::DBusOperators<CStrongStringView>,
53  public mixin::DataStreamOperators<CStrongStringView>,
54  public mixin::JsonOperators<CStrongStringView>,
55  public mixin::String<CStrongStringView>
56  {
57  public:
59  CStrongStringView() = default;
60 
62  template <size_t N>
63  CStrongStringView(const char16_t (&string)[N]) : m_view(string)
64  {}
65 
67  CStrongStringView(const QString &string) : m_string(string), m_view(m_string) {}
68 
70  explicit CStrongStringView(QStringView view) : m_view(view) {}
71 
73  CStrongStringView(const char *) = delete;
74 
76  CStrongStringView(const CStrongStringView &other) { *this = other; }
77 
80  {
81  if (other.isOwning()) { m_view = m_string = other.m_string; }
82  else
83  {
84  m_view = other.m_view;
85  m_string.clear();
86  }
87  return *this;
88  }
89 
91  ~CStrongStringView() = default;
92 
94  bool isEmpty() const { return view().isEmpty(); }
95 
97  bool isOwning() const { return !m_string.isNull(); } // important distinction between isNull and isEmpty
98 
100  QStringView view() const { return m_view; }
101 
103  QString convertToQString(bool i18n = false) const
104  {
105  Q_UNUSED(i18n);
106  return isOwning() ? m_string : m_view.toString();
107  }
108 
110  friend int compare(const CStrongStringView &a, const CStrongStringView &b)
111  {
112  return a.m_view.compare(b.m_view);
113  }
114 
116  friend size_t qHash(const CStrongStringView &obj, uint seed = 0) { return ::qHash(obj.m_view, seed); }
117 
120  void marshallToDbus(QDBusArgument &arg) const { arg << toQString(); }
121  void unmarshallFromDbus(const QDBusArgument &arg)
122  {
123  arg >> m_string;
124  m_view = m_string;
125  }
127 
130  void marshalToDataStream(QDataStream &stream) const { stream << toQString(); }
131  void unmarshalFromDataStream(QDataStream &stream)
132  {
133  stream >> m_string;
134  m_view = m_string;
135  }
137 
140  QJsonObject toJson() const
141  {
142  QJsonObject json;
143  json.insert(QStringLiteral("value"), toQString());
144  return json;
145  }
146  void convertFromJson(const QJsonObject &json) { *this = json.value(QLatin1String("value")).toString(); }
148 
149  private:
150  QString m_string;
151  QStringView m_view;
152  };
153 
157  template <class Derived>
159  {
160  public:
163 
165  explicit CMessageBase(const CLogCategory &category) : m_categories({ category }) {}
166 
168  explicit CMessageBase(const CLogCategoryList &categories) : m_categories(categories) {}
169 
171  CMessageBase(const CLogCategoryList &categories, const CLogCategory &extra) : CMessageBase(categories)
172  {
173  this->addIfNotExisting(extra);
174  }
175 
177  CMessageBase(const CLogCategoryList &categories, const CLogCategoryList &extra) : CMessageBase(categories)
178  {
179  this->addIfNotExisting(extra);
180  }
181 
183  template <size_t N>
184  Derived &log(StatusSeverity s, const char16_t (&m)[N])
185  {
186  m_message = m;
187  m_severity = s;
188  return derived();
189  }
190 
192  Derived &log(StatusSeverity s, const QString &m)
193  {
194  m_message = m;
195  m_severity = s;
196  return derived();
197  }
198 
200  Derived &debug() { return log(SeverityDebug, QString()); }
201 
203  template <size_t N>
204  Derived &debug(const char16_t (&format)[N])
205  {
206  return log(SeverityDebug, format);
207  }
208 
210  Derived &debug(const QString &format) { return log(SeverityDebug, format); }
211 
213  template <size_t N>
214  Derived &info(const char16_t (&format)[N])
215  {
216  return log(SeverityInfo, format);
217  }
218 
220  Derived &info(const QString &format) { return log(SeverityInfo, format); }
221 
223  template <size_t N>
224  Derived &warning(const char16_t (&format)[N])
225  {
226  return log(SeverityWarning, format);
227  }
228 
230  Derived &warning(const QString &format) { return log(SeverityWarning, format); }
231 
233  template <size_t N>
234  Derived &error(const char16_t (&format)[N])
235  {
236  return log(SeverityError, format);
237  }
238 
240  Derived &error(const QString &format) { return log(SeverityError, format); }
241 
243  template <size_t N>
244  Derived &validation(StatusSeverity s, const char16_t (&format)[N])
245  {
246  setValidation();
247  return log(s, format);
248  }
249 
251  Derived &validation(StatusSeverity s, const QString &format)
252  {
253  setValidation();
254  return log(s, format);
255  }
256 
258  template <size_t N>
259  Derived &validationInfo(const char16_t (&format)[N])
260  {
261  setValidation();
262  return log(SeverityInfo, format);
263  }
264 
266  Derived &validationInfo(const QString &format)
267  {
268  setValidation();
269  return log(SeverityInfo, format);
270  }
271 
273  template <size_t N>
274  Derived &validationWarning(const char16_t (&format)[N])
275  {
276  setValidation();
277  return log(SeverityWarning, format);
278  }
279 
281  Derived &validationWarning(const QString &format)
282  {
283  setValidation();
284  return log(SeverityWarning, format);
285  }
286 
288  template <size_t N>
289  Derived &validationError(const char16_t (&format)[N])
290  {
291  setValidation();
292  return log(SeverityError, format);
293  }
294 
296  Derived &validationError(const QString &format)
297  {
298  setValidation();
299  return log(SeverityError, format);
300  }
301 
304  Derived &log(StatusSeverity, const char *) = delete;
305  Derived &debug(const char *) = delete;
306  Derived &info(const char *) = delete;
307  Derived &warning(const char *) = delete;
308  Derived &error(const char *) = delete;
309  Derived &validation(StatusSeverity, const char *) = delete;
310  Derived &validationInfo(const char *) = delete;
311  Derived &validationWarning(const char *) = delete;
312  Derived &validationError(const char *) = delete;
314 
319  template <class T, std::enable_if_t<TParameter<std::decay_t<T>>::passBy == ParameterPassBy::Value, int> = 0>
320  Derived &operator<<(T v)
321  {
322  return arg(TString<T>::toQString(v));
323  }
324 
329  template <class T, std::enable_if_t<TParameter<std::decay_t<T>>::passBy == ParameterPassBy::ConstRef, int> = 0>
330  Derived &operator<<(const T &v)
331  {
332  return arg(TString<T>::toQString(v));
333  }
334 
336  bool isEmpty() const { return this->m_message.isEmpty() && this->m_args.isEmpty(); }
337 
338  private:
339  void setValidation()
340  {
343  }
344  Derived &arg(const QString &value)
345  {
346  m_args.push_back(value);
347  return derived();
348  }
349  Derived &derived() { return static_cast<Derived &>(*this); }
350 
351  protected:
353  void addIfNotExisting(const CLogCategory &category)
354  {
355  if (this->m_categories.contains(category)) { return; }
356  this->m_categories.push_back(category);
357  }
358 
360  void addIfNotExisting(const CLogCategoryList &categories)
361  {
362  if (this->m_categories.isEmpty()) { this->m_categories.push_back(categories); }
363  else
364  {
365  for (const CLogCategory &cat : categories) { this->addIfNotExisting(cat); }
366  }
367  }
368 
369  protected:
372 
374  QStringList m_args;
375 
378 
380  StatusSeverity m_severity = SeverityDebug;
381 
383  QString message() const { return private_ns::arg(m_message.view(), m_args); }
384  };
385 
390  public CValueObject<CStatusMessage>,
391  public CMessageBase<CStatusMessage>,
392  public ITimestampBased,
393  public IOrderable
394  {
395  public:
399  constexpr static auto SeverityDebug = swift::misc::SeverityDebug;
400  constexpr static auto SeverityInfo = swift::misc::SeverityInfo;
401  constexpr static auto SeverityWarning = swift::misc::SeverityWarning;
402  constexpr static auto SeverityError = swift::misc::SeverityError;
404 
407  {
408  IndexCategoriesAsString = CPropertyIndexRef::GlobalIndexCStatusMessage,
409  IndexSeverity,
410  IndexSeverityAsString,
411  IndexSeverityAsIcon,
412  IndexMessage,
413  IndexMessageNoLineBreaks,
414  IndexMessageAsHtml
415  };
416 
418  explicit CStatusMessage(const CLogCategory &category);
419 
421  explicit CStatusMessage(const CLogCategoryList &categories);
422 
424  CStatusMessage(const CLogCategoryList &categories, const CLogCategory &extra);
425 
427  CStatusMessage(const CLogCategoryList &categories, const CLogCategoryList &extra);
428 
430  CStatusMessage();
431 
433  CStatusMessage(const CStatusMessage &other);
434 
436  CStatusMessage &operator=(const CStatusMessage &other);
437 
439  ~CStatusMessage() = default;
440 
443  template <size_t N>
444  CStatusMessage(const char16_t (&message)[N]) : CStatusMessage(QStringView(message))
445  {}
446  CStatusMessage(const QString &message);
447  template <size_t N>
448  CStatusMessage(StatusSeverity severity, const char16_t (&message)[N])
449  : CStatusMessage(severity, QStringView(message))
450  {}
451  CStatusMessage(StatusSeverity severity, const QString &message);
453 
456  template <size_t N>
457  CStatusMessage(const CLogCategoryList &categories, StatusSeverity severity, const char16_t (&message)[N],
458  bool validation = false)
459  : CStatusMessage(categories, severity, QStringView(message), validation)
460  {}
461  CStatusMessage(const CLogCategoryList &categories, StatusSeverity severity, const QString &message,
462  bool validation = false);
464 
468  explicit CStatusMessage(const char *message) = delete;
469  explicit CStatusMessage(StatusSeverity severity, const char *message) = delete;
470  explicit CStatusMessage(const CLogCategoryList &categories, StatusSeverity severity, const char *message,
471  bool validation = false) = delete;
473 
476  CStatusMessage(QtMsgType type, const QMessageLogContext &context, const QString &message);
477 
480  void toQtLogTriple(QtMsgType *o_type, QString *o_category, QString *o_message) const;
481 
483  const CLogCategoryList &getCategories() const { return this->m_categories; }
484 
486  QString getCategoriesAsString() const;
487 
490 
492  StatusSeverity getSeverity() const { return this->m_severity; }
493 
495  bool clampSeverity(StatusSeverity severity);
496 
498  bool isSeverityInfoOrLess() const
499  {
500  return this->m_severity == SeverityInfo || this->m_severity == SeverityDebug;
501  }
502 
504  bool isSeverityHigherOrEqual(CStatusMessage::StatusSeverity severity) const;
505 
507  bool isWarningOrAbove() const
508  {
509  return this->m_severity == SeverityWarning || this->m_severity == SeverityError;
510  }
511 
513  bool isSuccess() const;
514 
516  bool isFailure() const;
517 
519  QString getMessage() const { return this->message(); }
520 
522  QString getMessageNoLineBreaks() const;
523 
525  void prependMessage(const QString &msg);
526 
528  void appendMessage(const QString &msg);
529 
531  template <class T>
532  bool isFromClass(const T *pointer = nullptr) const
533  {
534  CLogCategoryList classCategories(pointer);
535  return std::all_of(classCategories.begin(), classCategories.end(),
536  [this](const CLogCategory &cat) { return m_categories.contains(cat); });
537  }
538 
540  void markAsHandledBy(const QObject *object) const;
541 
543  bool wasHandledBy(const QObject *object) const;
544 
546  void setSeverity(StatusSeverity severity) { this->m_severity = severity; }
547 
549  void addCategory(const CLogCategory &category) { this->addIfNotExisting(category); }
550 
552  void addValidationCategory() { this->addCategory(CLogCategories::validation()); }
553 
555  void addCategories(const CLogCategoryList &categories) { this->addIfNotExisting(categories); }
556 
558  void setCategory(const CLogCategory &category) { this->m_categories = CLogCategoryList { category }; }
559 
561  void setCategories(const CLogCategoryList &categories) { this->m_categories = categories; }
562 
564  CIcons::IconIndex toIcon() const { return convertToIcon(*this).getIndex(); }
565 
567  const QString &getSeverityAsString() const;
568 
570  const CIcon &getSeverityAsIcon() const;
571 
573  static const QString &severityToString(StatusSeverity severity);
574 
576  static QString severitiesToString(const QSet<StatusSeverity> &severities);
577 
579  static StatusSeverity stringToSeverity(const QString &severity);
580 
582  static const QStringList &allSeverityStrings();
583 
585  QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const;
586 
588  void setPropertyByIndex(swift::misc::CPropertyIndexRef index, const QVariant &variant);
589 
591  int comparePropertyByIndex(CPropertyIndexRef index, const CStatusMessage &compareValue) const;
592 
594  QString convertToQString(bool i18n = false) const;
595 
597  QString toHtml(bool withIcon, bool withColors) const;
598 
600  static const CIcon &convertToIcon(const CStatusMessage &statusMessage);
601 
603  static const CIcon &convertToIcon(CStatusMessage::StatusSeverity severity);
604 
606  static const QString &convertToIconResource(CStatusMessage::StatusSeverity severity);
607 
609  static CStatusMessage fromDatabaseJson(const QJsonObject &json);
610 
612  static CStatusMessage fromJsonException(const CJsonException &ex, const CLogCategoryList &categories,
613  const QString &prefix);
614 
616  static void registerMetadata();
617 
618  private:
619  CStatusMessage(QStringView message);
620  CStatusMessage(StatusSeverity severity, QStringView message);
621  CStatusMessage(const CLogCategoryList &categories, StatusSeverity severity, QStringView message,
622  bool validation);
623 
624  mutable QVector<quintptr> m_handledByObjects;
625  mutable QReadWriteLock m_lock;
626 
631  SWIFT_METAMEMBER(categories),
632  SWIFT_METAMEMBER(severity),
633  SWIFT_METAMEMBER(message),
634  SWIFT_METAMEMBER(args),
636  SWIFT_METAMEMBER(timestampMSecsSinceEpoch, 0, DisabledForHashing | DisabledForComparison));
637  };
638 
639  // CContainerBase methods implemented out-of-line to avoid circular include
640  template <class Derived>
642  const CLogCategoryList &categories,
643  const QString &prefix)
644  {
645  try
646  {
647  convertFromJson(json);
648  }
649  catch (const CJsonException &ex)
650  {
651  return CStatusMessage::fromJsonException(ex, categories, prefix);
652  }
653  return {};
654  }
655 
657  template <class Derived>
659  const CLogCategoryList &categories,
660  const QString &prefix)
661  {
662  try
663  {
664  convertFromJson(jsonString);
665  }
666  catch (const CJsonException &ex)
667  {
668  return CStatusMessage::fromJsonException(ex, categories, prefix);
669  }
670  return {};
671  }
672 } // namespace swift::misc
673 
674 Q_DECLARE_METATYPE(swift::misc::CStrongStringView)
675 Q_DECLARE_METATYPE(swift::misc::CStatusMessage)
677 
678 #endif // SWIFT_MISC_STATUSMESSAGE_H
CStatusMessage convertFromJsonNoThrow(const QJsonObject &json, const CLogCategoryList &categories, const QString &prefix)
Call convertFromJson, catch any CJsonException that is thrown and return it as CStatusMessage.
Value object for icons. An icon is stored in the global icon repository and identified by its index....
Definition: icon.h:39
IconIndex
Index for each icon, allows to send them via DBus, efficiently store them, etc.
Definition: icons.h:32
Thrown when a convertFromJson method encounters an unrecoverable error in JSON data.
Definition: jsonexception.h:24
static const QString & uncategorized()
Uncategorized.
Definition: logcategories.h:24
static const QString & validation()
Validation.
Definition: logcategories.h:38
A log category is an arbitrary string tag which can be attached to log messages.
Definition: logcategory.h:28
A sequence of log categories.
Base class for CStatusMessage and CLogMessage.
CLogCategoryList m_categories
Private.
Derived & validationError(const char *)=delete
Deleted methods to avoid accidental implicit conversion from Latin-1 or UTF-8 string literals.
Derived & info(const QString &format)
Set the severity to info, providing a format string.
Derived & info(const char *)=delete
Deleted methods to avoid accidental implicit conversion from Latin-1 or UTF-8 string literals.
Derived & warning(const char16_t(&format)[N])
Set the severity to warning, providing a format string.
bool isEmpty() const
Message empty.
CMessageBase(const CLogCategoryList &categories, const CLogCategory &extra)
Construct a message with some specific categories.
CMessageBase(const CLogCategoryList &categories, const CLogCategoryList &extra)
Construct a message with some specific categories.
Derived & operator<<(const T &v)
Streaming operators.
Derived & validation(StatusSeverity s, const char16_t(&format)[N])
Set the severity to s, providing a format string, and adding the validation category.
Derived & log(StatusSeverity s, const QString &m)
Set the severity and format string.
Derived & validationError(const char16_t(&format)[N])
Set the severity to error, providing a format string, and adding the validation category.
Derived & log(StatusSeverity s, const char16_t(&m)[N])
Set the severity and format string.
Derived & validationWarning(const char *)=delete
Deleted methods to avoid accidental implicit conversion from Latin-1 or UTF-8 string literals.
CMessageBase()
Default constructor.
CStrongStringView m_message
Private.
Derived & validationWarning(const char16_t(&format)[N])
Set the severity to warning, providing a format string, and adding the validation category.
Derived & error(const char *)=delete
Deleted methods to avoid accidental implicit conversion from Latin-1 or UTF-8 string literals.
void addIfNotExisting(const CLogCategory &category)
Add category if not already existing.
Derived & validation(StatusSeverity s, const QString &format)
Set the severity to s, providing a format string, and adding the validation category.
Derived & error(const char16_t(&format)[N])
Set the severity to error, providing a format string.
QStringList m_args
Private.
Derived & operator<<(T v)
Streaming operators.
StatusSeverity m_severity
Private.
Derived & log(StatusSeverity, const char *)=delete
Deleted methods to avoid accidental implicit conversion from Latin-1 or UTF-8 string literals.
CMessageBase(const CLogCategoryList &categories)
Construct a message with some specific categories.
Derived & validationInfo(const char *)=delete
Deleted methods to avoid accidental implicit conversion from Latin-1 or UTF-8 string literals.
Derived & debug(const char16_t(&format)[N])
Set the severity to debug, providing a format string.
Derived & warning(const QString &format)
Set the severity to warning, providing a format string.
void addIfNotExisting(const CLogCategoryList &categories)
Add categories if not already existing.
Derived & validation(StatusSeverity, const char *)=delete
Deleted methods to avoid accidental implicit conversion from Latin-1 or UTF-8 string literals.
Derived & debug()
Set the severity to debug.
Derived & validationInfo(const QString &format)
Set the severity to info, providing a format string, and adding the validation category.
Derived & warning(const char *)=delete
Deleted methods to avoid accidental implicit conversion from Latin-1 or UTF-8 string literals.
Derived & validationError(const QString &format)
Set the severity to error, providing a format string, and adding the validation category.
CMessageBase(const CLogCategory &category)
Construct a message with some specific category.
Derived & validationInfo(const char16_t(&format)[N])
Set the severity to info, providing a format string, and adding the validation category.
Derived & validationWarning(const QString &format)
Set the severity to warning, providing a format string, and adding the validation category.
Derived & error(const QString &format)
Set the severity to error, providing a format string.
QString message() const
Private.
Derived & info(const char16_t(&format)[N])
Set the severity to info, providing a format string.
Derived & debug(const char *)=delete
Deleted methods to avoid accidental implicit conversion from Latin-1 or UTF-8 string literals.
Derived & debug(const QString &format)
Set the severity to debug, providing a format string.
Non-owning reference to a CPropertyIndex with a subset of its features.
bool contains(const T &object) const
Return true if there is an element equal to given object. Uses the most efficient implementation avai...
Definition: range.h:109
iterator begin()
Returns iterator at the beginning of the sequence.
Definition: sequence.h:163
void push_back(const T &value)
Appends an element at the end of the sequence.
Definition: sequence.h:305
int remove(const T &object)
Remove all elements equal to the given object, if it is contained.
Definition: sequence.h:435
bool isEmpty() const
Synonym for empty.
Definition: sequence.h:285
iterator end()
Returns iterator one past the end of the sequence.
Definition: sequence.h:172
Streamable status message, e.g.
void setCategory(const CLogCategory &category)
Reset category.
bool isWarningOrAbove() const
Warning or above.
static CStatusMessage fromJsonException(const CJsonException &ex, const CLogCategoryList &categories, const QString &prefix)
Object from JSON exception message.
CStatusMessage(const char16_t(&message)[N])
Constructor.
bool isSeverityInfoOrLess() const
Info or debug, no warning or error.
bool isFromClass(const T *pointer=nullptr) const
Returns true if this message was sent by an instance of class T.
void addCategories(const CLogCategoryList &categories)
Add categories, avoids duplicates.
void addValidationCategory()
Adds validation as category.
CStatusMessage(const CLogCategoryList &categories, StatusSeverity severity, const char *message, bool validation=false)=delete
Deleted constructor, to prevent inefficient construction from byte string literal....
StatusSeverity getSeverity() const
Message severity.
void setSeverity(StatusSeverity severity)
Severity.
QString getMessage() const
Message.
CStatusMessage(const CLogCategoryList &categories, StatusSeverity severity, const char16_t(&message)[N], bool validation=false)
Constructor, also a validation messsage can be directly created.
void addCategory(const CLogCategory &category)
Add category, avoids duplicates.
CStatusMessage(StatusSeverity severity, const char16_t(&message)[N])
Constructor.
CStatusMessage(StatusSeverity severity, const char *message)=delete
Deleted constructor, to prevent inefficient construction from byte string literal....
const CLogCategoryList & getCategories() const
Message categories.
CIcons::IconIndex toIcon() const
Representing icon.
void setCategories(const CLogCategoryList &categories)
Reset categories.
QString getHumanOrTechnicalCategoriesAsString() const
The human or technical categories.
CStatusMessage(const char *message)=delete
Deleted constructor, to prevent inefficient construction from byte string literal....
~CStatusMessage()=default
Destructor.
Special-purpose string class used by CMessageBase.
Definition: statusmessage.h:56
CStrongStringView(const char16_t(&string)[N])
Construct from a UTF-16 character array.
Definition: statusmessage.h:63
QStringView view() const
Return as a QStringView.
friend int compare(const CStrongStringView &a, const CStrongStringView &b)
Compare two strings.
void unmarshallFromDbus(const QDBusArgument &arg)
DBus marshalling.
CStrongStringView(const QString &string)
Construct from a QString.
Definition: statusmessage.h:67
void convertFromJson(const QJsonObject &json)
JSON conversion.
CStrongStringView & operator=(const CStrongStringView &other)
Copy assignment operator.
Definition: statusmessage.h:79
friend size_t qHash(const CStrongStringView &obj, uint seed=0)
Hash value.
CStrongStringView(QStringView view)
Construct from a QStringView. Explicit because it could be dangerous if used without care.
Definition: statusmessage.h:70
void marshallToDbus(QDBusArgument &arg) const
DBus marshalling.
bool isEmpty() const
String is empty.
Definition: statusmessage.h:94
QString convertToQString(bool i18n=false) const
Return a copy as a QString.
QJsonObject toJson() const
JSON conversion.
CStrongStringView(const CStrongStringView &other)
Copy constructor.
Definition: statusmessage.h:76
void marshalToDataStream(QDataStream &stream) const
QDataStream marshalling.
bool isOwning() const
Does it own its string data?
Definition: statusmessage.h:97
CStrongStringView()=default
Default constructor.
~CStrongStringView()=default
Destructor.
void unmarshalFromDataStream(QDataStream &stream)
QDataStream marshalling.
CStrongStringView(const char *)=delete
Deleted constructor.
Mix of the most commonly used mixin classes.
Definition: valueobject.h:114
Entity with order attribute (can be manually ordered in views)
Definition: orderable.h:19
Entity with timestamp.
CRTP class template which will generate marshalling operators for a derived class with its own marsha...
Definition: mixindbus.h:39
CRTP class template to generate non-member QDataStream streaming operators.
CRTP class template from which a derived class can inherit operator== implemented using its compare f...
Definition: mixincompare.h:32
ColumnIndex
Base class enums.
Definition: mixinindex.h:44
CRTP class template which will generate marshalling operators for a derived class with its own marsha...
Definition: mixinjson.h:37
CRTP class template from which a derived class can inherit operator< implemented using its compare fu...
Definition: mixincompare.h:116
CRTP class template from which a derived class can inherit common methods dealing with the metatype o...
Definition: mixinmetatype.h:29
CRTP class template from which a derived class can inherit string streaming operations.
Definition: mixinstring.h:31
QString toQString(bool i18n=false) const
Cast as QString.
Definition: mixinstring.h:76
#define SWIFT_METAMEMBER(MEMBER,...)
Macro to define an element within a metaclass.
Definition: metaclass.h:73
#define SWIFT_METACLASS(CLASS,...)
Macro to define a nested metaclass that describes the attributes of its enclosing class.
Definition: metaclass.h:53
@ DisabledForComparison
Element will be ignored by compare() and comparison operators.
Definition: metaclass.h:202
@ DisabledForHashing
Element will be ignored by qHash()
Definition: metaclass.h:205
size_t qHash(const std::string &key, uint seed)
std::string qHash
Definition: metaclass.h:86
Free functions in swift::misc.
void registerMetadata()
Register all relevant metadata in Misc.
StatusSeverity
Status severities.
Definition: statusmessage.h:35
Stringification traits class.
Definition: stringutils.h:326
#define SWIFT_MISC_EXPORT
Export a class or function from the library.
#define SWIFT_DECLARE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template declaration of mixins for a CValueObject subclass to be placed near the top of the ...
Definition: valueobject.h:65