LeechCraft
0.6.70-18450-gabe19ee3b0
Modular cross-platform feature rich live environment.
Toggle main menu visibility
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
16
namespace
LC::AN
17
{
28
struct
FieldData
29
{
35
QString
ID_
;
36
41
QString
Name_
;
42
48
QString
Description_
;
49
59
QMetaType::Type
Type_
= QMetaType::UnknownType;
60
67
QStringList
EventTypes_
;
68
78
QVariantList
AllowedValues_
= {};
79
};
80
83
struct
BoolFieldValue
84
{
87
bool
IsSet_
;
88
89
auto
operator<=>
(
const
BoolFieldValue
&)
const
=
default
;
90
};
91
94
struct
IntFieldValue
95
{
98
int
Boundary_
;
99
102
enum
Operation
103
{
106
OGreater
= 0x01,
107
110
OLess
= 0x02,
111
114
OEqual
= 0x04
115
};
116
117
Q_DECLARE_FLAGS
(Operations,
Operation
)
118
119
123
Operations
Ops_
;
124
125
bool
operator== (const
IntFieldValue
&) const = default;
126
};
127
128
struct
Substring
129
{
130
QString
Pattern_
;
131
bool
operator==
(
const
Substring
&)
const
=
default
;
132
};
133
134
struct
Wildcard
135
{
136
QString
Pattern_
;
137
QRegularExpression
Compiled_
= QRegularExpression::fromWildcard (
Pattern_
);
138
139
bool
operator==
(
const
Wildcard
&)
const
=
default
;
140
};
141
142
struct
StringMatcher
: std::variant<Substring, Wildcard, QRegularExpression>
143
{
144
using
variant::variant;
145
};
146
149
struct
StringFieldValue
150
{
153
StringMatcher
Rx_
;
154
160
bool
Contains_
;
161
168
StringFieldValue
(QRegularExpression rx,
bool
contains)
169
:
Rx_
{ std::move (rx) }
170
,
Contains_
{ contains }
171
{
172
}
173
184
StringFieldValue
(
const
QString& str,
bool
contains =
true
)
185
:
Rx_
{
Substring
{ str } }
186
,
Contains_
{ contains }
187
{
188
}
189
190
bool
operator==
(
const
StringFieldValue
&)
const
=
default
;
191
};
192
195
using
FieldValue
= std::variant<BoolFieldValue, IntFieldValue, StringFieldValue>;
196
}
197
212
class
Q_DECL_EXPORT
IANEmitter
213
{
214
public
:
215
virtual
~IANEmitter
() =
default
;
216
232
virtual
QList<LC::AN::FieldData>
GetANFields
()
const
= 0;
233
};
234
235
Q_DECLARE_INTERFACE (
IANEmitter
,
"org.Deviant.LeechCraft.IANEmitter/1.0"
)
236
Q_DECLARE_METATYPE
(
LC
::AN::FieldData)
237
Q_DECLARE_METATYPE
(
LC
::AN::
FieldValue
)
238
Q_DECLARE_METATYPE
(
QList
<
LC
::AN::
FieldValue
>)
239
240
Q_DECLARE_OPERATORS_FOR_FLAGS (
LC
::AN::IntFieldValue::Operations)
IANEmitter
Interface for plugins emitting AdvancedNotifications entries.
Definition
ianemitter.h:213
IANEmitter::~IANEmitter
virtual ~IANEmitter()=default
IANEmitter::GetANFields
virtual QList< LC::AN::FieldData > GetANFields() const =0
Returns the list of additional fields.
QList
Definition
ianrulesstorage.h:14
operator==
auto operator==(const T &left, const T &right)
Definition
common.h:21
LC::AN
Definition
constants.h:15
LC::AN::Q_DECLARE_FLAGS
Q_DECLARE_FLAGS(NotifyFlags, NotifyFlag)
LC::AN::FieldValue
std::variant< BoolFieldValue, IntFieldValue, StringFieldValue > FieldValue
A combination of all possible descriptions.
Definition
ianemitter.h:195
LC
Definition
constants.h:15
LC::AN::BoolFieldValue
Describes a field with boolean values.
Definition
ianemitter.h:84
LC::AN::BoolFieldValue::IsSet_
bool IsSet_
Whether the field should be set.
Definition
ianemitter.h:87
LC::AN::BoolFieldValue::operator<=>
auto operator<=>(const BoolFieldValue &) const =default
LC::AN::FieldData
A single additional AdvancedNotifications field.
Definition
ianemitter.h:29
LC::AN::FieldData::ID_
QString ID_
The field ID.
Definition
ianemitter.h:35
LC::AN::FieldData::EventTypes_
QStringList EventTypes_
The types of the event that contain this field.
Definition
ianemitter.h:67
LC::AN::FieldData::Type_
QMetaType::Type Type_
The type of this field.
Definition
ianemitter.h:59
LC::AN::FieldData::Name_
QString Name_
The name of the field.
Definition
ianemitter.h:41
LC::AN::FieldData::Description_
QString Description_
The description of the field.
Definition
ianemitter.h:48
LC::AN::FieldData::AllowedValues_
QVariantList AllowedValues_
The allowed values of this field.
Definition
ianemitter.h:78
LC::AN::IntFieldValue
Describes a field with integer values.
Definition
ianemitter.h:95
LC::AN::IntFieldValue::Boundary_
int Boundary_
The boundary of the field.
Definition
ianemitter.h:98
LC::AN::IntFieldValue::Operation
Operation
Describes the elementary semantics of Boundary_.
Definition
ianemitter.h:103
LC::AN::IntFieldValue::OGreater
@ OGreater
The value should be greater than Boundary_.
Definition
ianemitter.h:106
LC::AN::IntFieldValue::OEqual
@ OEqual
The value should be equal to Boundary_.
Definition
ianemitter.h:114
LC::AN::IntFieldValue::OLess
@ OLess
The value should be less than Boundary_.
Definition
ianemitter.h:110
LC::AN::IntFieldValue::Ops_
Operations Ops_
Describe the semantics of Boundary_.
Definition
ianemitter.h:123
LC::AN::IntFieldValue::operator==
bool operator==(const IntFieldValue &) const =default
LC::AN::StringFieldValue::Rx_
StringMatcher Rx_
The pattern the values should (not) match.
Definition
ianemitter.h:153
LC::AN::StringFieldValue::StringFieldValue
StringFieldValue(const QString &str, bool contains=true)
Constructs the field matcher for the given str.
Definition
ianemitter.h:184
LC::AN::StringFieldValue::StringFieldValue
StringFieldValue(QRegularExpression rx, bool contains)
Constructs the field matcher.
Definition
ianemitter.h:168
LC::AN::StringFieldValue::Contains_
bool Contains_
Whether the values should match or not match Rx_.
Definition
ianemitter.h:160
LC::AN::StringMatcher
Definition
ianemitter.h:143
LC::AN::Substring
Definition
ianemitter.h:129
LC::AN::Substring::Pattern_
QString Pattern_
Definition
ianemitter.h:130
LC::AN::Wildcard
Definition
ianemitter.h:135
LC::AN::Wildcard::Pattern_
QString Pattern_
Definition
ianemitter.h:136
LC::AN::Wildcard::Compiled_
QRegularExpression Compiled_
Definition
ianemitter.h:137
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(QVariantList *)
src
interfaces
an
ianemitter.h
Generated by
1.17.0