MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
Loading...
Searching...
No Matches
TSLProfileHelper Class Reference

Detailed Description

This component gives access to helper routines for configuration files management. The configuration file is buffered in case of multiple calls.

Static Public Member Functions

static bool clearCache ()
 
static void flushProfileStrings ()
 
static void getDefaultFilename (TSLSimpleString &filename)
 
static void getDefaultSection (TSLSimpleString &section)
 
static bool lookupProfile (const char *filename, const char *section, const char *keyword, char *value, int valueSize, const char *defValue="", int count=-1)
 
static bool lookupProfile (const char *filename, const char *section, const char *keyword, int *value, const int defValue=0, int count=-1)
 
static bool lookupProfile (const char *filename, const char *section, const char *keyword, double *value, const double defValue=0.0, int count=-1)
 
static bool lookupProfile (const char *filename, const char *section, const char *keyword, TSLULong *value, TSLULong defValue=0, int count=-1)
 
static bool lookupProfile (const char *keyword, char *value, int valueSize, const char *defValue="", int count=-1)
 
static bool lookupProfile (const char *keyword, int *value, const int defValue=0, int count=-1)
 
static bool lookupProfile (const char *keyword, double *value, const double defValue=0.0, int count=-1)
 
static bool lookupProfile (const char *keyword, TSLULong *value, TSLULong defValue=0, int count=-1)
 
static void profileWriteMode (TSLProfileWriteMode writeMode)
 
static bool sectionExists (const char *filename, const char *section)
 
static void setDefaultFilename (const char *filename)
 
static void setDefaultSection (const char *section)
 
static bool writeProfile (const char *filename, const char *section, const char *keyword, int value, int count=-1)
 
static bool writeProfile (const char *filename, const char *section, const char *keyword, const char *value, int count=-1)
 
static bool writeProfile (const char *filename, const char *section, const char *keyword, double value, int count=-1)
 
static bool writeProfile (const char *filename, const char *section, const char *keyword, TSLULong value, int count=-1)
 

Member Function Documentation

◆ clearCache()

static bool TSLProfileHelper::clearCache ( )
static

This operation clears the cache of the filename that is currently being read.

◆ flushProfileStrings()

static void TSLProfileHelper::flushProfileStrings ( )
static

Writes the profile strings cached to disk. Only useful if the profile write mode is set to TSLProfileWriteWhenFlushed.

◆ getDefaultFilename()

static void TSLProfileHelper::getDefaultFilename ( TSLSimpleString & filename)
static

This method sets the default filename used for lookups.

Parameters
filenamethe default filename or empty if one has not been set.

◆ getDefaultSection()

static void TSLProfileHelper::getDefaultSection ( TSLSimpleString & section)
static

This method gets the default section to be used for lookups.

Parameters
sectionthe default section or empty if one has not been set.

◆ lookupProfile() [1/8]

static bool TSLProfileHelper::lookupProfile ( const char * filename,
const char * section,
const char * keyword,
char * value,
int valueSize,
const char * defValue = "",
int count = -1 )
static

This operation reads the specified keyword from a configuration file, to obtain an associated string value.

If the count parameter is specified (and is positive), then it is concatenated onto the end of the keyword before the read occurs.

Parameters
filenameName of file to read profile from.
sectionSection within the file to read profile from.
keywordName of keyword within file.
valuePointer to buffer to store value.
valueSizeSize of buffer specified by value parameter.
defValueDefault value if keyword/count not found
countAssociated count value, appended to keyword if specified.
Returns
true by value if the keyword/count match was found in the config file, false otherwise. Returns the value found in the file by reference, default value if not found. Returns false if the value found will not fit in the specified buffer.

◆ lookupProfile() [2/8]

static bool TSLProfileHelper::lookupProfile ( const char * filename,
const char * section,
const char * keyword,
double * value,
const double defValue = 0.0,
int count = -1 )
static

This operation reads the specified keyword from a configuration file, to obtain a double precision associated value.

If the count parameter is specified (and is positive), then it is concatenated onto the end of the keyword before the read occurs.

