LeechCraft 0.6.70-14794-g33744ae6ce
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
ianemitter.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#pragma once
10
11#include <variant>
12#include <QtPlugin>
13#include <QVariant>
14#include <QStringList>
15
16namespace LC
17{
29 {
35 QString ID_;
36
41 QString Name_;
42
48 QString Description_;
49
59 QVariant::Type Type_;
60
67 QStringList EventTypes_;
68
78 QVariantList AllowedValues_;
79
86 : Type_ (QVariant::Invalid)
87 {
88 }
89
99 ANFieldData (const QString& id,
100 const QString& name,
101 const QString& description,
102 QVariant::Type type,
103 const QStringList& events,
104 const QVariantList& values = {})
105 : ID_ (id)
106 , Name_ (name)
107 , Description_ (description)
108 , Type_ (type)
109 , EventTypes_ (events)
110 , AllowedValues_ (values)
111 {
112 }
113 };
114
118 {
121 bool IsSet_;
122 };
123
131 inline bool operator== (const ANBoolFieldValue& left, const ANBoolFieldValue& right)
132 {
133 return left.IsSet_ == right.IsSet_;
134 }
135
139 {
143
147 {
150 OGreater = 0x01,
151
154 OLess = 0x02,
155
158 OEqual = 0x04
159 };
160
161 Q_DECLARE_FLAGS (Operations, Operation)
162
163
167 Operations Ops_;
168 };
169
177 inline bool operator== (const ANIntFieldValue& left, const ANIntFieldValue& right)
178 {
179 return left.Boundary_ == right.Boundary_ &&
180 left.Ops_ == right.Ops_;
181 }
182
186 {
189 QRegExp Rx_;
190
197
204 ANStringFieldValue (const QRegExp& rx, bool contains)
205 : Rx_ { rx }
206 , Contains_ { contains }
207 {
208 }
209
222 ANStringFieldValue (const QString& str, bool contains = true)
223 : Rx_ { str, Qt::CaseSensitive, QRegExp::FixedString }
224 , Contains_ { contains }
225 {
226 }
227 };
228
236 inline bool operator== (const ANStringFieldValue& left, const ANStringFieldValue& right)
237 {
238 return left.Contains_ == right.Contains_ &&
239 left.Rx_ == right.Rx_;
240 }
241
244 typedef std::variant<ANBoolFieldValue, ANIntFieldValue, ANStringFieldValue> ANFieldValue;
245}
246
261class Q_DECL_EXPORT IANEmitter
262{
263public:
264 virtual ~IANEmitter () {}
265
282};
283
284Q_DECLARE_INTERFACE (IANEmitter, "org.Deviant.LeechCraft.IANEmitter/1.0")
285Q_DECLARE_METATYPE (LC::ANFieldData)
288
289Q_DECLARE_OPERATORS_FOR_FLAGS (LC::ANIntFieldValue::Operations)
Interface for plugins emitting AdvancedNotifications entries.
Definition: ianemitter.h:262
virtual ~IANEmitter()
Definition: ianemitter.h:264
virtual QList< LC::ANFieldData > GetANFields() const =0
Returns the list of additional fields.
Definition: constants.h:15
std::variant< ANBoolFieldValue, ANIntFieldValue, ANStringFieldValue > ANFieldValue
A combination of all possible descriptions.
Definition: ianemitter.h:244
Q_DECLARE_FLAGS(TabFeatures, LC::TabFeature)
bool operator==(const ANBoolFieldValue &left, const ANBoolFieldValue &right)
Compares two fields with boolean values.
Definition: ianemitter.h:131
Describes a field with boolean values.
Definition: ianemitter.h:118
bool IsSet_
Whether the field should be set.
Definition: ianemitter.h:121
A single additional AdvancedNotifications field.
Definition: ianemitter.h:29
ANFieldData()
Constructs an empty field info.
Definition: ianemitter.h:85
QString Name_
The name of the field.
Definition: ianemitter.h:41
ANFieldData(const QString &id, const QString &name, const QString &description, QVariant::Type type, const QStringList &events, const QVariantList &values={})
Constructs field with the given info variables.
Definition: ianemitter.h:99
QString Description_
The description of the field.
Definition: ianemitter.h:48
QVariantList AllowedValues_
The allowed values of this field.
Definition: ianemitter.h:78
QStringList EventTypes_
The types of the event that contain this field.
Definition: ianemitter.h:67
QString ID_
The field ID.
Definition: ianemitter.h:35
QVariant::Type Type_
The type of this field.
Definition: ianemitter.h:59
Describes a field with integer values.
Definition: ianemitter.h:139
Operation
Describes the elementary semantics of Boundary_.
Definition: ianemitter.h:147
@ OEqual
The value should be equal to Boundary_.
Definition: ianemitter.h:158
@ OLess
The value should be less than Boundary_.
Definition: ianemitter.h:154
@ OGreater
The value should be greater than Boundary_.
Definition: ianemitter.h:150
Operations Ops_
Describe the semantics of Boundary_.
Definition: ianemitter.h:167
int Boundary_
The boundary of the field.
Definition: ianemitter.h:142
Describes a field with QString values.
Definition: ianemitter.h:186
bool Contains_
Whether the values should match or not match Rx_.
Definition: ianemitter.h:196
QRegExp Rx_
The regular expression the values should (not) match.
Definition: ianemitter.h:189
ANStringFieldValue(const QRegExp &rx, bool contains)
Constructs the field matcher.
Definition: ianemitter.h:204
ANStringFieldValue(const QString &str, bool contains=true)
Constructs the field matcher for the given str.
Definition: ianemitter.h:222
Q_DECLARE_METATYPE(QVariantList *)