PrevNextUpHome BREW C++ Class Library & GUI Framework & XML Middleware : SophiaFramework 4.1
SFXConfig
Class that manages various application settings.
#include <SFXConfig.h.hpp>
class SFXConfig;
SFMTYPEDEFCLASS(SFXConfig)

Collaboration diagram

 Collaboration diagram of SFXConfigClass

Description

The SFXConfig class is used to save various application information in file when the application terminates or suspends so as to restore it the next time the application starts or resumes.

Information stored in file is managed by a pair of 'tag number' and its corresponding 'value'. (If a tag number is specified, its corresponding value can be obtained.)

A 'tag number' is a number from 0 to 60000 of the UInt32 type, and its corresponding 'value' is a value of any numerical or string type.

[Caution] About MIF File Setting

Never forget to turn on the File option in the MIF file setting of privilege level.

Example 462. Write to the configuration file

SFXConfig config;

// write string (tag number: 1)
config.WriteSFXAnsiString(1, "saving data");

// save to file
config.Save("data/def.txt");

Example 463. Read from the configuration file

SFXConfig config;

// load file
config.Load("data/def.txt");

// read string (tag number: 1)
// second argument is default value
SFXAnsiString str = config.ReadSFXAnsiString(1, "default text");
// str = "saving data" 

Example 464. read and write data of various types

config.WriteSInt32(2, -17); // write data of SInt32 type
config.WriteUInt08(3, 'a'); // write data of UInt08 type
config.WriteBool(4, true);  // write data of Bool type

// buffer
ByteConst data[] = {0x01, 0x11, 0x22, 0x33, 0x44};
SFXBuffer buffer(data, lengthof(data));

config.WriteSFXBuffer(5, buffer);        // write data of SFXBuffer type

SInt32 n1 = config.ReadSInt32(2, -9999); // read data of SInt32 type
// n1 = -17

// second argument is default value
AChar c = config.ReadUInt08(3, '\0');    // read data of UInt08 type
// c = 'a'

Bool b = config.ReadBool(4, false);      // read data of Bool type
// b = true 

// read data of SFXBuffer type
SFXBuffer buff = config.ReadSFXBuffer(5, SFXBuffer());

Member