Parameters
filenameName of file to read profile from.
sectionSection within the file to read profile from.
keywordName of keyword within file.
valuePointer to double value to store value.
defValueDefault value if keyword/count not found
countAssociated count value, appended to keyword if specified.
Returns
true by value if the keyword/count match was found in the config file, false otherwise. Returns the value found in the file by reference, default value if not found.

◆ lookupProfile() [3/8]

static bool TSLProfileHelper::lookupProfile ( const char * filename,
const char * section,
const char * keyword,
int * value,
const int defValue = 0,
int count = -1 )
static

This operation reads the specified keyword from a configuration file, to obtain an integer associated value.

If the count parameter is specified (and is positive), then it is concatenated onto the end of the keyword before the read occurs.

Parameters
filenameName of file to read profile from.
sectionSection within the file to read profile from.
keywordName of keyword within file.
valuePointer to integer value to store value.
defValueDefault value if keyword/count not found
countAssociated count value, appended to keyword if specified.
Returns
true by value if the keyword/count match was found in the config file, false otherwise. Returns the value found in the file by reference, default value if not found.

◆ lookupProfile() [4/8]

static bool TSLProfileHelper::lookupProfile ( const char * filename,
const char * section,
const char * keyword,
TSLULong * value,
TSLULong defValue = 0,
int count = -1 )
static

This operation reads the specified keyword from a configuration file, to obtain an TSLULong associated value.

If the count parameter is specified (and is positive), then it is concatenated onto the end of the keyword before the read occurs.

Parameters
filenameName of file to read profile from.
sectionSection within the file to read profile from.
keywordName of keyword within file.
valuePointer to TSLULong value to store value.
defValueDefault value if keyword/count not found
countAssociated count value, appended to keyword if specified.
Returns
true by value if the keyword/count match was found in the config file, false otherwise. Returns the value found in the file by reference, default value if not found.

◆ lookupProfile() [5/8]

static bool TSLProfileHelper::lookupProfile ( const char * keyword,
char * value,
int valueSize,
const char * defValue = "",
int count = -1 )
static

This operation reads the specified keyword from a configuration file, to obtain an associated string value. The default file and section names are used.

If the count parameter is specified (and is positive), then it is concatenated onto the end of the keyword before the read occurs.

Parameters
keywordName of keyword within file.
valuePointer to buffer to store value.
valueSizeSize of buffer specified by value parameter.
defValueDefault value if keyword/count not found
countAssociated count value, appended to keyword if specified.
Returns
true by value if the keyword/count match was found in the config file, false otherwise. Returns the value found in the file by reference, default value if not found. Returns false if the value found will not fit in the specified buffer.

◆ lookupProfile() [6/8]

static bool TSLProfileHelper::lookupProfile ( const char * keyword,
double * value,
const double defValue = 0.0,
int count = -1 )
static

This operation reads the specified keyword from a configuration file, to obtain a double precision associated value. The default file and section names are used.

If the count parameter is specified (and is positive), then it is concatenated onto the end of the keyword before the read occurs.

Parameters
keywordName of keyword within file.
valuePointer to double value to store value.
defValueDefault value if keyword/count not found
countAssociated count value, appended to keyword if specified.
Returns
true by value if the keyword/count match was found in the config file, false otherwise. Returns the value found in the file by reference, default value if not found.

◆ lookupProfile() [7/8]

static bool TSLProfileHelper::lookupProfile ( const char * keyword,
int * value,
const int defValue = 0,
int count = -1 )
static

This operation reads the specified keyword from a configuration file, to obtain an integer associated value. The default file and section names are used.

If the count parameter is specified (and is positive), then it is concatenated onto the end of the keyword before the read occurs.

Parameters
keywordName of keyword within file.
valuePointer to integer value to store value.
defValueDefault value if keyword/count not found
countAssociated count value, appended to keyword if specified.
Returns
true by value if the keyword/count match was found in the config file, false otherwise. Returns the value found in the file by reference, default value if not found.

