diff options
author | Denis Loh <denis.loh@gmail.com> | 2009-10-24 14:24:17 +0200 |
---|---|---|
committer | Denis Loh <denis.loh@gmail.com> | 2009-10-24 14:24:17 +0200 |
commit | 1cf955a715830130b7add8c1183d65b0f442fd23 (patch) | |
tree | c9d03961e9f83b1100ef6010a4a53063f127aa5d /misc/search.h | |
download | vdr-plugin-upnp-1cf955a715830130b7add8c1183d65b0f442fd23.tar.gz vdr-plugin-upnp-1cf955a715830130b7add8c1183d65b0f442fd23.tar.bz2 |
Initial commit
Diffstat (limited to 'misc/search.h')
-rw-r--r-- | misc/search.h | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/misc/search.h b/misc/search.h new file mode 100644 index 0000000..df2442e --- /dev/null +++ b/misc/search.h @@ -0,0 +1,90 @@ +/* + * File: search.h + * Author: savop + * + * Created on 27. August 2009, 21:21 + */ + +#ifndef _SEARCH_H +#define _SEARCH_H + +#include <map> +#include <vdr/tools.h> +#include "util.h" + +struct cSortCrit : public cListObject { + const char* Property; + bool SortDescending; +}; + +typedef std::map<const char*, const char*, strCmp> propertyMap; + +class cPathParser { +private: + cString mKey; + propertyMap mProperties; + int mSection; + int mMethod; + bool parsePath(const char* Path, int* Section, int* Method, propertyMap* Properties); + void pushPropertyKey(const char* Start, const char* End); + void pushPropertyValue(const char* Start, const char* End); + void pushMethod(int Method); + void pushSection(int Section); + cPathParser(); +public: + virtual ~cPathParser(); + static bool parse(const char* Path, int* Section, int* Method, propertyMap* Properties); +}; + +class cSortCriteria { +private: + cSortCrit* mCurrentCrit; + cList<cSortCrit>* mCriteriaList; + bool parseSort(const char* Sort); + void pushProperty(const char* Property); + void pushDirection(const char Direction); + cList<cSortCrit>* getSortList() const { return this->mCriteriaList; } + cSortCriteria(); +public: + virtual ~cSortCriteria(); + static cList<cSortCrit>* parse(const char* Sort); +}; + +class cFilterCriteria { +private: + cStringList* mFilterList; + cFilterCriteria(); + bool parseFilter(const char* Filter); + void pushProperty(const char* Property); + void pushAsterisk(const char Asterisk); + cStringList* getFilterList() const { return this->mFilterList; } +public: + virtual ~cFilterCriteria(); + static cStringList* parse(const char* Filter); +}; + +class cSearch { +private: + char* SQLWhereStmt; + const char* CurrentProperty; + const char* CurrentOperator; + const char* CurrentValue; + static cSearch* mInstance; + cSearch(); + bool parseCriteria(const char* Search); + void pushExistance (const char* Exists); + void pushProperty (const char* Property); + void pushOperator (const char* Operator); + void pushConcatOp (const char* Operator); + void pushStartBrackedExp(const char); + void pushEndBrackedExp(const char); + void pushValue (const char* Start, const char* End); + void pushExpression(const char* Start, const char* End); +public: + virtual ~cSearch(); + static const char* parse(const char* Search); +}; + + +#endif /* _SEARCH_H */ + |