MCPcopy Create free account
hub / github.com/OpenOrienteering/mapper / ObjectQueryParser

Class ObjectQueryParser

src/core/objects/object_query.h:246–295  ·  view source on GitHub ↗

* Utility to construct object queries from text. * * The text shall be in the formal language generated by ObjectQuery::toString(): * * ::= | 'OR' * ::= | 'AND' * ::= | | | 'NOT' <Bool

Source from the content-addressed store, hash-verified

244 * <String> ::= ...
245 */
246class ObjectQueryParser
247{
248public:
249 /**
250 * Sets the map for looking up symbols.
251 */
252 void setMap(const Map* map);
253
254 /**
255 * Returns an ObjectQuery for the given text.
256 *
257 * The return query has ObjectQuery::OperatorInvalid in case of error.
258 */
259 ObjectQuery parse(const QString& text);
260
261 /**
262 * In case of error, returns the approximate position where parsing the
263 * text failed.
264 */
265 int errorPos() const;
266
267 enum TokenType
268 {
269 TokenUnknown = 0,
270 TokenNothing,
271 TokenString,
272 TokenWord,
273 TokenTextOperator,
274 TokenSymbol,
275 TokenOr,
276 TokenAnd,
277 TokenNot,
278 TokenLeftParen,
279 TokenRightParen,
280 };
281
282private:
283 void getToken();
284
285 QString tokenAsString() const;
286
287 const Symbol* findSymbol(const QString& key) const;
288
289 const Map* map = nullptr;
290 QStringRef input;
291 QStringRef token_text;
292 TokenType token;
293 int token_start;
294 int pos;
295};
296
297
298

Callers 2

loadCrtMethod · 0.85
makeQueryMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected