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
10class 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
36class 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:
73 ~VideoCategory() override = default;
74};
75
77{
78 public:
79 static VideoCountry &getCountry();
80
81 private:
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:
103 ~VideoGenreMap() override = default;
104};
105
107{
108 public:
109 static VideoCountryMap &getCountryMap();
110
111 private:
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:
175
176 private:
177 class FileAssociationsImp *m_imp {nullptr};
178};
179
180#endif // DBACCESS_H_
std::vector< std::pair< QString, bool > > ext_ignore_list
Definition: dbaccess.h:155
std::vector< file_association > association_list
Definition: dbaccess.h:154
std::vector< entry > entry_list
Definition: dbaccess.h:46
virtual ~MultiValue()=default
MultiValue(MultiValueImp *imp)
Definition: dbaccess.h:59
std::pair< int, QString > entry
Definition: dbaccess.h:15
SingleValue(SingleValueImp *imp)
Definition: dbaccess.h:29
std::vector< entry > entry_list
Definition: dbaccess.h:16
~VideoCastMap() override=default
~VideoCast() override=default
~VideoCategory() override=default
~VideoCountryMap() override=default
~VideoCountry() override=default
~VideoGenreMap() override=default
~VideoGenre() override=default
#define META_PUBLIC
Definition: mythmetaexp.h:9
STL namespace.
bool exists(str path)
Definition: xbmcvfs.py:51
file_association(unsigned int l_id, QString ext, QString playcmd, bool l_ignore, bool l_use_default)
Definition: dbaccess.h:148
std::vector< long > values_type
Definition: dbaccess.h:43
values_type values
Definition: dbaccess.h:44