blob: ae273238cab09fc6fce3626e190b97a8d854c3b7 (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
// Copyright 2008 Nanorex, Inc. See LICENSE file for details.
#ifndef NX_PROPERTIES_H
#define NX_PROPERTIES_H
#ifdef WIN32
# ifdef _MSC_VER
# pragma warning(disable:4786)
# endif
#endif
#include <map>
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
namespace Nanorex {
/* CLASS: NXProperties */
/**
* A set of key/value pairs.
* @ingroup NanorexUtility
*/
class NXProperties {
public:
NXProperties();
~NXProperties();
std::string writeToFile(const std::string& filename);
std::string readFromFile(const std::string& filename);
void setProperty(const std::string& key, const std::string& value);
void addProperties(NXProperties* newProps, const char* prePendChars);
bool keyExists(const char* key);
const char* getProperty(const char* key);
const char* getProperty(const char* key, const char* defaultValue);
const char* getProperty(const std::string& key);
const char* getProperty(const std::string& key,
const char* defaultValue);
std::vector<std::string> getPropertyKeys();
void clear();
private:
std::map<std::string, std::string> properties;
void deSerializeLine(const std::string& dataLine);
};
} // Nanorex::
#endif
|