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