summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/parser.h124
-rw-r--r--include/setup.h109
2 files changed, 233 insertions, 0 deletions
diff --git a/include/parser.h b/include/parser.h
new file mode 100644
index 0000000..79c646d
--- /dev/null
+++ b/include/parser.h
@@ -0,0 +1,124 @@
+/*
+ * parser.h
+ *
+ * Created on: 16.09.2012
+ * Author: savop
+ */
+
+#ifndef PARSER_H_
+#define PARSER_H_
+
+#include <map>
+#include <string>
+#include <sstream>
+#include <list>
+#include "../include/tools.h"
+
+using namespace std;
+
+namespace upnp {
+
+
+/**
+ * Sort criteria
+ *
+ * This is a structure for sorting objects. It has a certain property and
+ * a direction flag.
+ */
+struct SortCrit {
+ string property; ///< the Property, which shall be sorted
+ bool sortDescending; ///< sort the objects in descending order
+};
+
+//typedef std::map<const char*, const char*, strCmp> propertyMap;
+
+/**
+ * Creates a list with sort criteria
+ *
+ * This parser creates a list of sort criteria. It parses the sort criteria string
+ * from a \em Browse or \em Search request and stores the information in a \c cSortCrit
+ * structure.
+ */
+class cSortCriteria {
+public:
+ typedef list<SortCrit> SortCriteriaList;
+private:
+ SortCrit mCurrentCrit;
+ SortCriteriaList mCriteriaList;
+ bool parseSort(string sort);
+ void pushProperty(string property);
+ void pushDirection(bool desc);
+ SortCriteriaList getSortList() const { return this->mCriteriaList; }
+ cSortCriteria();
+public:
+ virtual ~cSortCriteria();
+ /**
+ * Parses the sort criteria
+ *
+ * This parses the sort criteria and returns a list with valid criterias
+ *
+ * @return returns
+ * - a list with valid sort criterias
+ * - \bc null, otherwise
+ */
+ static SortCriteriaList parse(
+ const string& sort ///< the string container the sort criteria
+ );
+};
+
+/**
+ * Parses the filter criteria
+ *
+ * This parses the filter criteria which comes from a \em Browse or \em Search
+ * request.
+ */
+class cFilterCriteria {
+private:
+ StringList mFilterList;
+ cFilterCriteria();
+ bool parseFilter(string filter);
+ void pushProperty(const char* start, const char* end);
+ void pushAsterisk(const char asterisk);
+ StringList getFilterList() const { return this->mFilterList; }
+public:
+ virtual ~cFilterCriteria();
+ /**
+ * Parses the filter criteria
+ *
+ * This parses the filter criteria. It may be a empty string list, a \bc NULL
+ * pointer or a list with properties which shall be shown in the \em DIDL-Lite fragment.
+ *
+ * @return the stringlist containing the filter
+ */
+ static StringList parse(
+ const string& Filter = "*" ///< the filter string
+ );
+};
+
+/**
+ * @private
+ */
+class cSearch {
+private:
+ stringstream sqlWhereStmt;
+ string currentProperty;
+ string currentOperator;
+ string currentValue;
+ cSearch();
+ bool parseCriteria(string Search);
+ void pushExistance (string Exists);
+ void pushProperty (string Property);
+ void pushOperator (string Operator);
+ void pushConcatOp (string 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 string parse(const string& Search);
+};
+
+} // namespace upnp
+
+#endif /* PARSER_H_ */
diff --git a/include/setup.h b/include/setup.h
new file mode 100644
index 0000000..6ff0961
--- /dev/null
+++ b/include/setup.h
@@ -0,0 +1,109 @@
+/*
+ * setup.h
+ *
+ * Created on: 21.09.2012
+ * Author: savop
+ */
+
+#ifndef SETUP_H_
+#define SETUP_H_
+
+#include <vdr/plugin.h>
+#include "../include/config.h"
+#include "../include/tools.h"
+
+#define STRING_SIZE 1024
+
+class cMenuEditIpItem: public cMenuEditItem {
+private:
+ char *value;
+ int curNum;
+ int pos;
+ bool step;
+protected:
+ virtual void Set(void);
+public:
+ cMenuEditIpItem(const char *Name, char *Value); // Value must be 16 bytes
+ ~cMenuEditIpItem();
+ virtual eOSState ProcessKey(eKeys Key);
+};
+
+/**
+ * The VDR setup page
+ *
+ * This class shows and manages the settings within the VDR setup OSD
+ *
+ */
+class cMenuSetupUPnP : public cMenuSetupPage {
+public:
+ cMenuSetupUPnP();
+ virtual ~cMenuSetupUPnP();
+
+ /**
+ * Processes a keystroke
+ *
+ * This processes a keystroke which is done by the user and updates the
+ * menu accordingly
+ *
+ * It returns the current state of the VDR after pressing a key
+ *
+ * @return The current state of the VDR
+ */
+ virtual eOSState ProcessKey(
+ eKeys Key ///< Key, pressed by the user
+ );
+
+ static bool SetupParse(const char *Name, const char *Value, upnp::cConfig& config);
+protected:
+ /**
+ * Stores the setup information
+ *
+ * This stores the setup information in the configuration file
+ */
+ virtual void Store(void);
+
+ /**
+ * Update the menu
+ *
+ * This updates the menu osd and refreshes the screen.
+ */
+ void Update(void);
+
+ /**
+ * Loads the setup information
+ *
+ * This loads the setup information from the configuration file
+ */
+ void Load(void);
+private:
+
+ cOsdItem *ctrlGenerate;
+
+ int switchExpertSettings;
+ int switchBindAddress;
+ int switchLive;
+ int interfaceIndex;
+
+ int upnpport;
+ int wsport;
+ int lvport;
+
+ char webserverRoot[STRING_SIZE];
+ char presentationUrl[STRING_SIZE];
+ char address[16];
+ char interface[16];
+ char databaseFile[STRING_SIZE];
+ char deviceUUID[STRING_SIZE];
+
+ upnp::cConfig config;
+
+ void GetInterfaces();
+ int GetIndexOfInterface(std::string interface) const;
+
+ const char* interfaces[16];
+ int ifaceCount;
+
+ upnp::StringVector ifaceVector;
+};
+
+#endif /* SETUP_H_ */