OWLNext 7.0
Borland's Object Windows Library for the modern age
|
An instance of TProfile encapsulates a setting within a system file, often referred to as a profile or initialization file. More...
#include <owl/profile.h>
Public Member Functions | |
TProfile (LPCTSTR section, LPCTSTR filename=0) | |
Constructs a TProfile object for the indicated section within the profile file specified by filename. | |
TProfile (const tstring §ion, const tstring &filename=tstring()) | |
String-aware overload. | |
~TProfile () | |
Destroys the TProfile object. | |
int | GetInt (LPCTSTR key, int defaultInt=0) |
Looks up and returns the integer value associated with the given string, key. | |
int | GetInt (const tstring &key, int defaultInt=0) |
bool | GetString (LPCTSTR key, TCHAR *buff, unsigned buffSize, LPCTSTR defaultString=0) |
Looks up and returns the string value associated with the given key string. | |
bool | GetString (const tstring &key, TCHAR *buff, unsigned buffSize, const tstring &defaultString=tstring()) |
tstring | GetString (const tstring &key, const tstring &defaultString=tstring()) |
bool | WriteInt (LPCTSTR key, int value) |
Looks up the key and replaces its value with the integer value passed (int). | |
bool | WriteInt (const tstring &key, int value) |
bool | WriteString (LPCTSTR key, LPCTSTR str) |
Looks up the key and replaces its value with the string value passed (str). | |
bool | WriteString (const tstring &key, LPCTSTR str) |
bool | WriteString (const tstring &key, const tstring &str) |
void | Flush () |
Makes sure that all written profile values are flushed to the actual file. | |
Protected Member Functions | |
void | Init (LPCTSTR section, LPCTSTR filename) |
Protected Attributes | |
TCHAR * | Section |
Name of the section to use. | |
TCHAR * | FileName |
File name of the .INI file. | |
An instance of TProfile encapsulates a setting within a system file, often referred to as a profile or initialization file.
Examples of this type of file include the Windows initialization files SYSTEM.INI and WIN.INI. Within the system file itself, the individual settings are grouped within sections. For example,
For a setting, the value to the left of the equal sign is called the key. The value to the right of the equal sign, the value, can be either an integer or a string data type.
Constructs a TProfile object for the indicated section within the profile file specified by filename.
If the file name is not provided, the file defaults to the system profile file; for example, WIN.INI under Windows .
Definition at line 22 of file profile.cpp.
References Init().
owl::TProfile::~TProfile | ( | ) |
void owl::TProfile::Flush | ( | ) |
Makes sure that all written profile values are flushed to the actual file.
Definition at line 164 of file profile.cpp.
References FileName.
Looks up and returns the integer value associated with the given string, key.
If key is not found, the default value, defaultInt, is returned.
Definition at line 86 of file profile.cpp.
Definition at line 109 of file profile.cpp.
bool owl::TProfile::GetString | ( | LPCTSTR | key, |
TCHAR * | buff, | ||
unsigned | buffSize, | ||
LPCTSTR | defaultString = 0 ) |
Looks up and returns the string value associated with the given key string.
The string value is copied into buff, up to buffSize bytes. If the key is not found, defaultString provides the default value. If a 0 key is passed, all section values are returned in buff.
Definition at line 100 of file profile.cpp.
Definition at line 37 of file profile.cpp.
References A2W, FileName, Section, strnewdup(), USES_CONVERSION, and W2A.
Looks up the key and replaces its value with the integer value passed (int).
If the key is not found, WriteInt makes a new entry. Returns true if successful.
Definition at line 137 of file profile.cpp.
References _itot, and WriteString().
Looks up the key and replaces its value with the string value passed (str).
If the key is not found, WriteString makes a new entry. Returns true if successful.
Definition at line 153 of file profile.cpp.
|
protected |
|
protected |