Constructor/Destructor
SFXConfig( Void )
Constructor of SFXConfig class.
~SFXConfig( Void )
Destructor of SFXConfig class.
Public Functions
Void Clear( Void )
Delete all the entries in the SFXConfig instance.
static
SFXConfigConstRef
EmptyInstance( Void )
Get an empty instance of the SFXConfig class.
SInt32 GetSize( Void )
Get the number of the entries in the SFXConfig instance.
SFCError Load( SFXPathConstRef path )
Load the specified configuration file.
SFCError ReadBinary( UInt16 tag , VoidConstHandle value , UInt16Ptr length )
Read binary data from the entry with a specified tag.
Bool ReadBool( UInt16 tag , Bool initial )
Read a value of Bool type from the entry with a specified tag.
Float32 ReadFloat32( UInt16 tag , Float32 initial )
Read a value of Float32 type from the entry with a specified tag.
Float64 ReadFloat64( UInt16 tag , Float64 initial )
Read a value of Float64 type from the entry with a specified tag.
SFXAnsiString ReadSFXAnsiString( UInt16 tag , SFXAnsiStringConstRef initial )
Read an AChar string from the entry with a specified tag.
SFXBuffer ReadSFXBuffer( UInt16 tag , SFXBufferConstRef initial )
Read a SFXBuffer data from the entry with a specified tag.
SFXWideString ReadSFXWideString( UInt16 tag , SFXWideStringConstRef initial )
Read a string of WChar type from the entry with a specified tag.
SInt08 ReadSInt08( UInt16 tag , SInt08 initial )
Read a value of SInt08 type from the entry with a specified tag.
SInt16 ReadSInt16( UInt16 tag , SInt16 initial )
Read a value of SInt16 type from the entry with a specified tag.
SInt32 ReadSInt32( UInt16 tag , SInt32 initial )
Read a value of SInt32 type from the entry with a specified tag.
SInt64 ReadSInt64( UInt16 tag , SInt64 initial )
Read a value of SInt64 type from the entry with a specified tag.
UInt08 ReadUInt08( UInt16 tag , UInt08 initial )
Read a value of UInt08 type from the entry with a specified tag.
UInt16 ReadUInt16( UInt16 tag , UInt16 initial )
Read a value of UInt16 type from the entry with a specified tag.
UInt32 ReadUInt32( UInt16 tag , UInt32 initial )
Read a value of UInt32 type from the entry with a specified tag.
UInt64 ReadUInt64( UInt16 tag , UInt64 initial )
Read a value of UInt64 type from the entry with a specified tag.
Void Remove( UInt16 tag )
Delete a specified entry.
SFCError Save( SFXPathConstRef path )
Save( Void )
Save the settings in the configuration file.
SFCError WriteBinary( UInt16 tag , VoidConstPtr value , UInt16 length )
Write binary data to the entry with a specified tag.
SFCError WriteBool( UInt16 tag , Bool value )
Write a value of Bool type to the entry with a specified tag.
SFCError WriteFloat32( UInt16 tag , Float32 value )
Write a value of Float32 type to the entry with a specified tag.
SFCError WriteFloat64( UInt16 tag , Float64 value )
Write a value of Float64 type to the entry with a specified tag.
SFCError WriteSFXAnsiString( UInt16 tag , SFXAnsiStringConstRef value )
Write an AChar string to the entry with a specified tag.
SFCError WriteSFXBuffer( UInt16 tag , SFXBufferConstRef value )
Write a SFXBuffer data to the entry with a specified tag.
SFCError WriteSFXWideString( UInt16 tag , SFXWideStringConstRef value )
Write a WChar string to the entry with a specified tag.
SFCError WriteSInt08( UInt16 tag , SInt08 value )
Write a value of SInt08 type to the entry with a specified tag.
SFCError WriteSInt16( UInt16 tag , SInt16 value )
Write a value of SInt16 type to the entry with a specified tag.
SFCError WriteSInt32( UInt16 tag , SInt32 value )
Write a value of SInt32 type to the entry with a specified tag.
SFCError WriteSInt64( UInt16 tag , SInt64 value )
Write a value of SInt64 type to the entry with a specified tag.
SFCError WriteUInt08( UInt16 tag , UInt08 value )
Write a value of UInt08 type to the entry with a specified tag.
SFCError WriteUInt16( UInt16 tag , UInt16 value )
Write a value of UInt16 type to the entry with a specified tag.
SFCError WriteUInt32( UInt16 tag , UInt32 value )
Write a value of UInt32 type to the entry with a specified tag.
SFCError WriteUInt64( UInt16 tag , UInt64 value )
Write a value of UInt64 type to the entry with a specified tag.

SFXConfig::SFXConfig
Constructor of SFXConfig class.
[ public, explicit ]
SFXConfig(Void);

Description

The constructor does not read any data from the file.


SFXConfig::~SFXConfig
Destructor of SFXConfig class.
[ public ]
~SFXConfig(Void);

Description

The destructor calls the SFXConfig::Clear function, and deletes all the entries in the SFXConfig instance.

Reference

SFXConfig::Clear


SFXConfig::Clear
Delete all the entries in the SFXConfig instance.
[ public ]
Void Clear(Void);

Description

The content of the SFXConfig instance updated by the SFXConfig::Clear function is not reflected to the configuration file until the SFXConfig::Save function is called.

Example

SFXConfig  config;

// load configuration file
config.Load("config.cfg");

// write value of Bool type
config.WriteBool(100, true);
config.WriteBool(101, false);

// delete all entries
config.Clear();

Reference

SFXConfig::Remove | SFXConfig::Save


SFXConfig::EmptyInstance
Get an empty instance of the SFXConfig class.
[ public, static ]
SFXConfigConstRef EmptyInstance(Void);

Description

Get an instance that represents an empty configuration file.


SFXConfig::GetSize
Get the number of the entries in the SFXConfig instance.
[ public, const ]
SInt32 GetSize(Void);

