blob: a60c4b8fd0921b651f13aa17be18ae787e986c7f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#ifndef __LIBUTIL_CONFIG_H__
#define __LIBUTIL_CONFIG_H__
#include <iostream>
#include "Map.h"
namespace LibUtil
{
class Config : public StringMap
{
public:
Config(const String& delimiter_ = "=", const String& comment_ = "#", const String& sentry_ = "End");
Config(const Config& config_);
virtual ~Config();
public:
// Make a copy of this instance
virtual Config* clone() const;
// Load the config from file
virtual void readFile(const String& filename_);
// Parse string and overwrite the Config instance if keys exist
virtual void readString(const String& str_);
// Write or read map using standard IO
friend std::ostream& operator<<(std::ostream& ost_, const Config& config_);
friend std::istream& operator>>(std::istream& ist_, Config& config_);
protected:
String mDelimiter;
String mComment;
String mSentry;
};
}
#endif // __LIBUTIL_CONFIG_H__
|