00001 #ifndef DBACCESS_H_
00002 #define DBACCESS_H_
00003
00004 class SingleValueImp;
00005
00006 class SingleValue
00007 {
00008 public:
00009 typedef std::pair<int, QString> entry;
00010 typedef std::vector<entry> entry_list;
00011
00012 public:
00013 int add(const QString &name);
00014 bool get(int id, QString &value);
00015 void remove(int id);
00016 bool exists(int id);
00017 bool exists(const QString &name);
00018 const entry_list &getList();
00019
00020 void load_data();
00021
00022 protected:
00023 SingleValue(SingleValueImp *imp);
00024 virtual ~SingleValue();
00025
00026 private:
00027 SingleValueImp *m_imp;
00028 };
00029
00030 class MultiValueImp;
00031 class MultiValue
00032 {
00033 public:
00034 struct entry
00035 {
00036 int id;
00037 typedef std::vector<long> values_type;
00038 values_type values;
00039 };
00040 typedef std::vector<entry> entry_list;
00041
00042 public:
00043 int add(int id, int value);
00044 bool get(int id, entry &values);
00045 void remove(int id, int value);
00046 void remove(int id);
00047 bool exists(int id, int value);
00048 bool exists(int id);
00049
00050 void load_data();
00051
00052 protected:
00053 MultiValue(MultiValueImp *imp);
00054 virtual ~MultiValue();
00055
00056 private:
00057 MultiValueImp *m_imp;
00058 };
00059
00060 class VideoCategory : public SingleValue
00061 {
00062 public:
00063 static VideoCategory &getCategory();
00064
00065 private:
00066 VideoCategory();
00067 ~VideoCategory();
00068 };
00069
00070 class VideoCountry : public SingleValue
00071 {
00072 public:
00073 static VideoCountry &getCountry();
00074
00075 private:
00076 VideoCountry();
00077 ~VideoCountry();
00078 };
00079
00080 class VideoGenre : public SingleValue
00081 {
00082 public:
00083 static VideoGenre &getGenre();
00084
00085 private:
00086 VideoGenre();
00087 ~VideoGenre();
00088 };
00089
00090 class VideoGenreMap : public MultiValue
00091 {
00092 public:
00093 static VideoGenreMap &getGenreMap();
00094
00095 private:
00096 VideoGenreMap();
00097 ~VideoGenreMap();
00098 };
00099
00100 class VideoCountryMap : public MultiValue
00101 {
00102 public:
00103 static VideoCountryMap &getCountryMap();
00104
00105 private:
00106 VideoCountryMap();
00107 ~VideoCountryMap();
00108 };
00109
00110 class VideoCast : public SingleValue
00111 {
00112 public:
00113 static VideoCast &getCast();
00114
00115 private:
00116 VideoCast();
00117 ~VideoCast();
00118 };
00119
00120 class VideoCastMap : public MultiValue
00121 {
00122 public:
00123 static VideoCastMap &getCastMap();
00124
00125 private:
00126 VideoCastMap();
00127 ~VideoCastMap();
00128 };
00129
00130 class FileAssociations
00131 {
00132 public:
00133 struct file_association
00134 {
00135 unsigned int id;
00136 QString extension;
00137 QString playcommand;
00138 bool ignore;
00139 bool use_default;
00140
00141 file_association();
00142 file_association(unsigned int l_id, const QString &ext,
00143 const QString &playcmd, bool l_ignore,
00144 bool l_use_default);
00145 };
00146 typedef std::vector<file_association> association_list;
00147 typedef std::vector<std::pair<QString, bool> > ext_ignore_list;
00148
00149 public:
00150 static FileAssociations &getFileAssociation();
00151
00152 public:
00153 unsigned int add(const QString &ext, const QString &playcommand,
00154 bool ignore, bool use_default);
00155 bool get(unsigned int id, file_association &val) const;
00156 bool get(const QString &ext, file_association &val) const;
00157 bool remove(unsigned int id);
00158
00159 const association_list &getList() const;
00160
00161 void getExtensionIgnoreList(ext_ignore_list &ext_ignore) const;
00162
00163 void load_data();
00164
00165 private:
00166 FileAssociations();
00167 ~FileAssociations();
00168
00169 private:
00170 class FileAssociationsImp *m_imp;
00171 };
00172
00173 #endif // DBACCESS_H_