Hugin trunk 0.1
Loading...
Searching...
No Matches
IniParser.h
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
2
12 /* This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
16 *
17 * This software is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public
23 * License along with this software. If not, see
24 * <http://www.gnu.org/licenses/>.
25 *
26 */
27
28#ifndef INI_PARSER_H
29#define INI_PARSER_H
30
31#include <string>
32#include <map>
33#include <vector>
34
38{
39public:
43 int Read(const std::string& file);
44
46 bool HasKey(const std::string& section, const std::string& key) const;
47
49 std::string GetKey(const std::string& section, const std::string& key, const std::string& defaultValue) const;
50 int GetKey(const std::string& section, const std::string& key, const int defaultValue) const;
51 bool GetKey(const std::string& section, const std::string& key, const bool defaultValue) const;
52
54 std::vector<std::string> GetSections() const;
56 std::vector<std::string> GetKeys(const std::string& section) const;
58 void PrintValues() const;
59private:
61 typedef std::map<std::string, std::string> IniValues;
63 std::map<std::string, IniValues> m_iniValues;
64};
65
66#endif
A simple parser for ini files, it implements only some basic features.
Definition IniParser.h:38
std::vector< std::string > GetKeys(const std::string &section) const
returns a vector of all know keys in given section
std::vector< std::string > GetSections() const
returns a vector of all know sections
std::map< std::string, IniValues > m_iniValues
map to store the information from different sections
Definition IniParser.h:63
int Read(const std::string &file)
Reads the given ini file.
Definition IniParser.cpp:34
bool HasKey(const std::string &section, const std::string &key) const
Checks if given section/key exists.
Definition IniParser.cpp:87
void PrintValues() const
for debugging purpose, print all values
std::string GetKey(const std::string &section, const std::string &key, const std::string &defaultValue) const
returns the value of the given section/key or default value if it does not exists
std::map< std::string, std::string > IniValues
stores the key/values pairs for each section
Definition IniParser.h:61
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.
Definition threshold.h:41