◆ lookupProfile() [8/8]

static bool TSLProfileHelper::lookupProfile ( const char * keyword,
TSLULong * value,
TSLULong defValue = 0,
int count = -1 )
static

This operation reads the specified keyword from a configuration file, to obtain an TSLULong associated value. The default file and section names are used.

If the count parameter is specified (and is positive), then it is concatenated onto the end of the keyword before the read occurs.

Parameters
keywordName of keyword within file.
valuePointer to TSLULong value to store value.
defValueDefault value if keyword/count not found
countAssociated count value, appended to keyword if specified.
Returns
true by value if the keyword/count match was found in the config file, false otherwise. Returns the value found in the file by reference, default value if not found.

◆ profileWriteMode()

static void TSLProfileHelper::profileWriteMode ( TSLProfileWriteMode writeMode)
static

Set mode for determining when any profile writes occur.

The default is TSLProfileWriteImmediately.

◆ sectionExists()

static bool TSLProfileHelper::sectionExists ( const char * filename,
const char * section )
static

Check if the specified section exists

Parameters
filenamePath to the config file
sectionName of the section to check
Returns
true if the section exists in the config file, false otherwise.

◆ setDefaultFilename()

static void TSLProfileHelper::setDefaultFilename ( const char * filename)
static

This method sets the default filename used for lookups.

Parameters
filenameDefault name for initialisation file.

◆ setDefaultSection()

static void TSLProfileHelper::setDefaultSection ( const char * section)
static

This method sets the default section to be used for lookups.

Parameters
sectionDefault name for section within initialisation file.

◆ writeProfile() [1/4]

static bool TSLProfileHelper::writeProfile ( const char * filename,
const char * section,
const char * keyword,
const char * value,
int count = -1 )
static

This operation writes the specified keyword in the configuration file, with an associated value string.

If the count parameter is specified (and is positive), then it is concatenated onto the end of the keyword before the write occurs.

Parameters
filenameName of file to write profile to.
sectionSection within the file to write profile to.
keywordName of keyword within file.
valueString value to write to keyword.
countAssociated count value, appended to keyword if specified.
Returns
true if the keyword/count value was added successfully, false otherwise.

◆ writeProfile() [2/4]

static bool TSLProfileHelper::writeProfile ( const char * filename,
const char * section,
const char * keyword,
double value,
int count = -1 )
static

This operation writes the specified keyword in the configuration file, with a floating point associated value.

If the count parameter is specified (and is positive), then it is concatenated onto the end of the keyword before the write occurs.

Parameters
filenameName of file to write profile to.
sectionSection within the file to write profile to.
keywordName of keyword within file.
valueDouble precision value to write to keyword.
countAssociated count value, appended to keyword if specified.
Returns
true if the keyword/count value was added successfully, false otherwise.

◆ writeProfile() [3/4]

static bool TSLProfileHelper::writeProfile ( const char * filename,
const char * section,
const char * keyword,
int value,
int count = -1 )
static

This operation writes the specified keyword in the configuration file, with an integer associated value.

If the count parameter is specified (and is positive), then it is concatenated onto the end of the keyword before the write occurs.

Parameters
filenameName of file to write profile to.
sectionSection within the file to write profile to.
keywordName of keyword within file.
valueInteger value to write to keyword.
countAssociated count value, appended to keyword if specified.
Returns
true if the keyword/count value was added successfully, false otherwise.

◆ writeProfile() [4/4]

static bool TSLProfileHelper::writeProfile ( const char * filename,
const char * section,
const char * keyword,
TSLULong value,
int count = -1 )
static

This operation writes the specified keyword in the configuration file, with an TSLLong associated value.

If the count parameter is specified (and is positive), then it is concatenated onto the end of the keyword before the write occurs.

Parameters
filenameName of file to write profile to.
sectionSection within the file to write profile to.
keywordName of keyword within file.
valueTSLULong value to write to keyword.
countAssociated count value, appended to keyword if specified.
Returns
true if the keyword/count value was added successfully, false otherwise.