Subversion Repositories spk

Rev

Rev 1 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 cycrow 1
/*
2
  defines Settings - class that stores all the settings used by bob_dom_bob and 
3
  bob_dom_cut when loading/saving bob1/cut1 data
4
*/
5
 
6
#ifndef SETTINGS_INCLUDED
7
#define SETTINGS_INCLUDED
8
 
9
#include "../common/ext_list.h"
10
 
11
class Settings
12
{
13
	public:
14
		enum ErrorType{
15
			Error,
16
			Warning
17
		};
18
 
19
		enum ErrorCodes
20
		{
21
			E_BadConstantDeclaration,
22
			E_BadFormatDeclaration,
23
			E_SectionEmpty,
24
			W_LineIgnored,
25
			W_ConstantAlwaysZero
26
		};
27
 
28
		enum SwitchValue
29
		{
30
			on,
31
			off,
32
			notSet
33
		};
34
 
35
		struct ErrorMsg
36
		{
37
			ErrorType type;
38
			ErrorCodes code;
39
			char message[255];
40
		};
41
 
42
	private:
43
		typedef ext::list<ErrorMsg*> ErrorList;
44
 
45
	public:
46
		typedef ErrorList::iterator ErrorIterator;
47
 
48
	private:
49
 
50
		bool m_bOutputWarnings; // write warnings to file
114 cycrow 51
		bool m_bRawMode;				// don't convert to BOD format
1 cycrow 52
		bool m_bXtraPntInfo; // whether extra point info is outputed to BOD
114 cycrow 53
		bool m_bWriteX3Data; // whether to compute/write x3 vertex data and extra part data
1 cycrow 54
 
55
		void error(ErrorType type, ErrorCodes code, const char *format, ...);
56
 
57
	public:
58
		ErrorList errors;
59
 
60
		bool loadINI(const char *pszFileName);
61
 
62
		bool outputWarnings() const { return m_bOutputWarnings; }
63
		void outputWarnings(bool val) { m_bOutputWarnings=val; }
114 cycrow 64
		bool rawMode() const { return m_bRawMode; }
65
		void rawMode(bool val) { m_bRawMode=val; }
1 cycrow 66
		bool extraPntInfo() const { return m_bXtraPntInfo; }
67
		void extraPntInfo(bool val) { m_bXtraPntInfo=val; }
114 cycrow 68
		void writeX3Data(bool val) { m_bWriteX3Data=val; }
69
		bool writeX3Data() const { return m_bWriteX3Data; }
1 cycrow 70
 
71
		void clearErrors()
72
		{
73
			for(ErrorIterator &it=errors.begin(); it!=errors.end(); ++it){
74
				delete *it;
75
			}
76
			errors.clear();
77
		}
78
 
114 cycrow 79
		Settings() { outputWarnings(false); rawMode(false); extraPntInfo(true); }
1 cycrow 80
 
81
		~Settings()
82
		{
83
			clearErrors();
84
		}
85
 
86
};
87
 
88
#endif // !defined(SETTINGS_INCLUDED)