AppOpts Pile   version 0.0.1
The pile provides the application with easy loading
appopts.h
Go to the documentation of this file.
1 
10 #ifndef GUARD_APPOPTS_H_INCLUDE
11 #define GUARD_APPOPTS_H_INCLUDE
12 
13 #include <appopts/appopts-config.h>
14 
15 #include <QMap>
16 #include <QString>
17 #include <QStringList>
18 
19 class UserMsg;
20 class PerSt;
21 class OneOpt;
22 class OneOptList;
23 
25 class APPOPTS_EXPORT AppOpts : public QMap<QString,QStringList> {
26 
27 
28 private:
29 
31  AppOpts (const AppOpts & other) :
32  system_file_(other.system_file_),
33  user_file_(other.user_file_),
34  local_file_(other.local_file_)
35  {}
36 
38  AppOpts& operator=( const AppOpts& ) {
39  return *this;
40  }
41 
42 public:
43 
45  AppOpts ();
46 
48  virtual ~AppOpts();
49 
51  bool
52  loadFromAll (
53  UserMsg & um,
54  const QString & s_app_name = QString());
55 
57  bool
58  loadFile (
59  const QString & s_file,
60  PerSt ** out_pers,
61  UserMsg & um);
62 
64  bool
65  readValueFromCfgs (
66  const OneOpt & opt,
67  UserMsg & um);
68 
70  bool
71  readMultipleFromCfgs (
72  const OneOptList & optlist,
73  UserMsg & um);
74 
76  void
77  setValue (
78  const QString & s_key,
79  const QString & s_value);
80 
82  void
83  setValue (
84  const QString & s_key,
85  const QStringList & sl_value);
86 
88  void
89  appendValue (
90  const QString & s_key,
91  const QString & s_value);
92 
94  void
95  appendValues (
96  const QString & s_key,
97  const QStringList & sl_values);
98 
100  bool
101  setCurrentConfig (
102  const QString & s_file,
103  UserMsg & um);
104 
106  bool
107  valueB (
108  const QString & s_name,
109  bool b_default = false) const;
110 
112  QString
113  valueS (
114  const QString & s_name,
115  const QString & s_default = QString()) const;
116 
118  QStringList
119  valueSL (
120  const QString & s_name,
121  const QStringList & sl_default = QStringList()) const;
122 
124  int
125  valueI (
126  const QString & s_name,
127  int i_default = 0) const;
128 
130  double
131  valueD (
132  const QString & s_name,
133  double d_default = 0.0) const;
134 
135 public:
136 
138  static QString
139  cfgFileName (
140  const QString &s_app_name);
141 
142 protected:
143 
144 
145 private:
146 
148  bool
149  readValueFromPerSt (
150  PerSt *perst,
151  const OneOpt & opt,
152  UserMsg & um);
153 
154  PerSt * system_file_;
155  PerSt * user_file_;
156  PerSt * local_file_;
157  PerSt * current_file_;
159 };
160 
161 
162 #endif // GUARD_APPOPTS_H_INCLUDE
A list of option definitions.
Definition: one_opt_list.h:24
Definition for an option.
Definition: one_opt.h:25
Application options.
Definition: appopts.h:25