Example

SFXConfig   config;
UInt32      entryNum = 0;

// load configuration file
config.Load("config.cfg");

// write value of Bool type 
config.WriteBool(100, true);
config.WriteBool(101, false);

// get number of entries in SFXConfig instance
entryNum = config.GetSize();

SFXConfig::Load
Load the specified configuration file.
[ public ]
SFCError Load(
    SFXPathConstRef path   // path of configuration file 
);

Return value

  • Success, or the configuration file does not exist : SFERR_NO_ERROR
  • If invalid configuration file path, or invalid content of the loaded file : SFERR_INVALID_PARAM
  • If file has already been opened : SFERR_INVALID_STATE
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED
  • Otherwise : error value is defined in AEEError.h

Description

Load the configuration file, and set the name of configuration file to the SFXConfig instance. And the SFXConfig::Save function creates the configuration file using the file name set to the SFXConfig instance.

[Note] Note
Before using the SFXConfig class, the SFXConfig::Load function needs to be called.
[Note] Note
When loading more than one configuration file, only the content of the configuration file loaded last will be valid. And the contents of the other configuration files will be destroyed.

Example

SFXConfig   config;

// load configuration file
config.Load(SFXPath("config.cfg"));

// write value of Bool type 
config.WriteBool(100, true);
config.WriteBool(101, false);

Reference

SFXConfig::Save


SFXConfig::ReadBinary
Read binary data from the entry with a specified tag.
[ public, const ]
SFCError ReadBinary(
    UInt16 tag              // tag
    VoidConstHandle value   // handle of data to store
    UInt16Ptr length        // length of data
);

Return value

  • Success : SFERR_NO_ERROR
  • If data for specified tag does not exist : SFERR_FAILED

Example

SFXConfig          config;
VoidConstPtr       data;
UInt16             len;

// load configuration file
config.Load("config.cfg");

// write value of Bool type 
config.WriteBool(100, true);
config.WriteBool(101, false);

// save various application settings in configuration file 
config.Save();

// load configuration file
config.Load("config.cfg");

// read binary data from entry with specified tag
config.ReadBinary(100, &data, &len);

Reference

SFXConfig::WriteBinary


SFXConfig::ReadBool
Read a value of Bool type from the entry with a specified tag.
[ public, const ]
Bool ReadBool(
    UInt16 tag     // tag
    Bool initial   // default value
);

Return value

  • If entry has a value of Bool type: this value
  • If entry does not have a value of Bool type, nor entry does not exist: default value in the initial argument

Description

Read a value of Bool type written by the SFXConfig::WriteBool function from the entry with the specified tag.

Example

SFXConfig   config; 
Bool        tmpBool;

// load configuration file
config.Load("config.cfg");

// write value of Bool type 
config.WriteBool(100, true);
config.WriteBool(101, false);

// save application settings in configuration file 
config.Save();

// load configuration file
config.Load("config.cfg");

// read value of Bool type
tmpBool = config.ReadBool(100, false);

Reference

SFXConfig::WriteBool


SFXConfig::ReadFloat32
Read a value of Float32 type from the entry with a specified tag.
[ public, const ]
Float32 ReadFloat32(
    UInt16 tag        // tag
    Float32 initial   // default value
);

Return value

  • If entry has a value of Float32 type: this value
  • If entry does not have a value of Float32 type, nor entry does not exist: default value in the initial argument

Description

Read a value of Float32 type written by the SFXConfig::WriteFloat32 function from the entry with the specified tag.

Reference

SFXConfig::WriteFloat32


SFXConfig::ReadFloat64
Read a value of Float64 type from the entry with a specified tag.
[ public, const ]
Float64 ReadFloat64(
    UInt16 tag        // tag
    Float64 initial   // default value
);

Return value

  • If entry has a value of Float64 type: this value
  • If entry does not have a value of Float64 type, nor entry does not exist: default value in the initial argument

Description

Read a value of Float64 type written by the SFXConfig::WriteFloat64 function from the entry with the specified tag.

Example

