FBConfigFile Class Reference


Detailed Description

Interface to the application config files.

This class allows client code to generate, modify and query configuration files. Config files will be automatically created when needed. They will be located in the /bin/config folder or an explicitly specified folder depending on the constructor used.

Examples
ComplexTools/ActionScriptMgr.py, ComplexTools/ActionScriptMgr.py, ComplexTools/KeyboardMapper.py, ComplexTools/ShotTrackSetupTool.py, BasicOperations/FBConfigFile.py

List of all members.

Public Member Functions

 __init__ (str pConfigFileName, bool pVirtualMode=False, bool pClearFile=False)
 Constructor.
 __init__ (str pConfigFileName, str pConfigFilePath, bool pVirtualMode=False, bool pClearFile=False)
 Constructor.
 __del__ ()
 Destructor.
bool Set (str pSectionName, str pItemName, str pValue, str pComment=0)
 Set an item's value.
str Get (str pSectionName, str pItemName, str pDefaultValue=0)
 Get an item's value.
bool GetOrSet (str pSectionName, str pItemName, str pValue, str pComment=0)
 Get a value from the config file and set it if it was not found.
 ClearFile ()
 Remove all content from the config file.

Member Function Documentation

__init__ ( str  pConfigFileName,
bool  pVirtualMode = False,
bool  pClearFile = False 
)

Constructor.

This will open the desired config file from the [APPLICATION]/bin/config folder. The file will be created if it does not exists. By prefixing the character '@' to the file name, this will automatically prepend the current machine name to the config file, the way it is done for the other config files of the application.

Parameters:
pConfigFileNameName the config file to use.
pVirtualModeEnable this to limit disk access, file will only be read at construction and written at destruction.
pClearFileRemove all existing content from the config file.
Examples
ComplexTools/ActionScriptMgr.py, ComplexTools/ActionScriptMgr.py, ComplexTools/KeyboardMapper.py, ComplexTools/ShotTrackSetupTool.py, BasicOperations/FBConfigFile.py
__init__ ( str  pConfigFileName,
str  pConfigFilePath,
bool  pVirtualMode = False,
bool  pClearFile = False 
)

Constructor.

This will open the desired config file in the designed folder. The file will be created if it does not exists. By prefixing the character '@' to the file name, this will automatically prepend the current machine name to the config file, the way it is done for the other config files of the application.

Parameters:
pConfigFileNameName the config file to use.
pConfigFilePathLocation where the file should reside. Missing directories will not be created.
pVirtualModeEnable this to limit disk access, file will only be read at construction and written at destruction.
pClearFileRemove all existing content from the config file.
Examples
ComplexTools/ActionScriptMgr.py, ComplexTools/ActionScriptMgr.py, ComplexTools/KeyboardMapper.py, ComplexTools/ShotTrackSetupTool.py, BasicOperations/FBConfigFile.py
__del__ ( )
bool Set ( str  pSectionName,
str  pItemName,
str  pValue,
str  pComment = 0 
)

Set an item's value.

Assign a value to an item in the config file. If the item does not exist, it will be created.

Parameters:
pSectionNameName of the section.
pItemNameName of the item.
pValueValue assigned to the item.
pCommentOptional parameter that can be used to add a comment.
Returns:
true if the item was written to the config file, false otherwise.
str Get ( str  pSectionName,
str  pItemName,
str  pDefaultValue = 0 
)

Get an item's value.

Get an item's value by looking inside a specific section of the config file.

Parameters:
pSectionNameName of the section.
pItemNameName of the item.
pDefaultValueDefault value that will be returned if the item is not found.
Returns:
The value assigned to the item in the specified section of the config file, or the default value if not found.
bool GetOrSet ( str  pSectionName,
str  pItemName,
str  pValue,
str  pComment = 0 
)

Get a value from the config file and set it if it was not found.

Parameters:
pSectionNameName of the section.
pItemNameName of the item.
pValueReference the the string that will contain the value of the item. If the item is not found in the file, it will be added with the initial value in this string.
pCommentOptional parameter that can be used to add a comment.
Returns:
true if the value was found or added, or false if the item was not found and could not be added to the file.
ClearFile ( )

Remove all content from the config file.


FBConfigFile FBConfigFile FBConfigFile FBConfigFile FBConfigFile FBConfigFile FBConfigFile FBConfigFile FBConfigFile FBConfigFile
FBConfigFile FBConfigFile FBConfigFile FBConfigFile FBConfigFile FBConfigFile FBConfigFile FBConfigFile FBConfigFile FBConfigFile