8#include "predicateparse.h"
10void PredicateParse_mainParse(
const char *_code);
14#include "soliddefs_p.h"
19#include <QThreadStorage>
23namespace PredicateParse
42 Solid::PredicateParse::ParsingData *data =
new Solid::PredicateParse::ParsingData();
43 s_parsingData->setLocalData(data);
44 data->buffer = predicate.toLatin1();
45 PredicateParse_mainParse(data->buffer.
constData());
51 s_parsingData->setLocalData(
nullptr);
55void PredicateParse_setResult(
void *result)
57 Solid::PredicateParse::ParsingData *data = s_parsingData->localData();
61void PredicateParse_errorDetected(
const char *s)
63 qWarning(
"ERROR from solid predicate parser: %s", s);
64 s_parsingData->localData()->result =
nullptr;
67void PredicateParse_destroy(
void *pred)
69 Solid::PredicateParse::ParsingData *data = s_parsingData->localData();
71 if (p != data->result) {
76void *PredicateParse_newAtom(
char *interface,
char *property,
void *value)
91void *PredicateParse_newMaskAtom(
char *interface,
char *property,
void *value)
106void *PredicateParse_newIsAtom(
char *interface)
117void *PredicateParse_newAnd(
void *pred1,
void *pred2)
121 Solid::PredicateParse::ParsingData *data = s_parsingData->localData();
125 if (p1 == data->result || p2 == data->result) {
126 data->result =
nullptr;
137void *PredicateParse_newOr(
void *pred1,
void *pred2)
141 Solid::PredicateParse::ParsingData *data = s_parsingData->localData();
145 if (p1 == data->result || p2 == data->result) {
146 data->result =
nullptr;
157void *PredicateParse_newStringValue(
char *val)
166void *PredicateParse_newBoolValue(
int val)
172void *PredicateParse_newNumValue(
int val)
177void *PredicateParse_newDoubleValue(
double val)
182void *PredicateParse_newEmptyStringListValue()
187void *PredicateParse_newStringListValue(
char *name)
196void *PredicateParse_appendStringListValue(
char *name,
void *list)
210void PredicateLexer_unknownToken(
const char *text)
212 qWarning(
"ERROR from solid predicate parser: unrecognized token '%s' in predicate '%s'\n", text, s_parsingData->localData()->buffer.constData());
This class implements predicates for devices.
KIOCORE_EXPORT QStringList list(const QString &fileClass)
const char * constData() const const
QString fromLatin1(QByteArrayView str)
QStringList toStringList() const const