cpp-utilities/io/inifile.h

58 lines
1.5 KiB
C
Raw Normal View History

2015-07-07 00:50:49 +02:00
#ifndef IOUTILITIES_INIFILE_H
#define IOUTILITIES_INIFILE_H
2015-09-06 20:19:09 +02:00
#include "../application/global.h"
2015-07-07 00:50:49 +02:00
#include <vector>
2015-07-07 00:50:49 +02:00
#include <map>
2015-09-01 16:06:37 +02:00
#include <string>
2015-07-07 00:50:49 +02:00
namespace IoUtilities {
class LIB_EXPORT IniFile
{
public:
IniFile();
std::vector<std::pair<std::string, std::multimap<std::string, std::string> > > &data();
const std::vector<std::pair<std::string, std::multimap<std::string, std::string> > > &data() const;
2015-07-07 00:50:49 +02:00
void parse(std::istream &inputStream);
void make(std::ostream &outputStream);
private:
std::vector<std::pair<std::string, std::multimap<std::string, std::string> > > m_data;
2015-07-07 00:50:49 +02:00
};
/*!
* \brief Constructs an empty ini file.
*/
inline IniFile::IniFile()
{}
/*!
* \brief Returns the data of the file.
*
* - The keys in the returned map represent the [scope name]s.
* - The values in the returned map are maps representing "key = value"-pairs within the scope.
* - The data might be modified an saved using the make() method.
*/
inline std::vector<std::pair<std::string, std::multimap<std::string, std::string> > > &IniFile::data()
2015-07-07 00:50:49 +02:00
{
return m_data;
}
/*!
* \brief Returns the data of the file.
*
* - The keys in the returned map represent the [scope name]s.
* - The values in the returned map are maps representing "key = value"-pairs within the scope.
*/
inline const std::vector<std::pair<std::string, std::multimap<std::string, std::string> > > &IniFile::data() const
2015-07-07 00:50:49 +02:00
{
return m_data;
}
} // namespace IoUtilities
#endif // IOUTILITIES_INIFILE_H