Rev 1 | Blame | Compare with Previous | Last modification | View Log | RSS feed
/*
defines Settings - class that stores all the settings used by bob_dom_bob and
bob_dom_cut when loading/saving bob1/cut1 data
*/
#ifndef SETTINGS_INCLUDED
#define SETTINGS_INCLUDED
#include "../common/ext_list.h"
class Settings
{
public:
enum ErrorType{
Error,
Warning
};
enum ErrorCodes
{
E_BadConstantDeclaration,
E_BadFormatDeclaration,
E_SectionEmpty,
W_LineIgnored,
W_ConstantAlwaysZero
};
enum SwitchValue
{
on,
off,
notSet
};
struct ErrorMsg
{
ErrorType type;
ErrorCodes code;
char message[255];
};
private:
typedef ext::list<ErrorMsg*> ErrorList;
public:
typedef ErrorList::iterator ErrorIterator;
private:
bool m_bOutputWarnings; // write warnings to file
bool m_bRawMode; // don't convert to BOD format
bool m_bXtraPntInfo; // whether extra point info is outputed to BOD
bool m_bWriteX3Data; // whether to compute/write x3 vertex data and extra part data
void error(ErrorType type, ErrorCodes code, const char *format, ...);
public:
ErrorList errors;
bool loadINI(const char *pszFileName);
bool outputWarnings() const { return m_bOutputWarnings; }
void outputWarnings(bool val) { m_bOutputWarnings=val; }
bool rawMode() const { return m_bRawMode; }
void rawMode(bool val) { m_bRawMode=val; }
bool extraPntInfo() const { return m_bXtraPntInfo; }
void extraPntInfo(bool val) { m_bXtraPntInfo=val; }
void writeX3Data(bool val) { m_bWriteX3Data=val; }
bool writeX3Data() const { return m_bWriteX3Data; }
void clearErrors()
{
for(ErrorIterator &it=errors.begin(); it!=errors.end(); ++it){
delete *it;
}
errors.clear();
}
Settings() { outputWarnings(false); rawMode(false); extraPntInfo(true); }
~Settings()
{
clearErrors();
}
};
#endif // !defined(SETTINGS_INCLUDED)