Flow123d  JS_before_hm-979-g397e552
read_ini.h
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file read_ini.h
15  * @brief
16  */
17 
18 #ifndef READ_INI_H
19 #define READ_INI_H
20 
21 #include <vector>
22 
23 struct Ini_item;
24 struct Read_ini;
25 
26 #include "system/system.hh"
27 
28 struct Read_ini
29 {
30  char *ini_file;
31  char *ini_dir; /* absolute or relative path to the ini file */
32  struct Ini_item *ini_item;
33 };
34 
35 struct Ini_item
36 {
37  struct Ini_item *next;
38  struct Ini_item *prev;
39  char *section;
40  char *key;
41  char *value;
42 
43 };
44  long int OptGetInt(const char *section,const char *key,const char *defval);
45  char * OptGetStr(const char *section,const char *key,const char *defval);
46  char * OptGetFileName(const char *section,const char *key,const char *defval);
47  bool OptGetBool(const char *section,const char *key,const char *defval);
48  double OptGetDbl(const char *section,const char *key,const char *defval);
49  void OptionsInit(const char *fname );
50  /**
51  * Read value of particular key as list of doubles and store them into array.
52  * defval string is used if the key is not found.
53  */
54  void OptGetDblArray(const char *section, const char *key, const char *defval, std::vector<double> &array);
55 
56  void OptGetIntArray(const char *section, const char *key, const char *defval, int Arrsize, int *Array);
57  //char * OptGetStrArray();
58 
59 #endif
60 
bool OptGetBool(const char *section, const char *key, const char *defval)
Definition: read_ini.cc:325
void OptGetDblArray(const char *section, const char *key, const char *defval, std::vector< double > &array)
Definition: read_ini.cc:378
struct Ini_item * ini_item
Definition: read_ini.h:32
long int OptGetInt(const char *section, const char *key, const char *defval)
Definition: read_ini.cc:288
struct Ini_item * next
Definition: read_ini.h:37
char * value
Definition: read_ini.h:41
char * ini_dir
Definition: read_ini.h:31
Array< double > array
Definition: armor.hh:866
void OptGetIntArray(const char *section, const char *key, const char *defval, int Arrsize, int *Array)
Definition: read_ini.cc:405
char * ini_file
Definition: read_ini.h:30
char * section
Definition: read_ini.h:39
double OptGetDbl(const char *section, const char *key, const char *defval)
Definition: read_ini.cc:306
char * key
Definition: read_ini.h:40
char * OptGetStr(const char *section, const char *key, const char *defval)
Create new string from selected variable from ini file.
Definition: read_ini.cc:251
void OptionsInit(const char *fname)
Load options file.
Definition: read_ini.cc:347
struct Ini_item * prev
Definition: read_ini.h:38
char * OptGetFileName(const char *section, const char *key, const char *defval)
Definition: read_ini.cc:278