summaryrefslogtreecommitdiff
path: root/muggle-plugin/mg_order.h
diff options
context:
space:
mode:
authorLarsAC <LarsAC@e10066b5-e1e2-0310-b819-94efdf66514b>2005-02-07 09:17:20 +0000
committerLarsAC <LarsAC@e10066b5-e1e2-0310-b819-94efdf66514b>2005-02-07 09:17:20 +0000
commitdc3634d51703fea88aff2f7069928f4a963a1025 (patch)
treed7e8dcd2ff3a484636fd2b2a2a5355d1105ad388 /muggle-plugin/mg_order.h
parentf4cd003ec36478f58edbccaebdf19cd70d5b13ff (diff)
downloadvdr-plugin-muggle-dc3634d51703fea88aff2f7069928f4a963a1025.tar.gz
vdr-plugin-muggle-dc3634d51703fea88aff2f7069928f4a963a1025.tar.bz2
Merged most recent stuff from osd_extensions trunk for next release (0.1.2)
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/trunk@447 e10066b5-e1e2-0310-b819-94efdf66514b
Diffstat (limited to 'muggle-plugin/mg_order.h')
-rw-r--r--muggle-plugin/mg_order.h41
1 files changed, 29 insertions, 12 deletions
diff --git a/muggle-plugin/mg_order.h b/muggle-plugin/mg_order.h
index d46f244..71907da 100644
--- a/muggle-plugin/mg_order.h
+++ b/muggle-plugin/mg_order.h
@@ -12,6 +12,8 @@
#include <sstream>
#include <ostream>
+#include "mg_valmap.h"
+
using namespace std;
typedef list<string> strlist;
@@ -24,20 +26,26 @@ static const string EMPTY = "XNICHTGESETZTX";
string& addsep (string & s, string sep, string n);
enum mgKeyTypes {
- keyGenre1 = 1,
+ keyGenre1=1, // the genre types must have exactly this order!
keyGenre2,
+ keyGenre3,
+ keyGenres,
+ keyDecade,
+ keyYear,
keyArtist,
+ keyAlbum,
keyTitle,
keyTrack,
- keyDecade,
- keyCollection,
- keyCollectionItem,
- keyAlbum,
keyLanguage,
keyRating,
- keyYear,
+ keyCollection,
+ keyCollectionItem,
};
-const mgKeyTypes mgKeyTypesHigh = keyYear;
+const mgKeyTypes mgKeyTypesLow = keyGenre1;
+const mgKeyTypes mgKeyTypesHigh = keyCollectionItem;
+const unsigned int mgKeyTypesNr = keyCollectionItem;
+
+bool iskeyGenre(mgKeyTypes kt);
class mgParts;
@@ -79,7 +87,7 @@ class mgKey {
virtual string map_idfield() const { return ""; }
virtual string map_valuefield() const { return ""; }
virtual string map_valuetable() const { return ""; }
- void setdb(MYSQL *db) { m_db = db; }
+ void setdb(MYSQL *db);
protected:
MYSQL *m_db;
};
@@ -88,9 +96,10 @@ class mgKey {
mgKey*
ktGenerate(const mgKeyTypes kt,MYSQL *db);
-const char * const
-ktName(const mgKeyTypes kt);
-
+const char * const ktName(const mgKeyTypes kt);
+mgKeyTypes ktValue(const char * name);
+vector < const char*> ktNames();
+
typedef vector<mgKey*> keyvector;
class mgParts {
@@ -117,6 +126,8 @@ string
sql_string (MYSQL *db, const string s);
MYSQL_RES * exec_sql (MYSQL *db,string query);
+string get_col0 (MYSQL *db,string query);
+int exec_count (MYSQL *db,string query);
//! \brief converts long to string
string itos (int i);
@@ -130,9 +141,10 @@ const unsigned int MaxKeys = 20;
class mgOrder {
public:
mgOrder();
+ mgOrder(mgValmap& nv, char *prefix);
+ mgOrder(vector<mgKeyTypes> kt);
void setDB(MYSQL *db);
mgParts Parts(unsigned int level,bool orderby=true) const;
- string Name;
const mgOrder& operator=(const mgOrder& from);
mgOrder& operator+=(mgKey* k);
mgKey*& operator[](unsigned int idx);
@@ -146,9 +158,14 @@ public:
mgKeyTypes getKeyType(unsigned int idx) const;
string getKeyValue(unsigned int idx) const;
string getKeyId(unsigned int idx) const;
+ void setKeys(vector<mgKeyTypes> kt);
+ string Name();
private:
MYSQL *m_db;
keyvector Keys;
+ void setKey (const unsigned int level, const mgKeyTypes kt);
};
+bool operator==(const mgOrder& a,const mgOrder&b); //! \brief compares only the order, not the current key values
+
#endif // _MG_SQL_H