-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetting.h
More file actions
56 lines (40 loc) · 1.31 KB
/
Setting.h
File metadata and controls
56 lines (40 loc) · 1.31 KB
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
52
53
54
55
56
/*
* Setting.h
*
* Created on: 22 March 2012
* Author: Max Foster
*/
#ifndef SETTING_H
#define SETTING_H
#include <fstream>
#include "Record.h"
class Setting : public Record
{
public:
static const std::string databaseFilename;
static const int
minKeyLength, maxKeyLength,
minValueLength, maxValueLength;
static int size();
Setting(const char *key = "", const char *value = "");
Setting(const Setting &setting);
~Setting();
void operator =(const Setting &setting);
void writeToFile(std::fstream &file) const;
void readFromFile(std::fstream &file);
bool hasMatchingField(const std::string &fieldName, const int searchTerm) const;
bool hasMatchingField(const std::string &fieldName, const char *searchTerm) const;
bool fieldCompare(const Setting &rhs) const;
bool completeCompare(const Setting &rhs) const;
const char * getKey() const;
void setKey(const char *newKey);
static bool isValidKey(const char *value, std::string &errorMessage);
const char * getValue() const;
void setValue(const char *newValue);
static bool isValidValue(const char *value, std::string &errorMessage);
void validate() const;
private:
char *key, *value;
};
std::ostream & operator <<(std::ostream &stream, const Setting &setting);
#endif // SETTING_H