53 #ifndef TOOLS_INIFILE_HH 54 #define TOOLS_INIFILE_HH 116 bool connect(
const QString& name,
126 const QString&
name()
const {
return m_filename; }
135 bool section_exists(
const QString & _section)
const;
138 bool entry_exists(
const QString & _section,
const QString & _key)
const;
142 const QString & _key)
const 143 {
return entry_exists( _section, _key ); }
154 void add_section(
const QString & _sectionname);
157 void add_entry(
const QString & _section,
158 const QString & _key,
159 const QString & _value );
163 const QString & _key,
164 const char * _value )
165 { add_entry( _section, _key, QString(_value) ); }
168 void add_entry(
const QString & _section,
169 const QString & _key,
170 const double & _value);
173 void add_entry(
const QString & _section,
174 const QString & _key,
175 const float & _value);
178 void add_entry(
const QString & _section,
179 const QString & _key ,
183 void add_entry(
const QString & _section,
184 const QString & _key ,
185 const unsigned int & _value);
188 void add_entry(
const QString & _section,
189 const QString & _key ,
190 const bool & _value);
193 void add_entry(
const QString & _section,
194 const QString & _key ,
195 const std::vector<float> & _value);
198 void add_entry(
const QString & _section,
199 const QString & _key ,
200 const std::vector<double> & _value);
203 void add_entry(
const QString & _section,
204 const QString & _key ,
205 const std::vector<bool> & _value);
208 template <
typename VectorT >
209 void add_entryVec (
const QString & _section,
210 const QString & _key,
214 template <
typename VectorT >
215 void add_entryVec (
const QString & _section,
216 const QString & _key,
217 const std::vector< VectorT > & _value);
220 void add_entry(
const QString & _section,
221 const QString & _key ,
222 const std::vector<int> & _value);
225 void add_entry(
const QString & _section,
226 const QString & _key ,
227 const std::vector<QString> & _value);
230 void add_entry(
const QString & _section,
231 const QString & _key ,
232 const QStringList & _value);
244 void delete_entry(
const QString & _section,
const QString & _key);
247 void delete_section(
const QString & _sectionname );
259 bool get_entry( QString & _val,
260 const QString & _section,
261 const QString & _key )
const;
264 bool get_entry(
double & _val,
265 const QString & _section,
266 const QString & _key )
const;
269 bool get_entry(
float & _val,
270 const QString & _section,
271 const QString & _key )
const;
274 bool get_entry(
int & _val,
275 const QString & _section,
276 const QString & _key )
const;
279 bool get_entry(
unsigned int & _val,
280 const QString & _section,
281 const QString & _key )
const;
284 bool get_entry(
bool & _val,
285 const QString & _section,
286 const QString & _key)
const;
289 bool get_entry( std::vector<float> & _val,
290 const QString & _section,
291 const QString & _key)
const;
294 bool get_entry( std::vector<double> & _val,
295 const QString & _section,
296 const QString & _key)
const;
299 bool get_entry( std::vector<bool> & _val,
300 const QString & _section,
301 const QString & _key)
const;
304 bool get_entry( std::vector<int> & _val,
305 const QString & _section,
306 const QString & _key)
const;
309 bool get_entry( std::vector<QString> & _val,
310 const QString & _section,
311 const QString & _key )
const;
314 bool get_entry( QStringList & _val,
315 const QString & _section,
316 const QString & _key )
const;
319 template <
typename VectorT >
320 bool get_entryVecd (
VectorT & _val ,
321 const QString & _section,
322 const QString & _key )
const;
325 template <
typename VectorT >
326 bool get_entryVecf (
VectorT & _val ,
327 const QString & _section,
328 const QString & _key )
const;
331 template <
typename VectorT >
332 bool get_entryVeci (
VectorT & _val ,
333 const QString & _section,
334 const QString & _key )
const;
337 template <
typename VectorT >
338 bool get_entryVecd (std::vector< VectorT > & _val ,
339 const QString & _section,
340 const QString & _key )
const;
343 template <
typename VectorT >
344 bool get_entryVecf (std::vector< VectorT > & _val ,
345 const QString & _section,
346 const QString & _key )
const;
349 template <
typename VectorT >
350 bool get_entryVeci (std::vector< VectorT > & _val ,
351 const QString & _section,
352 const QString & _key )
const;
370 bool parseFile( QFile & _inputStream );
373 bool writeFile(
void );
387 #if defined(INCLUDE_TEMPLATES) && !defined(INIFILE_C) 388 #define INIFILE_TEMPLATES 389 #include "INIFileT.cc" std::map< QString, EntryMap > SectionMap
Type for map of contained sections.
void add_entry(const QString &_section, const QString &_key, const char *_value)
Addition / modification of a string entry, given as char array.
const QString & name() const
Access to name of connected file.
std::map< QString, QString > EntryMap
Type for map of contained entries.
QString m_filename
Name of current INI file.
bool mf_isConnected
Flag: this object is connected to an INI file.
Class for the handling of simple configuration files.
SectionMap m_iniData
Stored data of an INI file.
bool entry_in_section(const QString &_section, const QString &_key) const
Same as entry_exists() (for backward compatibility)
bool is_connected() const
Check if object is connected to file.