SFXConfig   config;
Float64   float64_1(0.12345), float64_2(0.000000), float64_3(-1.234);
Float64   tmpFloat64;

// load configuration file
config.Load("config.cfg");

// write Float64 value
config.WriteFloat64(100, float64_1);
config.WriteFloat64(101, float64_2);
config.WriteFloat64(102, float64_3);

// save various application settings in configuration file 
config.Save();

// load configuration file
config.Load("config.cfg");

// read value of Float64 type from entry with specified tag
tmpFloat64 == config.ReadFloat64(100, float64_1);

Reference

SFXConfig::WriteFloat64


SFXConfig::ReadSFXAnsiString
Read an AChar string from the entry with a specified tag.
[ public, const ]
SFXAnsiString ReadSFXAnsiString(
    UInt16 tag                      // tag
    SFXAnsiStringConstRef initial   // default value
);

Return value

  • If length of value is not 0 : this value
  • If length of value is 0, or entry does not exist : default value in the initial argument

Description

Read an AChar string written by the SFXConfig::WriteSFXAnsiString function from the entry with the specified tag.

An AChar string includes a null character. If the length of value is 1 byte, a SFXAnsiString instance including the null string is returned.

Example

SFXConfig      config;
SFXAnsiString  astr;

// load configuration file
config.Load("config.cfg");

// write AChar string
config.WriteSFXAnsiString(100, "Config");
config.WriteSFXAnsiString(101, "Sample");
config.WriteSFXAnsiString(102, "SophiaFramework");

// save various application settings in configuration file 
config.Save();

// load configuration file
config.Load("config.cfg");

// read AChar string
astr = config.ReadSFXAnsiString(100, "Read Config");

Reference

SFXConfig::WriteSFXAnsiString


SFXConfig::ReadSFXBuffer
Read a SFXBuffer data from the entry with a specified tag.
[ public, const ]
SFXBuffer ReadSFXBuffer(
    UInt16 tag                  // tag
    SFXBufferConstRef initial   // default value
);

Return value

  • If entry has a value of SFXBuffer type : this value
  • If entry does not have a value of SFXBuffer type, nor entry does not exist : default value in the initial argument

Description

Read a value of SFXBuffer type written by the SFXConfig::WriteSFXBuffer function from the entry with the specified tag.

Reference

SFXConfig::WriteSFXBuffer


SFXConfig::ReadSFXWideString
Read a string of WChar type from the entry with a specified tag.
[ public, const ]
SFXWideString ReadSFXWideString(
    UInt16 tag                      // tag
    SFXWideStringConstRef initial   // default value
);

Return value

  • If length of value is not 0 : this value
  • If length of value is 0, or entry does not exist : default value in the initial argument

Description

Read a string of WChar type written by the SFXConfig::WriteSFXWideString function from the entry with the specified tag.

A string of WChar type includes a null character. If the length of value is 2 bytes, a SFXWideString instance including the null string is returned.

Example

SFXConfig      config;
SFXWideString  wstr;

// load configuration file
config.Load("config.cfg");

// write WChar string
config.WriteSFXWideString(100, "Config");
config.WriteSFXWideString(101, "Sample");
config.WriteSFXWideString(102, "SophiaFramework");

// save various application settings in configuration file 
config.Save();

// load configuration file
config.Load("config.cfg");

// Read WChar string
wstr = config.WriteSFXWideString(100, "Read Config");

Reference

SFXConfig::WriteSFXWideString


SFXConfig::ReadSInt08
Read a value of SInt08 type from the entry with a specified tag.
[ public, const ]
SInt08 ReadSInt08(
    UInt16 tag       // tag
    SInt08 initial   // default value
);

Return value

  • If entry has a value of SInt08 type: this value
  • If entry does not have a value of SInt08 type, nor entry does not exist: default value in the initial argument

Description

Read a value of SInt08 type written by the SFXConfig::WriteSInt08 function from the entry with the specified tag.

Reference

SFXConfig::WriteSInt08


SFXConfig::ReadSInt16
Read a value of SInt16 type from the entry with a specified tag.
[ public, const ]
SInt16 ReadSInt16(
    UInt16 tag       // tag
    SInt16 initial   // default value
);

