00001
#ifndef PROPSFILE_H
00002
#define PROPSFILE_H
00003
00004
#include <map>
00005
#include <string>
00006
#include <exception>
00007
#include <algorithm>
00008
#include <set>
00009
00010
#include "Exceptions.h"
00011
00012 BOREALIS_NAMESPACE_BEGIN;
00013
00051 class PropsFile
00052 {
00053
public:
00054
00055
00056
PropsFile(string filepath)
00057
throw (
AuroraException);
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
PropsFile(string filepath, string prefix,
int argc,
const char* argv[])
00078
throw (
AuroraException);
00079
00080
virtual ~PropsFile();
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092 map<string, string>
findPropsByPrefix(string prefix)
const
00093
throw (
AuroraException);
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
bool getBool(string propName)
const
00106
throw (
AuroraException);
00107
00108
bool isBoolPropDefined(string propName)
const
00109
throw (
AuroraException);
00110
00111
bool getBoolWithDefault(string propName,
bool defaultValue)
const;
00112
00113
00114
00115
int getInt(string propName)
const
00116
throw (
AuroraException);
00117
00118
bool isIntPropDefined(string propName)
const
00119
throw (
AuroraException);
00120
00121
int getIntWithDefault(string propName,
int defaultValue)
const;
00122
00123
00124
00125
unsigned int getUInt(string propName)
const
00126
throw (
AuroraException);
00127
00128
bool isUIntPropDefined(string propName)
const
00129
throw (
AuroraException);
00130
00131
unsigned int getUIntWithDefault(string propName,
unsigned int defaultValue)
const;
00132
00133
00134
00135
long getLong(string propName)
const
00136
throw (
AuroraException);
00137
00138
bool isLongPropDefined(string propName)
const
00139
throw (
AuroraException);
00140
00141
long getLongWithDefault(string propName,
long defaultValue)
const;
00142
00143
00144
00145
unsigned long getULong(string propName)
const
00146
throw (
AuroraException);
00147
00148
bool isULongPropDefined(string propName)
const
00149
throw (
AuroraException);
00150
00151
unsigned long getULongWithDefault(string propName,
unsigned long defaultValue)
const;
00152
00153
00154
00155
unsigned long long getULongLong(string propName)
const
00156
throw (
AuroraException);
00157
00158
bool isULongLongPropDefined(string propName)
const
00159
throw (
AuroraException);
00160
00161
unsigned long long getULongLongWithDefault(string propName,
unsigned long long defaultValue)
const;
00162
00163
00164
00165
double getDouble(string propName)
const
00166
throw (
AuroraException);
00167
00168
bool isDoubleDefined(string propName)
const
00169
throw (
AuroraException);
00170
00171
double getDoubleWithDefault(string propName,
double defaultValue)
const;
00172
00173
00174
00175 string
getString(string propName)
const
00176
throw (
AuroraException);
00177
00178
bool isStringPropDefined(string propName)
const
00179
throw (
AuroraException);
00180
00181 string
getStringWithDefault(string propName, string defaultValue)
const;
00182
00183
00184
00185
private:
00186
00187 map<string, bool> _boolMap;
00188 map<string, int> _intMap;
00189 map<string, unsigned int> _uintMap;
00190 map<string, long> _longMap;
00191 map<string, unsigned long> _ulongMap;
00192 map<string, unsigned long long> _ulongLongMap;
00193 map<string, double> _doubleMap;
00194 map<string, string> _stringMap;
00195
00196
struct AliasTarget
00197 {
00198 string _propName;
00199 string _propType;
00200
00201 AliasTarget(string propName, string propType)
00202 : _propName(propName),
00203 _propType(propType)
00204 {
00205 }
00206 };
00207
00208
00209 map<string, AliasTarget> _aliasMap;
00210
00211
void loadFile(string filepath)
00212
throw (
AuroraException);
00213 };
00214
00215 BOREALIS_NAMESPACE_END;
00216
00217
#endif