14#if !defined(OWL_CONFIGFL_H)
18#if defined(BI_HAS_PRAGMA_ONCE)
66 virtual bool SectionExists(LPCTSTR section)
const;
70 virtual bool EraseEntry(LPCTSTR section, LPCTSTR entry) = 0;
73 virtual uint ReadString(LPCTSTR section, LPCTSTR entry, LPTSTR buffer,
uint bufSize, LPCTSTR defstr= 0)
const = 0;
74 virtual bool WriteString(LPCTSTR section, LPCTSTR entry, LPCTSTR value) = 0;
76 virtual bool ReadData(LPCTSTR section, LPCTSTR entry,
void* buffer,
uint size)
const;
77 virtual bool WriteData(LPCTSTR section, LPCTSTR entry,
void* buffer,
uint size);
79 virtual int ReadInteger(LPCTSTR section, LPCTSTR entry,
int defint=0)
const;
80 virtual bool WriteInteger(LPCTSTR section, LPCTSTR entry,
int value);
90 {
return ReadString(section, entry, buffer, defstr.c_str());}
99 double ReadDouble(LPCTSTR section, LPCTSTR entry,
double defval=0.0)
const;
100 bool WriteDouble(LPCTSTR section, LPCTSTR entry,
double value);
104 bool ReadBool(LPCTSTR section, LPCTSTR entry,
bool defval=
false)
const;
105 bool WriteBool(LPCTSTR section, LPCTSTR entry,
bool val);
109 bool ReadDate(LPCTSTR section, LPCTSTR entry,
TDate& value)
const;
119 bool ReadTime(LPCTSTR section, LPCTSTR entry,
TTime& val)
const;
124 bool ReadFont(LPCTSTR section, LPCTSTR entry, LOGFONT& font)
const;
125 bool WriteFont(LPCTSTR section, LPCTSTR entry,
const LOGFONT& font);
134 bool ReadRect(LPCTSTR section, LPCTSTR entry,
TRect& val)
const;
144 bool ReadSize(LPCTSTR section, LPCTSTR entry,
TSize& sz)
const;
145 bool WriteSize(LPCTSTR section, LPCTSTR entry,
const TSize& size);
172 bool EraseEntry(LPCTSTR entry);
174 uint ReadString(LPCTSTR entry, LPTSTR buffer,
uint bufSize, LPCTSTR defstr=0)
const;
175 bool WriteString(LPCTSTR entry, LPCTSTR value);
178 {
return ReadString(entry, buffer, defstr.c_str());}
181 bool ReadData(LPCTSTR entry,
void* buffer,
uint size)
const;
182 bool WriteData(LPCTSTR entry,
void* buffer,
uint size);
183 bool ReadData(
const tstring& entry,
void* buffer,
uint size)
const;
184 bool WriteData(
const tstring& entry,
void* buffer,
uint size);
186 int ReadInteger(LPCTSTR entry,
int defint=0)
const ;
187 bool WriteInteger(LPCTSTR entry,
int value);
188 int ReadInteger(
const tstring& entry,
int defint=0)
const ;
189 bool WriteInteger(
const tstring& entry,
int value);
191 double ReadDouble(LPCTSTR entry,
double defval)
const;
192 bool WriteDouble(LPCTSTR entry,
double defval);
193 double ReadDouble(
const tstring& entry,
double defval)
const;
194 bool WriteDouble(
const tstring& entry,
double defval);
196 bool ReadBool(LPCTSTR entry,
bool defval)
const;
197 bool WriteBool(LPCTSTR entry,
bool val);
198 bool ReadBool(
const tstring& entry,
bool defval)
const;
199 bool WriteBool(
const tstring& entry,
bool val);
201 bool ReadDate(LPCTSTR entry,
TDate& value)
const;
202 bool WriteDate(LPCTSTR entry,
const TDate& val);
203 bool ReadDate(
const tstring& entry,
TDate& value)
const;
206 bool ReadSystemTime(LPCTSTR entry,
TSystemTime& val)
const;
207 bool WriteSystemTime(LPCTSTR entry,
const TSystemTime& val);
211 bool ReadTime(LPCTSTR entry,
TTime& val)
const;
212 bool WriteTime(LPCTSTR entry,
TTime& val);
216 bool ReadFont(LPCTSTR entry, LOGFONT& font)
const;
217 bool WriteFont(LPCTSTR entry,
const LOGFONT& font);
218 bool ReadFont(
const tstring& entry, LOGFONT& font)
const;
219 bool WriteFont(
const tstring& entry,
const LOGFONT& font);
221 bool ReadColor(LPCTSTR entry,
TColor& color)
const;
222 bool WriteColor(LPCTSTR entry,
const TColor& clr);
226 bool ReadRect(LPCTSTR entry,
TRect& val)
const;
227 bool WriteRect(LPCTSTR entry,
const TRect& rc);
231 bool ReadPoint(LPCTSTR entry,
TPoint& val)
const;
232 bool WritePoint(LPCTSTR entry,
const TPoint& point);
236 bool ReadSize(LPCTSTR entry,
TSize& sz)
const;
237 bool WriteSize(LPCTSTR entry,
const TSize& size);
239 bool WriteSize(
const tstring& entry,
const TSize& size);
257 virtual uint ReadSection(LPCTSTR section, LPTSTR buffer,
uint bufSize)
const;
258 virtual uint ReadSections(LPTSTR buffer,
uint bufSize)
const;
259 virtual bool EraseSection(LPCTSTR section);
260 virtual bool EraseEntry(LPCTSTR section, LPCTSTR entry);
261 virtual void UpdateFile();
263 virtual uint ReadString(LPCTSTR section, LPCTSTR entry, LPTSTR buffer,
uint bufSize, LPCTSTR defstr=0)
const;
264 virtual bool WriteString(LPCTSTR section, LPCTSTR entry, LPCTSTR value);
265 virtual bool ReadData(LPCTSTR section, LPCTSTR entry,
void* buffer,
uint size)
const;
266 virtual bool WriteData(LPCTSTR section, LPCTSTR entry,
void* buffer,
uint size);
288class TMemConfigFileSections;
291 TMemConfigFileSections* Sections;
293 int AddSection(
const tstring& section);
303 virtual bool EraseEntry(LPCTSTR section, LPCTSTR entry);
306 virtual uint ReadString(LPCTSTR section, LPCTSTR entry, LPTSTR buffer,
uint bufSize, LPCTSTR defstr=0)
const;
307 virtual bool WriteString(LPCTSTR section, LPCTSTR entry, LPCTSTR value);
340 virtual bool EraseEntry(LPCTSTR section, LPCTSTR entry);
343 virtual int ReadInteger(LPCTSTR section, LPCTSTR entry,
int defint=0)
const;
344 virtual bool WriteInteger(LPCTSTR section, LPCTSTR entry,
int value);
345 virtual uint ReadString(LPCTSTR section, LPCTSTR entry, LPTSTR buffer,
uint bufSize, LPCTSTR defstr=0)
const;
346 virtual bool WriteString(LPCTSTR section, LPCTSTR entry, LPCTSTR value);
347 virtual bool ReadData(LPCTSTR section, LPCTSTR entry,
void* buffer,
uint size)
const;
348 virtual bool WriteData(LPCTSTR section, LPCTSTR entry,
void* buffer,
uint size);
391 return EraseEntry(section.c_str(), entry.c_str());
397 void* buffer,
uint size)
const
399 return ReadData(section.c_str(), entry.c_str(),buffer,size);
404 void* buffer,
uint size)
406 return WriteData(section.c_str(), entry.c_str(), buffer, size);
414 return ReadInteger(section.c_str(), entry.c_str(), defint);
421 return WriteInteger(section.c_str(), entry.c_str(), value);
428 return ReadDouble(section.c_str(), entry.c_str(), defval);
435 return WriteDouble(section.c_str(), entry.c_str(), value);
442 return ReadBool(section.c_str(), entry.c_str(), defval);
449 return WriteBool(section.c_str(), entry.c_str(), val);
456 return ReadDate(section.c_str(), entry.c_str(), value);
463 return WriteDate(section.c_str(), entry.c_str(), val);
483 return ReadTime(section.c_str(), entry.c_str(), val);
489 return WriteTime(section.c_str(), entry.c_str(), val);
496 return ReadFont(section.c_str(), entry.c_str(), font);
503 return WriteFont(section.c_str(), entry.c_str(), font);
510 return ReadColor(section.c_str(), entry.c_str(), color);
517 return WriteColor(section.c_str(), entry.c_str(), color);
524 return ReadRect(section.c_str(), entry.c_str(), val);
531 return WriteRect(section.c_str(), entry.c_str(), rc);
538 return ReadPoint(section.c_str(), entry.c_str(), val);
545 return WritePoint(section.c_str(), entry.c_str(), point);
552 return ReadSize(section.c_str(), entry.c_str(), sz);
559 return WriteSize(section.c_str(), entry.c_str(), size);
566 return WriteString(section.c_str(), entry.c_str(), value.c_str());
583 LPCTSTR defstr)
const
600 LPCTSTR defstr)
const
Class wrapper for management of color values.
Save/Load configuration parameters Base abstract class.
TConfigFile(const tstring &name)
Constructs instance and sets FileName to name.
virtual bool WriteData(LPCTSTR section, LPCTSTR entry, void *buffer, uint size)
This method writes binary data.
static int DefaultPrecision
bool ReadTime(LPCTSTR section, LPCTSTR entry, TTime &val) const
virtual bool EraseSection(LPCTSTR section)=0
bool ReadColor(LPCTSTR section, LPCTSTR entry, TColor &color) const
This method reads an RGB color.
double ReadDouble(LPCTSTR section, LPCTSTR entry, double defval=0.0) const
virtual bool WriteInteger(LPCTSTR section, LPCTSTR entry, int value)
This method writes an integer. We format it as a string.
bool WriteRect(LPCTSTR section, LPCTSTR entry, const TRect &rc)
This method writes a TRect.
static int GetPrecision()
bool ReadDate(LPCTSTR section, LPCTSTR entry, TDate &value) const
virtual bool SectionExists(LPCTSTR section) const
bool WriteFont(LPCTSTR section, LPCTSTR entry, const LOGFONT &font)
This method writes a font description in the following format:
virtual ~TConfigFile()
Destroys the instance.
bool WriteColor(LPCTSTR section, LPCTSTR entry, const TColor &clr)
This method writes an RGB color.
bool ReadPoint(LPCTSTR section, LPCTSTR entry, TPoint &val) const
This method reads a TPoint.
bool WriteDouble(LPCTSTR section, LPCTSTR entry, double value)
This method writes an integer.
const tstring & GetFileName() const
virtual uint ReadSections(TCHAR *sections, uint bufSize) const =0
virtual bool EraseEntry(LPCTSTR section, LPCTSTR entry)=0
bool WriteTime(LPCTSTR section, LPCTSTR entry, TTime &val)
bool WriteDate(LPCTSTR section, LPCTSTR entry, const TDate &val)
bool WriteSystemTime(LPCTSTR section, LPCTSTR entry, const TSystemTime &val)
static void SetPrecision(int newprec=-1)
bool ReadSize(LPCTSTR section, LPCTSTR entry, TSize &sz) const
This method reads a TSize.
virtual void UpdateFile()=0
bool ReadBool(LPCTSTR section, LPCTSTR entry, bool defval=false) const
This method reads a boolean value.
bool ReadRect(LPCTSTR section, LPCTSTR entry, TRect &val) const
This method reads a TRect.
bool WritePoint(LPCTSTR section, LPCTSTR entry, const TPoint &point)
This method writes a TPoint.
virtual uint ReadSection(LPCTSTR section, TCHAR *buffer, uint bufSize) const =0
virtual int ReadInteger(LPCTSTR section, LPCTSTR entry, int defint=0) const
This method reads an integer.
static tstring BoolToString(bool val)
This static method returns yes or no given a boolean value.
bool WriteSize(LPCTSTR section, LPCTSTR entry, const TSize &size)
This method writes a TSize.
bool ReadFont(LPCTSTR section, LPCTSTR entry, LOGFONT &font) const
This method will take a profile string of the form:
virtual bool ReadData(LPCTSTR section, LPCTSTR entry, void *buffer, uint size) const
This method reads binary data.
bool WriteBool(LPCTSTR section, LPCTSTR entry, bool val)
This method writes a bool.
uint ReadString(const tstring §ion, const tstring &entry, tstring &buffer, const tstring &defstr) const
bool ReadSystemTime(LPCTSTR section, LPCTSTR entry, TSystemTime &val) const
static bool StringToBool(LPCTSTR str, bool *val)
This static method converts a string to a bool, accepting most common boolean keywords: yes,...
virtual bool WriteString(LPCTSTR section, LPCTSTR entry, LPCTSTR value)=0
virtual uint ReadString(LPCTSTR section, LPCTSTR entry, TCHAR *buffer, uint bufSize, LPCTSTR defstr=0) const =0
bool WriteRect(LPCTSTR entry, const TRect &rc)
bool WriteSize(LPCTSTR entry, const TSize &size)
bool ReadData(LPCTSTR entry, void *buffer, uint size) const
int ReadInteger(LPCTSTR entry, int defint=0) const
TConfigFileSection(TConfigFile &file, const tstring §ion)
bool ReadFont(LPCTSTR entry, LOGFONT &font) const
double ReadDouble(LPCTSTR entry, double defval) const
bool WriteString(LPCTSTR entry, LPCTSTR value)
bool ReadTime(LPCTSTR entry, TTime &val) const
bool ReadDate(LPCTSTR entry, TDate &value) const
bool WriteTime(LPCTSTR entry, TTime &val)
bool ReadRect(LPCTSTR entry, TRect &val) const
bool WriteInteger(LPCTSTR entry, int value)
uint ReadString(LPCTSTR entry, TCHAR *buffer, uint bufSize, LPCTSTR defstr=0) const
bool WriteData(LPCTSTR entry, void *buffer, uint size)
bool WriteBool(LPCTSTR entry, bool val)
bool EraseEntry(LPCTSTR entry)
const tstring & GetSection()
bool WriteFont(LPCTSTR entry, const LOGFONT &font)
uint ReadString(const tstring &entry, tstring &buffer, const tstring &defstr) const
bool WritePoint(LPCTSTR entry, const TPoint &point)
bool ReadColor(LPCTSTR entry, TColor &color) const
bool ReadPoint(LPCTSTR entry, TPoint &val) const
bool WriteSystemTime(LPCTSTR entry, const TSystemTime &val)
bool WriteDate(LPCTSTR entry, const TDate &val)
bool WriteDouble(LPCTSTR entry, double defval)
bool WriteColor(LPCTSTR entry, const TColor &clr)
bool ReadSystemTime(LPCTSTR entry, TSystemTime &val) const
bool ReadSize(LPCTSTR entry, TSize &sz) const
bool ReadBool(LPCTSTR entry, bool defval) const
The TDate class represents a date.
TFont derived from TGdiObject provides constructors for creating font objects from explicit informati...
virtual bool ReadData(LPCTSTR section, LPCTSTR entry, void *buffer, uint size) const
This method reads binary data.
virtual bool WriteString(LPCTSTR section, LPCTSTR entry, LPCTSTR value)
This method is the low-level method for writing strings.
virtual ~TIniConfigFile()
virtual bool EraseEntry(LPCTSTR section, LPCTSTR entry)
This method deletes the specified entry.
TIniConfigFile(const tstring &name)
virtual uint ReadString(LPCTSTR section, LPCTSTR entry, TCHAR *buffer, uint bufSize, LPCTSTR defstr=0) const
This method is the base method for reading strings.
virtual bool WriteData(LPCTSTR section, LPCTSTR entry, void *buffer, uint size)
This method writes binary data.
virtual bool EraseSection(LPCTSTR section)
This method deletes the specified section.
virtual uint ReadString(LPCTSTR section, LPCTSTR entry, TCHAR *buffer, uint bufSize, LPCTSTR defstr=0) const
Looks up the value of the given entry of the given section, and if found, copies it to the given buff...
virtual uint ReadSections(TCHAR *buffer, uint bufSize) const
Copies all section names to the specified buffer.
virtual uint ReadSection(LPCTSTR section, TCHAR *buffer, uint bufSize) const
Copies all value names of the given section to the specified buffer.
virtual bool EraseSection(LPCTSTR section)
TMemConfigFile(const tstring &name)
virtual void UpdateFile()
virtual bool WriteString(LPCTSTR section, LPCTSTR entry, LPCTSTR value)
virtual void LoadValues(const TConfigFile &file)
virtual bool EraseEntry(LPCTSTR section, LPCTSTR entry)
TPoint is a support class, derived from tagPOINT.
TRect is a mathematical class derived from tagRect.
virtual bool EraseSection(LPCTSTR section)
virtual bool EraseEntry(LPCTSTR section, LPCTSTR entry)
virtual uint ReadSections(TCHAR *buffer, uint bufSize) const
Copies all section names to the specified buffer.
TRegConfigFile(const tstring &name, HKEY hRoot=HKEY_CURRENT_USER)
This source file implements TRegConfigFile.
virtual void UpdateFile()
virtual bool WriteData(LPCTSTR section, LPCTSTR entry, void *buffer, uint size)
This method writes binary data.
virtual bool SectionExists(LPCTSTR section) const
virtual int ReadInteger(LPCTSTR section, LPCTSTR entry, int defint=0) const
virtual bool WriteString(LPCTSTR section, LPCTSTR entry, LPCTSTR value)
virtual uint ReadSection(LPCTSTR section, TCHAR *buffer, uint bufSize) const
Copies all value names of the given section to the specified buffer.
virtual bool WriteInteger(LPCTSTR section, LPCTSTR entry, int value)
virtual uint ReadString(LPCTSTR section, LPCTSTR entry, TCHAR *buffer, uint bufSize, LPCTSTR defstr=0) const
Looks up the value of the given entry of the given section, and if found, copies it to the given buff...
virtual bool ReadData(LPCTSTR section, LPCTSTR entry, void *buffer, uint size) const
This method reads binary data.
Encapsulates a registration key in the Windows Registry.
The tagSIZE struct is defined as.
TSystemTime is a class derived from the structure SYSTEMTIME.
The TTime class encapsulates time functions and characteristics.
Object Windows Library (OWLNext Core).
General definitions used by all ObjectWindows programs.
General Registry access & registration implementation TRegKey, TRegValue, TRegKeyIterator,...