#include <AnyConfig.h>
Inheritance diagram for AnyConfig::AcConfiguration::
Public Methods | |
AcConfiguration () | |
Constructor method. More... | |
virtual | ~AcConfiguration () |
Destructor method. More... | |
bool | copyFrom (AcConfiguration *pConfig) |
Copy another configuration to this one. More... | |
virtual bool | copyTo (AcWriteableConfig *pWriteableConfig) |
Copy this configuration to another configuration. More... | |
virtual AcConfiguration* | createFromSection (const char *section) |
Extract a sub-configuration containing only the indicated section. More... | |
virtual void | display ()=0 |
virtual bool | getBool (const char *pKey, const bool defaultValue=false) |
Returns a boolean value from the configuration. More... | |
virtual long | getLong (const char *pKey, const long defaultValue=-1) |
Get a 32 bit value from the configuration. More... | |
virtual double | getNumber (const char *pKey, const double defaultValue=-1.0) |
Returns a floating point (real) number from the configuration. More... | |
virtual bool | getSectionStr (const char *pSection, const char *pKey, CString &rValue) |
Like getStr() but can fetch keys from another section than the current one. More... | |
virtual bool | getStr (const char *pKey, CString &rValue)=0 |
virtual bool | initialize (AcConfiguration &parentConfig) |
Initialize the configuration using another, probably more primitive, parent configuration. More... | |
virtual bool | initRequired ()=0 |
virtual bool | keyExists (const char *pKey)=0 |
const CString& | GetCurrentSection () const |
Returns the value of member '_currentSection'. More... | |
void | SetCurrentSection (const CString &rCurrentSection) |
Set the value of member '_currentSection' to 'rCurrentSection'. More... | |
int | IsBufFileConfig () const |
Method that returns a non zero value if it is actually a AcBufFileConfig Object. More... | |
int | IsCorbaConfig () const |
Method that returns a non zero value if it is actually a AcCorbaConfig Object. More... | |
int | IsEnvConfig () const |
Method that returns a non zero value if it is actually a AcEnvConfig Object. More... | |
int | IsFileConfig () const |
Method that returns a non zero value if it is actually a AcFileConfig Object. More... | |
int | IsMemConfig () const |
Method that returns a non zero value if it is actually a AcMemConfig Object. More... | |
int | IsMySQLConfig () const |
Method that returns a non zero value if it is actually a AcMySQLConfig Object. More... | |
int | IsRegConfig () const |
Method that returns a non zero value if it is actually a AcRegConfig Object. More... | |
int | IsWriteableConfig () const |
Method that returns a non zero value if it is actually a AcWriteableConfig Object. More... | |
Static Public Methods | |
bool | cfg2string (CString &rString, AcConfiguration *pConfiguration) |
Convert a configuration into a stringified representation. More... | |
AcConfiguration* | findAnyConfig (int argn, char *argv[]) |
Look for configuration in all the right places. More... | |
AcConfiguration* | loadFrom (const char *source) |
Load a configuration from the specified Configuration source.. More... | |
bool | string2bool (const char *string) |
Interpret a string as a boolean. More... | |
AcConfiguration* | string2cfg (const char *string) |
Return a configuration from a stringified representation. More... | |
Static Protected Methods | |
void | decode (CString &rSt) |
Decode an encoded representation. More... | |
void | encode (CString &rSt) |
Make an encoded representation. More... | |
Protected Attributes | |
CString | _currentSection |
Private Methods | |
void | ConstructorInclude () |
Method which must be called first in a constructor. More... | |
void | DestructorInclude () |
Method which must be called first in a destructor. More... | |
Static Private Methods | |
void | findInHomeDir (AcWriteableConfig &parent, AcConfiguration &rEnv) |
Try to find a configuration file in some kind of 'home' directory. More... |
|
Constructor method.
|
|
Destructor method.
|
|
Method which must be called first in a constructor.
Reimplemented in AnyConfig::AcWriteableConfig, AnyConfig::AcMemConfig, AnyConfig::AcBufFileConfig, AnyConfig::AcEnvConfig, AnyConfig::AcFileConfig, AnyConfig::AcMySQLConfig, AnyConfig::AcRegConfig, and AnyConfig::AcCorbaConfig. |
|
Method which must be called first in a destructor.
Reimplemented in AnyConfig::AcWriteableConfig, AnyConfig::AcMemConfig, AnyConfig::AcBufFileConfig, AnyConfig::AcEnvConfig, AnyConfig::AcFileConfig, AnyConfig::AcMySQLConfig, AnyConfig::AcRegConfig, and AnyConfig::AcCorbaConfig. |
|
Returns the value of member '_currentSection'.
|
|
Method that returns a non zero value if it is actually a AcBufFileConfig Object.
|
|
Method that returns a non zero value if it is actually a AcCorbaConfig Object.
|
|
Method that returns a non zero value if it is actually a AcEnvConfig Object.
|
|
Method that returns a non zero value if it is actually a AcFileConfig Object.
|
|
Method that returns a non zero value if it is actually a AcMemConfig Object.
|
|
Method that returns a non zero value if it is actually a AcMySQLConfig Object.
|
|
Method that returns a non zero value if it is actually a AcRegConfig Object.
|
|
Method that returns a non zero value if it is actually a AcWriteableConfig Object.
|
|
Set the value of member '_currentSection' to 'rCurrentSection'.
|
|
Convert a configuration into a stringified representation.
|
|
Copy another configuration to this one. Just calls the other configuration's copyTo method to this. This must therefore be an AcWriteableConfig to succeed. Likewise, the pointed-to configuration must support copying.
|
|
Copy this configuration to another configuration.
This method is specifically handy when the source configuration comes from a text file and the destination configuration is AcMemConfig, which offers much more functionality. Along the same lines, this method can be used to save an AcMemConfig in a file. If the target configuration already has filled-in items, the result of this operation is undefined. Some derived classes may end up containing a merged result of the old and the new values (AcMemConfig, AcEnvConfig), other may only contain the copied values (like AcFileConfig).
Reimplemented in AnyConfig::AcMemConfig, AnyConfig::AcFileConfig, AnyConfig::AcMySQLConfig, AnyConfig::AcRegConfig, and AnyConfig::AcCorbaConfig. |
|
Extract a sub-configuration containing only the indicated section.
If your implementation returns a specialized sub-class for this, make sure it is either not an AcWriteableConfig implementation or if it is that writing to it does not alter the original section's information. Probably your best solution is to return an AcMemConfig with a copy of the section, like the original classes do. Reimplemented in AnyConfig::AcMemConfig, and AnyConfig::AcMySQLConfig. |
|
Decode an encoded representation.
|
|
Make an encoded representation.
|
|
Look for configuration in all the right places.
The passed parameters are not altered in any way. If there is no such command line option, findAnyConfig() will look in the program's environment for a key "ANYCFG". If found, it is assumed to contain a stringified configuration as above. If there is no such environment entry, we look for a file-based configuration. See findInHomeDir(). If any of the above attempts yielded a parent configuration that contains a key CFGFILENAME in its default section, that file will be loaded as the resulting configuration of this method. If there is no CFGFILENAME key or if loading the file it points to failed, the method attempts to connect to a MySQL database server, if MySQLConfig support is linking in. It will do so using USERNAME, PASSWORD, etc. from the configuration obtained so far. If a MySQL server can be contacted, it will be used to load the configuration to return. If all else failed but we had an initial bootstrap configuration, that will be returned. Otherwise, the method returns NULL to indicate a total failure.
|
|
Try to find a configuration file in some kind of 'home' directory.
This function will try to load the parent configuration from the following paths, in order and if the environment variables ($envvar) are set.
The file is determined to exist and be accessible if the current user can succesfully do a regular fopen (pathname, "rt") on it.
|
|
Returns a boolean value from the configuration.
|
|
Get a 32 bit value from the configuration.
|
|
Returns a floating point (real) number from the configuration.
|
|
Like getStr() but can fetch keys from another section than the current one. The default implementation just pushes _currentSection on stack, replaces it with the supplied section and calls the regular getStr() function.
Reimplemented in AnyConfig::AcMemConfig, AnyConfig::AcEnvConfig, AnyConfig::AcMySQLConfig, and AnyConfig::AcRegConfig. |
|
Initialize the configuration using another, probably more primitive, parent configuration. The default implementation of this method just returns true.
Reimplemented in AnyConfig::AcBufFileConfig, AnyConfig::AcFileConfig, AnyConfig::AcMySQLConfig, AnyConfig::AcRegConfig, and AnyConfig::AcCorbaConfig. |
|
Load a configuration from the specified Configuration source..
Builds an AcMemConfig using the information supplied, instantiates the specified class and invokes its initialize() member.
|
|
Interpret a string as a boolean.
|
|
Return a configuration from a stringified representation.
|