Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
p6config.h
Go to the documentation of this file.
1 
18 #ifndef ICONFIG_H__
19 #define ICONFIG_H__ 1
20 
21 #include "p6i18n.h"
22 
23 namespace P6R {
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
30 const P6R::P6UINT32 MAX_ENUM_BUF = MAX_IDENTIFER_SIZE*16; // 64K
31 
38 typedef P6VOID (*CONFIG_NOTIFY_CHANGE)( P6R::P6INT32 eventCode, P6R::P6VOID* pContext );
39 
59 typedef enum
60 {
69 
70 
90 interface p6IEnumConfigWSections : public p6ICom
91 {
106  P6COMMETHOD next( P6UINT32 cElements, const P6WCHAR** parElements, P6UINT32* pcReturned ) = 0;
107 
116  P6COMMETHOD reset() = 0;
117 };
118 #define IF_p6IEnumConfigWSections {0xf6c2f961,0x605a,0x4e33,{0x93,0x8b,0x20,0x85,0xa9,0xcb,0x3c,0xed}}
119 
120 
127 typedef struct
128 {
129  const P6WCHAR* pName;
130  const P6WCHAR* pValue;
132 
133 
149 interface p6IEnumConfigWValues : public p6ICom
150 {
165  P6COMMETHOD next( P6UINT32 cElements, P6CONFIGWVALUE* parElements, P6UINT32* pcReturned ) = 0;
166 
175  P6COMMETHOD reset() = 0;
176 };
177 #define IF_p6IEnumConfigWValues {0x1faeacc1,0x1af2,0x4a3e,{0x80,0x47,0x5d,0x50,0xc0,0xe3,0x55,0xcf}}
178 
179 
192 interface p6IWConfigTokens : public p6ICom
193 {
219  P6COMMETHOD addToken( const P6WCHAR* pToken, const P6WCHAR* pValue ) = 0;
220 };
221 
222 // {A6824833-8289-4b70-8DFC-5C5F7028419C}
223 #define IF_p6IWConfigTokens {0xa6824833,0x8289,0x4b70,{0x8d,0xfc,0x5c,0x5f,0x70,0x28,0x41,0x9c}}
224 
225 
237 const P6CONFIGFLAGS P6CONFIG_NOFLAGS = 0x00000000;
238 const P6CONFIGFLAGS P6CONFIG_READONLY = 0x00000001;
239 
250 const P6OPENFLAGS P6OPEN_NOFLAGS = 0x00000000;
251 const P6OPENFLAGS P6OPEN_USENEW = 0x00000001;
252 const P6OPENFLAGS P6OPEN_USEOLD = 0x00000002;
253 
254 
273 interface p6IWConfig : public p6ICom
274 {
289  P6COMMETHOD initialize( P6CONFIGFLAGS flags, const P6CHAR* pLocale ) = 0;
290 
307  P6COMMETHOD openConfigFile( P6OPENFLAGS fFlags, const P6WCHAR* pPathName ) = 0;
308 
324  P6COMMETHOD createConfigFile( const P6WCHAR* pPathName, P6BOOL overWrite ) = 0;
325 
340  P6COMMETHOD closeConfigFile( P6BOOL withDefaults ) = 0;
341 
368  P6COMMETHOD flushConfigFile( const P6WCHAR* pAlternateName, P6BOOL withDefaults ) = 0;
369 
382 
409  P6COMMETHOD getConfigInt( const P6WCHAR* pSectionName, const P6WCHAR* pKeyName, P6INT32 defaultValue, P6INT32* pValue ) = 0;
410 
427  P6COMMETHOD getConfigUInt( const P6WCHAR* pSectionName, const P6WCHAR* pKeyName, P6UINT32 defaultValue, P6UINT32* pValue ) = 0;
428 
455  P6COMMETHOD getConfigDouble( const P6WCHAR* pSectionName, const P6WCHAR* pKeyName, P6FLOAT defaultValue, P6FLOAT* pValue ) = 0;
456 
492  P6COMMETHOD getConfigString( const P6WCHAR* pSectionName,
493  const P6WCHAR* pKeyName,
494  const P6WCHAR* defaultValue,
495  P6WCHAR* pBuffer,
496  P6UINT32 cBuffer,
497  P6UINT32* pWritten ) = 0;
498 
522  P6COMMETHOD getConfigBool( const P6WCHAR* pSectionName, const P6WCHAR* pKeyName, P6BOOL defaultValue, P6BOOL* pValue ) = 0;
523 
546  P6COMMETHOD getConfigSection( const P6WCHAR* pSectionName, P6WCHAR* pReturnBuf, P6UINT32 cBuffer, P6UINT32* pWritten ) = 0;
547 
565  P6COMMETHOD setConfigInt( const P6WCHAR* pSectionName, const P6WCHAR* pKeyName, P6INT32 value ) = 0;
566 
582  P6COMMETHOD setConfigUInt( const P6WCHAR* pSectionName, const P6WCHAR* pKeyName, P6UINT32 value ) = 0;
583 
601  P6COMMETHOD setConfigDouble( const P6WCHAR* pSectionName, const P6WCHAR* pKeyName, P6FLOAT value ) = 0;
602 
620  P6COMMETHOD setConfigString( const P6WCHAR* pSectionName, const P6WCHAR* pKeyName, const P6WCHAR* pValue ) = 0;
621 
622  P6COMMETHOD setConfigStringList( const P6WCHAR* pSectionName, const P6WCHAR* pKeyName, const P6WCHAR* pstrValue ) = 0;
623 
624 
642  P6COMMETHOD setConfigBool( const P6WCHAR* pSectionName, const P6WCHAR* pKeyName, P6BOOL value ) = 0;
643 
660  P6COMMETHOD deleteConfigItem( const P6WCHAR* pSectionName, const P6WCHAR* pKeyName ) = 0;
661 
674  P6COMMETHOD deleteConfigSection( const P6WCHAR* pSectionName ) = 0;
675 
689  P6COMMETHOD enableVersionStamp( P6BOOL enabled ) = 0;
690 
722  P6VOID* pContext ) = 0;
723 
740 
753 
766  P6COMMETHOD enumConfigValues( const P6WCHAR* pSectionName, p6IEnumConfigWValues** ppEnum ) = 0;
767 
784  P6COMMETHOD enumConfigList( const P6WCHAR* pSectionName, const P6WCHAR* pKeyName, p6IEnumConfigWValues** ppEnum ) = 0;
785 };
786 
787 // {9699FB6A-28EF-47f3-A659-1837A466F6A7}
788 #define IF_p6IWConfig {0x9699fb6a,0x28ef,0x47f3,{0xa6,0x59,0x18,0x37,0xa4,0x66,0xf6,0xa7}}
789 
790 // {104DEEBC-8510-4baa-A39E-4DDF8CDE58B2}
791 #define COMP_p6WConfig {0x104deebc,0x8510,0x4baa,{0xa3,0x9e,0x4d,0xdf,0x8c,0xde,0x58,0xb2}}
792 
793 #define GLOBAL_CONFIG_INTERFACE "P6R::p6IWConfig::ApplicationGlobalConfig\0"
794 
795 #ifdef __cplusplus
796 }
797 #endif
798 
799 } // namespace
800 
801 
802 #endif
803 
804 
Provides configuration file management with multi-language support.
Definition: p6config.h:273
virtual P6R::P6ERR enableVersionStamp(P6BOOL enabled)=0
The first section of a configuration file (the one without a section name) gets several P6R headers w...
P6UINT32 P6CONFIGFLAGS
P6CONFIGFLAGS.
Definition: p6config.h:236
virtual P6R::P6ERR next(P6UINT32 cElements, P6CONFIGWVALUE *parElements, P6UINT32 *pcReturned)=0
This method is used to iterate the currently defined name - value pairs in a section.
virtual P6R::P6ERR flushConfigFile(const P6WCHAR *pAlternateName, P6BOOL withDefaults)=0
Writes any outstanding updates to a configuration file.
To get a pointer to this object perform the following steps:
Definition: p6config.h:149
unsigned int P6UINT32
Definition: p6types.h:40
P6CONFIG_NOTIFY_CODES
Configuration Notify Codes.
Definition: p6config.h:59
To get a pointer to this object perform the following steps:
Definition: p6config.h:192
virtual P6R::P6ERR getConfigInt(const P6WCHAR *pSectionName, const P6WCHAR *pKeyName, P6INT32 defaultValue, P6INT32 *pValue)=0
If the section name does not exist then the unnamed section is used as a default. ...
bool P6BOOL
Boolean type.
Definition: p6types.h:101
virtual P6R::P6ERR setConfigDouble(const P6WCHAR *pSectionName, const P6WCHAR *pKeyName, P6FLOAT value)=0
If a section name does not exist, then that section is created and the new key-name=value pair is wri...
virtual P6R::P6ERR getConfigString(const P6WCHAR *pSectionName, const P6WCHAR *pKeyName, const P6WCHAR *defaultValue, P6WCHAR *pBuffer, P6UINT32 cBuffer, P6UINT32 *pWritten)=0
If the section name does not exist then the unnamed section is used as a default. ...
virtual P6R::P6ERR deleteConfigSection(const P6WCHAR *pSectionName)=0
Removes the entire section assoicated with pSectionName.
virtual P6R::P6ERR registerForNotify(P6CONFIG_NOTIFY_CODES regFor, CONFIG_NOTIFY_CHANGE pFn, P6VOID *pContext)=0
This function allows the caller to register to be notified of several different events that take plac...
virtual P6R::P6ERR deleteConfigItem(const P6WCHAR *pSectionName, const P6WCHAR *pKeyName)=0
Removes the key value pair assoicated with pSectionName and pKeyName.
virtual P6R::P6ERR unregisterForNotify(P6CONFIG_NOTIFY_CODES regFor, CONFIG_NOTIFY_CHANGE pFn)=0
This function removes a specific notification request made by a call to registerForNotify.
virtual P6R::P6ERR getConfigSection(const P6WCHAR *pSectionName, P6WCHAR *pReturnBuf, P6UINT32 cBuffer, P6UINT32 *pWritten)=0
If the section name does not exist then the unnamed section is used as a default. ...
virtual P6R::P6ERR setConfigInt(const P6WCHAR *pSectionName, const P6WCHAR *pKeyName, P6INT32 value)=0
If a section name does not exist, then that section is created and the new key-name=value pair is wri...
const P6R::P6UINT32 MAX_ENUM_BUF
Definition: p6config.h:30
To get a pointer to this object perform the following steps:
Definition: p6config.h:90
wchar_t P6WCHAR
Wide character type see p6i18n.h.
Definition: p6types.h:76
P6VOID(* CONFIG_NOTIFY_CHANGE)(P6R::P6INT32 eventCode, P6R::P6VOID *pContext)
Configuration Change Notification Callback.
Definition: p6config.h:38
int P6INT32
Definition: p6types.h:41
const P6R::P6UINT32 MAX_IDENTIFER_SIZE
Definition: p6config.h:29
The base interface all [p6]COM components must derive from and implement.
Definition: p6comdef.h:96
virtual P6R::P6ERR getConfigUInt(const P6WCHAR *pSectionName, const P6WCHAR *pKeyName, P6UINT32 defaultValue, P6UINT32 *pValue)=0
The same method as getConfigInt() except that unsigned numbers are used.
virtual P6R::P6ERR next(P6UINT32 cElements, const P6WCHAR **parElements, P6UINT32 *pcReturned)=0
This method is used to iterate the currently defined sections in a configuration file.
virtual P6R::P6ERR setConfigBool(const P6WCHAR *pSectionName, const P6WCHAR *pKeyName, P6BOOL value)=0
If a section name does not exist, then that section is created and the new key-name=value pair is wri...
const P6WCHAR * pName
Definition: p6config.h:129
virtual P6R::P6ERR enumConfigValues(const P6WCHAR *pSectionName, p6IEnumConfigWValues **ppEnum)=0
Given a section name, creates and returns an enumerator for the section's contents (see p6IEnumConfig...
const P6CONFIGFLAGS P6CONFIG_NOFLAGS
Definition: p6config.h:237
virtual P6R::P6ERR addToken(const P6WCHAR *pToken, const P6WCHAR *pValue)=0
Define what replacement strings shall be used to replace a token found in a "string" type configurati...
virtual P6R::P6ERR reset()=0
This method is used to re-start the enumerator at the beginning.
virtual P6R::P6ERR reloadConfigFile()=0
Discard all existing values and re-reads configuration file specified in the last openConfigFile call...
Under [section] name=value The name value pair is broken up so that no additional parsing is required...
Definition: p6config.h:127
virtual P6R::P6ERR getConfigDouble(const P6WCHAR *pSectionName, const P6WCHAR *pKeyName, P6FLOAT defaultValue, P6FLOAT *pValue)=0
If the section name does not exist then the unnamed section is used as a default. ...
Interface definition for all p6I18n and L10n features.
const P6CONFIGFLAGS P6CONFIG_READONLY
Definition: p6config.h:238
virtual P6R::P6ERR createConfigFile(const P6WCHAR *pPathName, P6BOOL overWrite)=0
After one of the setConfigXXX functions are called the state of the object is set to dirty so that on...
P6UINT32 P6OPENFLAGS
P6OPENFLAGS.
Definition: p6config.h:249
const P6OPENFLAGS P6OPEN_USEOLD
Definition: p6config.h:252
virtual P6R::P6ERR closeConfigFile(P6BOOL withDefaults)=0
Performs any remaining updates to the configuration file.
const P6OPENFLAGS P6OPEN_USENEW
Definition: p6config.h:251
#define P6COMMETHOD
Definition: p6types.h:872
virtual P6R::P6ERR reset()=0
This method is used to re-start the enumerator at the beginning.
virtual P6R::P6ERR setConfigString(const P6WCHAR *pSectionName, const P6WCHAR *pKeyName, const P6WCHAR *pValue)=0
If a section name does not exist, then that section is created and the new key-name=value pair is wri...
virtual P6R::P6ERR enumConfigSections(p6IEnumConfigWSections **ppEnum)=0
Creates and returns an enumertor for the configuration file's sections (see p6IEnumConfigWSections).
virtual P6R::P6ERR setConfigUInt(const P6WCHAR *pSectionName, const P6WCHAR *pKeyName, P6UINT32 value)=0
The same method as setConfigInt() except that unsigned numbers are used.
double P6FLOAT
Definition: p6types.h:63
virtual P6R::P6ERR openConfigFile(P6OPENFLAGS fFlags, const P6WCHAR *pPathName)=0
Loads the contents of a window's style ".ini" file into the object.
virtual P6R::P6ERR setConfigStringList(const P6WCHAR *pSectionName, const P6WCHAR *pKeyName, const P6WCHAR *pstrValue)=0
void P6VOID
Definition: p6types.h:75
virtual P6R::P6ERR getConfigBool(const P6WCHAR *pSectionName, const P6WCHAR *pKeyName, P6BOOL defaultValue, P6BOOL *pValue)=0
If the section name does not exist then the unnamed section is used as a default. ...
virtual P6R::P6ERR enumConfigList(const P6WCHAR *pSectionName, const P6WCHAR *pKeyName, p6IEnumConfigWValues **ppEnum)=0
Given a section and key name create and return an enumerator for the multi-item value (i...
const P6WCHAR * pValue
Definition: p6config.h:130
const P6OPENFLAGS P6OPEN_NOFLAGS
Definition: p6config.h:250
virtual P6R::P6ERR initialize(P6CONFIGFLAGS flags, const P6CHAR *pLocale)=0
Sets up the object to run properly.
char P6CHAR
Narrow character type.
Definition: p6types.h:71