1 #ifndef MYTHHTTPSERVICE_H
2 #define MYTHHTTPSERVICE_H
37 {
return m_request->m_queries.contains(
p.toLower()); }
47 : m_hostName(std::move( sHostName ))
72 #define SERVICE_PROPERTY2(Type, Name) \
73 Q_PROPERTY(Type Name READ Get##Name MEMBER m_##Name USER true) \
75 Type Get##Name() const { return m_##Name; } \
77 typename std::enable_if_t<std::is_same_v<T, QString> || \
78 std::is_same_v<T, QStringList> || \
79 std::is_same_v<T, QDateTime> || \
80 std::is_same_v<T, QVariantMap> || \
81 std::is_same_v<T, QVariantList>,void> \
82 set##Name(const T& value) { m_##Name = value; } \
84 typename std::enable_if_t<!std::is_same_v<T, QString> && \
85 !std::is_same_v<T, QStringList> && \
86 !std::is_same_v<T, QDateTime> && \
87 !std::is_same_v<T, QVariantMap> && \
88 !std::is_same_v<T, QVariantList>,void> \
89 set##Name(T value) { m_##Name = value; } \
91 Type m_##Name { }; // NOLINT(readability-redundant-member-init)
93 #define SERVICE_PROPERTY_RO_REF( type, name ) \
94 private: type m_##name; \
101 #define SERVICE_PROPERTY_PTR( type, name ) \
102 private: type* m_##name {nullptr}; \
106 if (m_##name == nullptr) \
107 m_##name = new type( this );\
111 #define SERVICE_PROPERTY_COND_PTR( type, name ) \
112 private: type* m_##name {nullptr}; \
113 bool m_b##name {true}; \
117 if (m_##name == nullptr && m_b##name) \
118 m_##name = new type( this );\
121 void enable##name(bool enabled) \
123 m_b##name = enabled; \
131 for (
const auto& vValue : std::as_const(src))
133 if ( vValue.canConvert< QObject* >())
135 const QObject *pObject = vValue.value< QObject* >();
137 if (pObject !=
nullptr)
139 QObject *pNew =
new T( pParent );
141 ((T *)pNew)->Copy( (
const T *)pObject );
143 dst.append( QVariant::fromValue<QObject *>( pNew ));