MythTV  master
dbaccess.h
Go to the documentation of this file.
1 #ifndef DBACCESS_H_
2 #define DBACCESS_H_
3 
4 #include <vector>
5 #include <utility> // for std::pair
6 
7 #include "mythmetaexp.h"
8 
9 class SingleValueImp;
10 
12 {
13  public:
14  typedef std::pair<int, QString> entry;
15  typedef std::vector<entry> entry_list;
16 
17  public:
18  int add(const QString &name);
19  bool get(int id, QString &category);
20  void remove(int id);
21  bool exists(int id);
22  bool exists(const QString &name);
23  const entry_list &getList();
24 
25  void load_data();
26 
27  protected:
28  explicit SingleValue(SingleValueImp *imp) : m_imp(imp) {}
29  virtual ~SingleValue();
30 
31  private:
32  SingleValueImp *m_imp {nullptr};
33 };
34 
35 class MultiValueImp;
37 {
38  public:
39  struct entry
40  {
41  int id;
42  typedef std::vector<long> values_type;
44  };
45  typedef std::vector<entry> entry_list;
46 
47  public:
48  int add(int id, int value);
49  bool get(int id, entry &values);
50  void remove(int id, int value);
51  void remove(int id);
52  bool exists(int id, int value);
53  bool exists(int id);
54 
55  void load_data();
56 
57  protected:
58  explicit MultiValue(MultiValueImp *imp) : m_imp(imp) {}
59  virtual ~MultiValue() = default;
60 
61  private:
62  MultiValueImp *m_imp {nullptr};
63 };
64 
66 {
67  public:
68  static VideoCategory &GetCategory();
69 
70  private:
71  VideoCategory();
72  ~VideoCategory() = default;
73 };
74 
76 {
77  public:
78  static VideoCountry &getCountry();
79 
80  private:
81  VideoCountry();
82  ~VideoCountry() = default;
83 };
84 
86 {
87  public:
88  static VideoGenre &getGenre();
89 
90  private:
91  VideoGenre();
92  ~VideoGenre() = default;
93 };
94 
96 {
97  public:
98  static VideoGenreMap &getGenreMap();
99 
100  private:
101  VideoGenreMap();
102  ~VideoGenreMap() = default;
103 };
104 
106 {
107  public:
108  static VideoCountryMap &getCountryMap();
109 
110  private:
111  VideoCountryMap();
112  ~VideoCountryMap() = default;
113 };
114 
116 {
117  public:
118  static VideoCast &GetCast();
119 
120  private:
121  VideoCast();
122  ~VideoCast() = default;
123 };
124 
126 {
127  public:
128  static VideoCastMap &getCastMap();
129 
130  private:
131  VideoCastMap();
132  ~VideoCastMap() = default;
133 };
134 
136 {
137  public:
139  {
140  unsigned int id {0};
141  QString extension;
142  QString playcommand;
143  bool ignore {false};
144  bool use_default {false};
145 
146  file_association() = default;
147  file_association(unsigned int l_id, const QString &ext,
148  const QString &playcmd, bool l_ignore,
149  bool l_use_default)
150  : id(l_id), extension(ext), playcommand(playcmd),
151  ignore(l_ignore), use_default(l_use_default) {}
152  };
153  typedef std::vector<file_association> association_list;
154  typedef std::vector<std::pair<QString, bool> > ext_ignore_list;
155 
156  public:
157  static FileAssociations &getFileAssociation();
158 
159  public:
160  bool add(file_association &fa);
161  bool get(unsigned int id, file_association &val) const;
162  bool get(const QString &ext, file_association &val) const;
163  bool remove(unsigned int id);
164 
165  const association_list &getList() const;
166 
167  void getExtensionIgnoreList(ext_ignore_list &ext_ignore) const;
168 
169  void load_data();
170 
171  private:
173  ~FileAssociations();
174 
175  private:
176  class FileAssociationsImp *m_imp {nullptr};
177 };
178 
179 #endif // DBACCESS_H_
std::vector< std::pair< QString, bool > > ext_ignore_list
Definition: dbaccess.h:154
std::vector< long > values_type
Definition: dbaccess.h:42
file_association(unsigned int l_id, const QString &ext, const QString &playcmd, bool l_ignore, bool l_use_default)
Definition: dbaccess.h:147
std::vector< file_association > association_list
Definition: dbaccess.h:153
std::vector< entry > entry_list
Definition: dbaccess.h:15
values_type values
Definition: dbaccess.h:43
#define META_PUBLIC
Definition: mythmetaexp.h:9
const char * name
Definition: ParseText.cpp:328
std::pair< int, QString > entry
Definition: dbaccess.h:14
SingleValue(SingleValueImp *imp)
Definition: dbaccess.h:28
std::vector< entry > entry_list
Definition: dbaccess.h:45
MultiValue(MultiValueImp *imp)
Definition: dbaccess.h:58