00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef LUMIERA_QUERY_H
00025 #define LUMIERA_QUERY_H
00026
00027
00028 #include <string>
00029 #include <typeinfo>
00030
00031 #include <boost/format.hpp>
00032
00033
00034 namespace lumiera
00035 {
00036 using std::string;
00037 using boost::format;
00038
00039
00040
00041 typedef const char * const Symbol;
00042
00043
00048 template<class OBJ>
00049 class Query : public std::string
00050 {
00051 public:
00052 explicit Query (const string& predicate="") : string(predicate) {}
00053 explicit Query (format& pattern) : string(str(pattern)) {}
00054
00055 const string asKey() const
00056 {
00057 return string(typeid(OBJ).name())+": "+*this;
00058 }
00059
00060 operator string& () { return *this; }
00061 };
00062
00063
00064 namespace query
00065 {
00066
00071 void normalizeID (string& id);
00072
00073
00078 uint countPraed (const string&);
00079
00080
00081 const string extractID (Symbol, const string& termString);
00082
00083 const string removeTerm (Symbol, string& termString);
00084
00085
00086 }
00087
00088 }
00089 #endif