Return value

  • If entry has a value of SInt16 type: this value
  • If entry does not have a value of SInt16 type, nor entry does not exist: default value in the initial argument

Description

Read a value of SInt16 type written by the SFXConfig::WriteSInt16 function from the entry with the specified tag.

Reference

SFXConfig::WriteSInt16


SFXConfig::ReadSInt32
Read a value of SInt32 type from the entry with a specified tag.
[ public, const ]
SInt32 ReadSInt32(
    UInt16 tag       // tag
    SInt32 initial   // default value
);

Return value

  • If entry has a value of SInt32 type: this value
  • If entry does not have a value of SInt32 type, nor entry does not exist: default value in the initial argument

Description

Read a value of SInt32 type written by the SFXConfig::WriteSInt32 function from the entry with the specified tag.

Example

SFXConfig   config;
SInt32      tmpInt;

// load configuration file
config.Load("config.cfg");

// write value of SInt32 type 
config.WriteSInt32(100, 0x00000000);
config.WriteSInt32(101, 0x00005678);
config.WriteSInt32(102, 0xffffffff);

// save various application settings in configuration file 
config.Save();

// load the configuration file
config.Load("config.cfg");

// read value of SInt32 type
tmpInt = config.ReadSInt32(100, 0x12340000);

Reference

SFXConfig::WriteSInt32


SFXConfig::ReadSInt64
Read a value of SInt64 type from the entry with a specified tag.
[ public, const ]
SInt64 ReadSInt64(
    UInt16 tag       // tag
    SInt64 initial   // default value
);

Return value

  • If entry has a value of SInt64 type: this value
  • If entry does not have a value of SInt64 type, nor entry does not exist: default value in the initial argument

Description

Read a value of SInt64 type written by the SFXConfig::WriteSInt64 function from the entry with the specified tag.

Reference

SFXConfig::WriteSInt64


SFXConfig::ReadUInt08
Read a value of UInt08 type from the entry with a specified tag.
[ public, const ]
UInt08 ReadUInt08(
    UInt16 tag       // tag
    UInt08 initial   // default value
);

Return value

  • If entry has a value of UInt08 type: this value
  • If entry does not have a value of UInt08 type, nor entry does not exist: default value in the initial argument

Description

Read a value of UInt08 type written by the SFXConfig::WriteUInt08 function from the entry with the specified tag.

Reference

SFXConfig::WriteUInt08


SFXConfig::ReadUInt16
Read a value of UInt16 type from the entry with a specified tag.
[ public, const ]
UInt16 ReadUInt16(
    UInt16 tag       // tag
    UInt16 initial   // default value
);

Return value

  • If entry has a value of UInt16 type: this value
  • If entry does not have a value of UInt16 type, nor entry does not exist: default value in the initial argument

Description

Read a value of UInt16 type written by the SFXConfig::WriteUInt16 function from the entry with the specified tag.

Reference

SFXConfig::WriteUInt16


SFXConfig::ReadUInt32
Read a value of UInt32 type from the entry with a specified tag.
[ public, const ]
UInt32 ReadUInt32(
    UInt16 tag       // tag
    UInt32 initial   // default value
);

Return value

  • If entry has a value of UInt32 type: this value
  • If entry does not have a value of UInt32 type, nor entry does not exist: default value in the initial argument

Description

Read a value of UInt32 type written by the SFXConfig::WriteUInt32 function from the entry with the specified tag.

Reference

SFXConfig::WriteUInt32


SFXConfig::ReadUInt64
Read a value of UInt64 type from the entry with a specified tag.
[ public, const ]
UInt64 ReadUInt64(
    UInt16 tag       // tag
    UInt64 initial   // default value
);

Return value

  • If entry has a value of UInt64 type: this value
  • If entry does not have a value of UInt64 type, nor entry does not exist: default value in the initial argument

Description

Read a value of UInt64 type written by the SFXConfig::WriteUInt64 function from the entry with the specified tag.

Reference

SFXConfig::WriteUInt64


