summaryrefslogtreecommitdiff
path: root/mg_content.h
diff options
context:
space:
mode:
Diffstat (limited to 'mg_content.h')
-rw-r--r--mg_content.h38
1 files changed, 32 insertions, 6 deletions
diff --git a/mg_content.h b/mg_content.h
index ee97745..653299c 100644
--- a/mg_content.h
+++ b/mg_content.h
@@ -12,37 +12,56 @@
#ifndef _MG_CONTENT_H
#define _MG_CONTENT_H
#include <stdlib.h>
-#include <mysql/mysql.h>
#include <string>
#include <list>
#include <vector>
#include <map>
+#include <mysql/mysql.h>
using namespace std;
#include "mg_tools.h"
#include "mg_valmap.h"
-#include "mg_order.h"
typedef vector<string> strvector;
class mgSelection;
+class mgListItem
+{
+ public:
+ mgListItem();
+ mgListItem(string v,string i,unsigned int c=0);
+ void set(string v,string i,unsigned int c=0);
+ void operator=(const mgListItem& from);
+ void operator=(const mgListItem* from);
+ bool operator==(const mgListItem& other) const;
+ string value() const { return m_value; }
+ string id() const { return m_id; }
+ unsigned int count() const { return m_count; }
+ bool valid() const { return m_valid; }
+ private:
+ bool m_valid;
+ string m_value;
+ string m_id;
+ unsigned int m_count;
+};
+
//! \brief represents a content item like an mp3 file.
class mgContentItem
{
public:
mgContentItem ();
- mgSelItem* getKeyItem(mgKeyTypes kt);
+ mgListItem* getKeyItem(mgKeyTypes kt);
//! \brief copy constructor
mgContentItem(const mgContentItem* c);
//! \brief construct an item from an SQL row
- mgContentItem (const mgSelection* sel, const MYSQL_ROW row);
+ mgContentItem (const MYSQL_ROW row);
//! \brief returns track id
- long getTrackid () const
+ long getItemid () const
{
return m_trackid;
}
@@ -91,11 +110,16 @@ class mgContentItem
//! \brief returns # of channels
int getChannels () const;
+
+ bool Valid() const;
private:
+ mutable bool m_valid;
+ mutable bool m_validated;
long m_trackid;
string m_title;
- string m_mp3file;
+ mutable string m_mp3file;
+ string m_realfile;
string m_artist;
string m_albumtitle;
string m_genre1_id;
@@ -110,6 +134,8 @@ class mgContentItem
int m_duration;
int m_samplerate;
int m_channels;
+ bool readable(string filename) const;
};
+extern mgListItem zeroitem;
#endif