swift
valueobject.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_VALUEOBJECT_H
7 #define SWIFT_MISC_VALUEOBJECT_H
8 
9 #include <type_traits>
10 
11 #include <QtGlobal>
12 
15 #include "misc/mixin/mixindbus.h"
16 #include "misc/mixin/mixinhash.h"
17 #include "misc/mixin/mixinicon.h"
18 #include "misc/mixin/mixinindex.h"
19 #include "misc/mixin/mixinjson.h"
21 #include "misc/mixin/mixinstring.h"
22 #include "misc/swiftmiscexport.h"
23 
25 #define SWIFT_TEMPLATE_VALUEOBJECT_MIXINS(Namespace, Class, Extern) \
26  namespace Namespace \
27  { \
28  class Class; \
29  } \
30  namespace swift::misc::private_ns \
31  { \
32  Extern template struct CValueObjectMetaInfo<Namespace::Class>; \
33  Extern template struct MetaTypeHelper<Namespace::Class>; \
34  } \
35  namespace swift::misc::mixin \
36  { \
37  Extern template class MetaType<Namespace::Class>; \
38  Extern template class HashByMetaClass<Namespace::Class>; \
39  Extern template class DBusByMetaClass<Namespace::Class>; \
40  Extern template class DataStreamByMetaClass<Namespace::Class>; \
41  Extern template class JsonByMetaClass<Namespace::Class>; \
42  Extern template class EqualsByMetaClass<Namespace::Class>; \
43  Extern template class LessThanByMetaClass<Namespace::Class>; \
44  Extern template class CompareByMetaClass<Namespace::Class>; \
45  Extern template class String<Namespace::Class>; \
46  Extern template class Index<Namespace::Class>; \
47  Extern template class Icon<Namespace::Class>; \
48  }
50 
61 #if defined(Q_OS_WIN) && defined(Q_CC_GNU)
62 # define SWIFT_DECLARE_VALUEOBJECT_MIXINS(Namespace, Class)
63 # define SWIFT_DEFINE_VALUEOBJECT_MIXINS(Namespace, Class)
64 #else
65 # define SWIFT_DECLARE_VALUEOBJECT_MIXINS(Namespace, Class) \
66  SWIFT_TEMPLATE_VALUEOBJECT_MIXINS(Namespace, Class, extern)
67 # define SWIFT_DEFINE_VALUEOBJECT_MIXINS(Namespace, Class) SWIFT_TEMPLATE_VALUEOBJECT_MIXINS(Namespace, Class, )
68 #endif
69 
70 namespace swift::misc
71 {
76  {
77  public:
79  using base_type = CEmpty;
80 
81  protected:
83  CEmpty() = default;
84 
86  CEmpty(const CEmpty &) = default;
87 
89  CEmpty &operator=(const CEmpty &) = default;
90 
92  ~CEmpty() = default;
93  };
94 
100  template <class Derived>
101  class CValueObject :
102  public CEmpty,
103  public mixin::MetaType<Derived>,
104  public mixin::HashByMetaClass<Derived>,
105  public mixin::DBusByMetaClass<Derived>,
106  public mixin::DataStreamByMetaClass<Derived>,
107  public mixin::JsonByMetaClass<Derived>,
108  public mixin::EqualsByMetaClass<Derived>,
109  public mixin::LessThanByMetaClass<Derived>,
110  public mixin::CompareByMetaClass<Derived>,
111  public mixin::String<Derived>,
112  public mixin::Index<Derived>,
113  public mixin::Icon<Derived>
114  {
115  public:
117  using base_type = CEmpty;
118 
121 
124 
127 
130 
133 
136 
139 
142 
145 
148 
151 
154 
157 
158  protected:
161 
163  CValueObject() = default;
164 
166  CValueObject(const CValueObject &) = default;
167 
169  CValueObject &operator=(const CValueObject &) = default;
170 
172  ~CValueObject() = default;
173 
174  public:
177 
180 
183 
186 
189 
192  };
193 
194 } // namespace swift::misc
195 
196 #endif // SWIFT_MISC_VALUEOBJECT_H
Default base class for CValueObject.
Definition: valueobject.h:76
~CEmpty()=default
Non-virtual protected destructor.
CEmpty(const CEmpty &)=default
Protected copy constructor.
CEmpty()=default
Protected default constructor.
CEmpty & operator=(const CEmpty &)=default
Protected copy assignment operator.
Mix of the most commonly used mixin classes.
Definition: valueobject.h:114
CValueObject(const CValueObject &)=default
Copy constructor.
CValueObject & operator=(const CValueObject &)=default
Copy assignment operator.
CEmpty()=default
Inheriting constructors.
CValueObject()=default
Default constructor.
~CValueObject()=default
Destructor.
CRTP class template from which a derived class can inherit non-member compare() implemented by metacl...
Definition: mixincompare.h:216
CRTP class template from which a derived class can inherit common methods dealing with marshalling in...
Definition: mixindbus.h:71
CRTP class template to generate QDataStream marshalling methods using CMetaClass.
CRTP class template from which a derived class can inherit operator== implemented by metaclass.
Definition: mixincompare.h:46
CRTP class template from which a derived class can inherit common methods dealing with hashing instan...
Definition: mixinhash.h:48
CRTP class template from which a derived class can inherit icon-related functions.
Definition: mixinicon.h:28
CRTP class template from which a derived class can inherit property indexing functions.
Definition: mixinindex.h:40
CRTP class template from which a derived class can inherit common methods dealing with JSON by metatu...
Definition: mixinjson.h:90
CRTP class template from which a derived class can inherit operator< implemented by metaclass.
Definition: mixincompare.h:136
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:29
Free functions in swift::misc.
#define SWIFT_MISC_EXPORT
Export a class or function from the library.