SFXConfig::Remove
Delete a specified entry.
[ public ]
Void Remove(
    UInt16 tag   // tag
);

Description

Delete the specified entry if it exists in the SFXConfig instance.

The content of the SFXConfig instance updated by the SFXConfig::Remove function is not reflected in the configuration file until the SFXConfig::Save function is called.

Example

SFXConfig     config;

// load configuration file
config.Load("config.cfg");

// write value of Bool type
config.WriteBool(100, true);
config.WriteBool(101, false);

// delete specified entry
config.Remove(101);

Reference

SFXConfig::Save


SFXConfig::Save
Save the settings in the configuration file.
[ public ]
SFCError Save(
    SFXPathConstRef path   // file path
);
[ public ]
SFCError Save(Void);

Return value

  • Success : SFERR_NO_ERROR
  • If file name or content of the loaded file is invalid : SFERR_INVALID_PARAM
  • If file has already been opened: SFERR_INVALID_STATE
  • If insufficient memory: SFERR_NO_MEMORY
  • If failed : SFERR_FAILED
  • Otherwise: error value is defined in AEEError.h

Description

If the file path is not specified, the file path specified as an argument of the SFXConfig::Load function is used.

The configuration file is saved only if its content differs from the content of the SFXConfig instance.

Example

SFXConfig   config;

// load configuration file
config.Load(SFXPath("config.cfg"));

// write value of Bool type 
config.WriteBool(100, true);
config.WriteBool(101, false);

// save various application settings in configuration file 
config.Save();

Reference

SFXConfig::Load


