Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
query-text.hpp
Go to the documentation of this file.
1/*
2 QUERY-TEXT.hpp - syntactical standard representation for queries
3
4 Copyright (C)
5 2012, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12*/
13
14
35#ifndef LIB_QUERY_TEXT_H
36#define LIB_QUERY_TEXT_H
37
38#include "lib/error.hpp"
39#include "lib/hash-value.h"
40#include "lib/query-util.hpp"
41#include "lib/util.hpp"
42
43#include <string>
44
45namespace lib {
46
47 using lib::HashVal;
48 using std::string;
49
62 {
64
65
66 public:
68
69 QueryText (string const& syntacticRepr)
70 : definition_ (normalise (syntacticRepr))
71 { }
72
73 // using default copy/assignment
74
75 operator string() const
76 {
77 return definition_;
78 }
79
80 auto operator<=> (QueryText const&) const =default;
81
82 bool
83 empty() const
84 {
85 return definition_.empty();
86 }
87
88 bool
89 hasAtom (string const& predSymbol)
90 {
91 return util::contains (definition_, predSymbol);
92 }
93
101 uint
103 {
105 }
106
107 private:
108 string normalise (string const& rawDefinition);
109 friend HashVal hash_value (QueryText const& entry);
110 };
111
112
113} // namespace lib
114#endif /*LIB_QUERY_TEXT_H*/
Syntactical query representation.
auto operator<=>(QueryText const &) const =default
bool hasAtom(string const &predSymbol)
bool empty() const
uint degree_of_constriction() const
synthetic total order to classify query definitions.
QueryText(string const &syntacticRepr)
friend HashVal hash_value(QueryText const &entry)
support using queries in hashtables.
string normalise(string const &rawDefinition)
Parse, verify and normalise the raw query definition.
Lumiera error handling (C++ interface).
Hash value types and utilities.
unsigned int uint
Definition integral.hpp:29
uint countPred(const string &q)
count the top-level predicates in the query string.
Implementation namespace for support and library code.
size_t HashVal
a STL compatible hash value
Definition hash-value.h:52
bool contains(MAP &map, typename MAP::key_type const &key)
shortcut for containment test on a map
Definition util.hpp:230
Utilities to support working with predicate queries.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...