SFXConfig::WriteBinary
Write binary data to the entry with a specified tag.
[ public ]
SFCError WriteBinary(
    UInt16 tag           // tag
    VoidConstPtr value   // pointer to binary data
    UInt16 length        // length of binary data
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid parameter: SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

If the entry with the specified tag exists in the SFXConfig instance, overwrite specified lenghth of binary data to this entry.

If the entry with the specified tag does not exist in the SFXConfig instance, create a new entry and write specified lenghth of binary data to this entry.

To read binary data from this entry, use the SFXConfig::ReadBinary function .

Example

SFXConfig   config;
AChar       moji[] = {"abcdefghijk"};

// load configuration file
config.Load("config.cfg");

// write binary data
config.WriteBinary(100, SFXHelper::strlen(moji), (VoidConstPtr)moji);

Reference

SFXConfig::ReadBinary


SFXConfig::WriteBool
Write a value of Bool type to the entry with a specified tag.
[ public ]
SFCError WriteBool(
    UInt16 tag   // tag
    Bool value   // value
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid parameter: SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

If the entry with the specified tag exists in the SFXConfig instance, overwrite a value of Bool type to this entry.

If the entry with the specified tag does not exist in the SFXConfig instance, create a new entry and write a value of Bool type to this entry.

To read a value of Bool type from this entry, use the SFXConfig::ReadBool function .

Example

SFXConfig   config;

// load configuration file
config.Load("config.cfg");

// write value of Bool type 
config.WriteBool(100, true);
config.WriteBool(101, false);

Reference

SFXConfig::ReadBool


SFXConfig::WriteFloat32
Write a value of Float32 type to the entry with a specified tag.
[ public ]
SFCError WriteFloat32(
    UInt16 tag      // tag
    Float32 value   // value
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid parameter: SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

If the entry with the specified tag exists in the SFXConfig instance, overwrite a value of Float32 type to this entry.

If the entry with the specified tag does not exist in the SFXConfig instance, create a new entry and write a value of Float32 type to this entry.

To read a value of Float32 type from this entry, use the SFXConfig::ReadFloat32 function .

Reference

SFXConfig::ReadFloat32


SFXConfig::WriteFloat64
Write a value of Float64 type to the entry with a specified tag.
[ public ]
SFCError WriteFloat64(
    UInt16 tag      // tag
    Float64 value   // value
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid parameter: SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

If the entry with the specified tag exists in the SFXConfig instance, overwrite a value of Float64 type to this entry.

If the entry with the specified tag does not exist in the SFXConfig instance, create a new entry and write a value of Float64 type to this entry.

To read a value of Float64 type from this entry, use the SFXConfig::ReadFloat64 function .

Example

SFXConfig   config;
Float64   float64_1(0.12345), float64_2(0.000000), float64_3(-1.234);

// load configuration file
config.Load("config.cfg");

// write value of Float64 type
config.WriteFloat64(100, float64_1);
config.WriteFloat64(101, float64_2);
config.WriteFloat64(102, float64_3);

Reference

SFXConfig::ReadFloat64


SFXConfig::WriteSFXAnsiString
Write an AChar string to the entry with a specified tag.
[ public ]
SFCError WriteSFXAnsiString(
    UInt16 tag                    // tag
    SFXAnsiStringConstRef value   // AChar string to be written
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid parameter, or the size of string to be written is greater than UINT16_MAXIMUM : SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

If the entry with the specified tag exists in the SFXConfig instance, overwrite an AChar string to this entry.

If the entry with the specified tag does not exist in the SFXConfig instance, create a new entry and write an AChar string to this entry.

If the string is empty (null string), write a null string to this entry.

To read an AChar string from this entry, use the SFXConfig::ReadSFXAnsiString function .

Example

SFXConfig   config;

// load configuration file
config.Load("config.cfg");

// write AChar string
config.WriteSFXAnsiString(100, "Config");
config.WriteSFXAnsiString(101, "Sample");
config.WriteSFXAnsiString(102, "SophiaFramework");

Reference

SFXConfig::ReadSFXAnsiString


SFXConfig::WriteSFXBuffer
Write a SFXBuffer data to the entry with a specified tag.
[ public ]
SFCError WriteSFXBuffer(
    UInt16 tag                // tag
    SFXBufferConstRef value   // data of SFXBuffer type
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid parameter: SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

If the entry with the specified tag exists in the SFXConfig instance, overwrite a data of SFXBuffer type to this entry.

If the entry with the specified tag does not exist in the SFXConfig instance, create a new entry and write a data of SFXBuffer type to this entry.

To read a data of SFXBuffer type from this entry, use the SFXConfig::ReadSFXBuffer function .

Reference

SFXConfig::ReadSFXBuffer


SFXConfig::WriteSFXWideString
Write a WChar string to the entry with a specified tag.
[ public ]
SFCError WriteSFXWideString(
    UInt16 tag                    // tag
    SFXWideStringConstRef value   // WChar string to be written
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid parameter, or the size of string to be written is greater than UINT16_MAXIMUM : SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

If the entry with the specified tag exists in the SFXConfig instance, overwrite a WChar string to this entry.

If the entry with the specified tag does not exist in the SFXConfig instance, create a new entry and write a WChar string to this entry.

If the string is empty (null string), write a null string to this entry.

To read a WChar string from this entry, use the SFXConfig::ReadSFXWideString function .

Example

SFXConfig   config;

// load configuration file
config.Load("config.cfg");

// write WChar string
config.WriteWideString(100, "Config");
config.WriteWideString(101, "Sample");
config.WriteWideString(102, "SophiaFramework");

Reference

SFXConfig::ReadSFXWideString


SFXConfig::WriteSInt08
Write a value of SInt08 type to the entry with a specified tag.
[ public ]
SFCError WriteSInt08(
    UInt16 tag     // tag
    SInt08 value   // value
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid parameter: SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

If the entry with the specified tag exists in the SFXConfig instance, overwrite a value of SInt08 type to this entry.

If the entry with the specified tag does not exist in the SFXConfig instance, create a new entry and write a value of SInt08 type to this entry.

To read a value of SInt08 type from this entry, use the SFXConfig::ReadSInt08 function .

Reference

SFXConfig::ReadSInt08


SFXConfig::WriteSInt16
Write a value of SInt16 type to the entry with a specified tag.
[ public ]
SFCError WriteSInt16(
    UInt16 tag     // tag
    SInt16 value   // value
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid parameter: SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

If the entry with the specified tag exists in the SFXConfig instance, overwrite a value of SInt16 type to this entry.

If the entry with the specified tag does not exist in the SFXConfig instance, create a new entry and write a value of SInt16 type to this entry.

To read a value of SInt16 type from this entry, use the SFXConfig::ReadSInt16 function .

Reference

SFXConfig::ReadSInt16


SFXConfig::WriteSInt32
Write a value of SInt32 type to the entry with a specified tag.
[ public ]
SFCError WriteSInt32(
    UInt16 tag     // tag
    SInt32 value   // value
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid parameter: SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

If the entry with the specified tag exists in the SFXConfig instance, overwrite a value of SInt32 type to this entry.

If the entry with the specified tag does not exist in the SFXConfig instance, create a new entry and write a value of SInt32 type to this entry.

To read a value of SInt32 type from this entry, use the SFXConfig::ReadSInt32 function .

Example

SFXConfig   config;

// load configuration file
config.Load("config.cfg");

// write value of SInt32 type 
config.WriteSInt32(100, 0x00000000);
config.WriteSInt32(101, 0x00005678);
config.WriteSInt32(102, 0xffffffff);

Reference

SFXConfig::ReadSInt32


SFXConfig::WriteSInt64
Write a value of SInt64 type to the entry with a specified tag.
[ public ]
SFCError WriteSInt64(
    UInt16 tag     // tag
    SInt64 value   // value
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid parameter: SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

If the entry with the specified tag exists in the SFXConfig instance, overwrite a value of SInt64 type to this entry.

If the entry with the specified tag does not exist in the SFXConfig instance, create a new entry and write a value of SInt64 type to this entry.

To read a value of SInt64 type from this entry, use the SFXConfig::ReadSInt64 function .

Reference

SFXConfig::ReadSInt64


SFXConfig::WriteUInt08
Write a value of UInt08 type to the entry with a specified tag.
[ public ]
SFCError WriteUInt08(
    UInt16 tag     // tag
    UInt08 value   // value
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid parameter: SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

If the entry with the specified tag exists in the SFXConfig instance, overwrite a value of UInt08 type to this entry.

If the entry with the specified tag does not exist in the SFXConfig instance, create a new entry and write a value of UInt08 type to this entry.

To read a value of UInt08 type from this entry, use the SFXConfig::ReadUInt08 function .

Reference

SFXConfig::ReadUInt08


SFXConfig::WriteUInt16
Write a value of UInt16 type to the entry with a specified tag.
[ public ]
SFCError WriteUInt16(
    UInt16 tag     // tag
    UInt16 value   // value
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid parameter: SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

If the entry with the specified tag exists in the SFXConfig instance, overwrite a value of UInt16 type to this entry.

If the entry with the specified tag does not exist in the SFXConfig instance, create a new entry and write a value of UInt16 type to this entry.

To read a value of UInt16 type from this entry, use the SFXConfig::ReadUInt16 function .

Reference

SFXConfig::ReadUInt16


SFXConfig::WriteUInt32
Write a value of UInt32 type to the entry with a specified tag.
[ public ]
SFCError WriteUInt32(
    UInt16 tag     // tag
    UInt32 value   // value
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid parameter: SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

If the entry with the specified tag exists in the SFXConfig instance, overwrite a value of UInt32 type to this entry.

If the entry with the specified tag does not exist in the SFXConfig instance, create a new entry and write a value of UInt32 type to this entry.

To read a value of UInt32 type from this entry, use the SFXConfig::ReadUInt32 function .

Reference

SFXConfig::ReadUInt32


SFXConfig::WriteUInt64
Write a value of UInt64 type to the entry with a specified tag.
[ public ]
SFCError WriteUInt64(
    UInt16 tag     // tag
    UInt64 value   // value
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid parameter: SFERR_INVALID_PARAM
  • If insufficient memory: SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

If the entry with the specified tag exists in the SFXConfig instance, overwrite a value of UInt64 type to this entry.

If the entry with the specified tag does not exist in the SFXConfig instance, create a new entry and write a value of UInt64 type to this entry.

To read a value of UInt64 type from this entry, use the SFXConfig::ReadUInt64 function .

Reference

SFXConfig::ReadUInt64