SophiaFramework UNIVERSE 5.3 |
The SFXConfig class is used to save the entries of (tag, value) to file.
If the entries of (tag, value) are written into the SFXConfig instance when the applet ends or suspends, they can be restored from this instance when the applet starts or resumes.
When a entry of (tag, value) is written, any value from 0 to 65535 of the UInt16 type can be set as the tag and any numeric, string, or buffer can be set as the value.
By specifying the tag, the corresponding value can be read from the SFXConfig instance.
About MIF File Setting | |
---|---|
It is necessary to turn on the File option in the MIF file setting of privilege level when the SFXConfig class is used. |
Example 807. Writing the entry of (tag, value)
SFXConfig config; // write the entry of (tag: 1, value: "saving data") into SFXConfig config.WriteSFXAnsiString(1, "saving data"); // save the SFXConfig instance to the configuration file config.Save(SFXPath("/data/applet.cfg"));
Example 808. Reading the value of the entry with the specified tag
SFXConfig config; // load the SFXConfig instance from the configuration file config.Load(SFXPath("/data/applet.cfg")); // get the value of the entry where tag is "1" // * the second argument is the default value, // which will be returned if the entry in question is not found SFXAnsiString value = config.ReadSFXAnsiString(1, "default text"); // now, value is set to "saving data"
Example 809. Writing and reading various values
config.WriteSInt32(2, -17); // value of the SInt32 type config.WriteUInt08(3, 'a'); // value of the UInt08 type config.WriteBool(4, true); // value of the Bool type ByteConst data[] = {0x01, 0x11, 0x22, 0x33, 0x44}; SFXBuffer buffer(data, lengthof(data)); config.WriteSFXBuffer(5, buffer); // value of the SFXBuffer type // get the value of the entry with the specified tag // * the second argument is the default value, // which will be returned if the pair element in question is not found SInt32 n1 = config.ReadSInt32(2, -9999); // value of the entry where tag is "2" // n1 = -17 of the SInt32 type AChar c = config.ReadUInt08(3, '\0'); // value of the entry where tag is "3" // c = 'a' of the UInt08 type Bool b = config.ReadBool(4, false); // value of the entry where tag is "4" // b = true of the Bool type SFXBuffer buff = config.ReadSFXBuffer(5, SFXBuffer()); // value of the entry where tag is "5" // buff = {0x01, 0x11, 0x22, 0x33, 0x44}
Constructor/Destructor |
---|
SFXConfig( Void ) Constructor of the SFXConfig class.
|
~SFXConfig( Void ) Destructor of the SFXConfig class.
|
Public Functions | |
---|---|
Void |
Clear( Void ) Delete all entries from this SFXConfig instance.
|
static SFXConfigConstRef |
EmptyInstance( Void ) Get an empty config.
|
SInt32 |
GetSize( Void ) Get the number of entries in this SFXConfig instance.
|
SFCError |
Load(
SFXPathConstRef path
) Load the SFXConfig instance from the specified configuration file.
|
SFCError |
ReadBinary(
UInt16 tag
, VoidConstHandle value
, UInt16Ptr length
) Read the Binary value of the entry with the specified tag from this SFXConfig instance.
|
Bool |
ReadBool(
UInt16 tag
, Bool initial
) Read the Bool value of the entry with the specified tag from this SFXConfig instance.
|
Float32 |
ReadFloat32(
UInt16 tag
, Float32 initial
) Read the Float32 value of the entry with the specified tag from this SFXConfig instance.
|
Float64 |
ReadFloat64(
UInt16 tag
, Float64 initial
) Read the Float64 value of the entry with the specified tag from this SFXConfig instance.
|
SFXAnsiString |
ReadSFXAnsiString(
UInt16 tag
, SFXAnsiStringConstRef initial
) Read the SFXAnsiString value of the entry with the specified tag from this SFXConfig instance.
|
SFXBuffer |
ReadSFXBuffer(
UInt16 tag
, SFXBufferConstRef initial
) Read the SFXBuffer value of the entry with the specified tag from this SFXConfig instance.
|
SFXWideString |
ReadSFXWideString(
UInt16 tag
, SFXWideStringConstRef initial
) Read the SFXWideString value of the entry with the specified tag from this SFXConfig instance.
|
SInt08 |
ReadSInt08(
UInt16 tag
, SInt08 initial
) Read the SInt08 value of the entry with the specified tag from this SFXConfig instance.
|
SInt16 |
ReadSInt16(
UInt16 tag
, SInt16 initial
) Read the SInt16 value of the entry with the specified tag from this SFXConfig instance.
|
SInt32 |
ReadSInt32(
UInt16 tag
, SInt32 initial
) Read the SInt32 value of the entry with the specified tag from this SFXConfig instance.
|
SInt64 |
ReadSInt64(
UInt16 tag
, SInt64 initial
) Read the SInt64 value of the entry with the specified tag from this SFXConfig instance.
|
UInt08 |
ReadUInt08(
UInt16 tag
, UInt08 initial
) Read the UInt08 value of the entry with the specified tag from this SFXConfig instance.
|
UInt16 |
ReadUInt16(
UInt16 tag
, UInt16 initial
) Read the UInt16 value of the entry with the specified tag from this SFXConfig instance.
|
UInt32 |
ReadUInt32(
UInt16 tag
, UInt32 initial
) Read the UInt32 value of the entry with the specified tag from this SFXConfig instance.
|
UInt64 |
ReadUInt64(
UInt16 tag
, UInt64 initial
) Read the UInt64 value of the entry with the specified tag from this SFXConfig instance.
|
Void |
Remove(
UInt16 tag
) Delete the specified entry.
|
SFCError |
Save(
SFXPathConstRef path
) Save this SFXConfig instance to the specified configuration file.
|
SFCError |
Save( Void ) Save this SFXConfig instance to the specified configuration file.
|
SFCError |
WriteBinary(
UInt16 tag
, VoidConstPtr value
, UInt16 length
) Write the entry of the specified tag and the specified Binary value into this SFXConfig instance.
|
SFCError |
WriteBool(
UInt16 tag
, Bool value
) Write the entry of the specified tag and the specified Bool value into this SFXConfig instance.
|
SFCError |
WriteFloat32(
UInt16 tag
, Float32 value
) Write the entry of the specified tag and the specified Float32 value into this SFXConfig instance.
|
SFCError |
WriteFloat64(
UInt16 tag
, Float64 value
) Write the entry of the specified tag and the specified Float64 value into this SFXConfig instance.
|
SFCError |
WriteSFXAnsiString(
UInt16 tag
, SFXAnsiStringConstRef value
) Write the entry of the specified tag and the specified SFXAnsiString value into this SFXConfig instance.
|
SFCError |
WriteSFXBuffer(
UInt16 tag
, SFXBufferConstRef value
) Write the entry of the specified tag and the specified WriteSFXBuffer value into this SFXConfig instance.
|
SFCError |
WriteSFXWideString(
UInt16 tag
, SFXWideStringConstRef value
) Write the entry of the specified tag and the specified SFXWideString value into this SFXConfig instance.
|
SFCError |
WriteSInt08(
UInt16 tag
, SInt08 value
) Write the entry of the specified tag and the specified SInt08 value into this SFXConfig instance.
|
SFCError |
WriteSInt16(
UInt16 tag
, SInt16 value
) Write the entry of the specified tag and the specified SInt16 value into this SFXConfig instance.
|
SFCError |
WriteSInt32(
UInt16 tag
, SInt32 value
) Write the entry of the specified tag and the specified SInt32 value into this SFXConfig instance.
|
SFCError |
WriteSInt64(
UInt16 tag
, SInt64 value
) Write the entry of the specified tag and the specified SInt64 value into this SFXConfig instance.
|
SFCError |
WriteUInt08(
UInt16 tag
, UInt08 value
) Write the entry of the specified tag and the specified UInt08 value into this SFXConfig instance.
|
SFCError |
WriteUInt16(
UInt16 tag
, UInt16 value
) Write the entry of the specified tag and the specified UInt16 value into this SFXConfig instance.
|
SFCError |
WriteUInt32(
UInt16 tag
, UInt32 value
) Write the entry of the specified tag and the specified UInt32 value into this SFXConfig instance.
|
SFCError |
WriteUInt64(
UInt16 tag
, UInt64 value
) Write the entry of the specified tag and the specified UInt64 value into this SFXConfig instance.
|
[ public, explicit ] SFXConfig(Void);
This constructor does nothing.
[ public ] ~SFXConfig(Void);
This destructor deletes all entries in this SFXConfig instance by calling the SFXConfig::Clear function internally.
[ public ] Void Clear(Void);
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.
SFXConfig config; // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // write Bool values into the SFXConfig instance config.WriteBool(100, true); config.WriteBool(101, false); // delete all entries from the SFXConfig instance config.Clear();
[ public, static ] SFXConfigConstRef EmptyInstance(Void);
This function gets an instance that represents an empty config.
[ public, const ] SInt32 GetSize(Void);
Number of entries in this SFXConfig instance
This function gets the number of entries in this SFXConfig instance.
SFXConfig config; UInt32 entryNum = 0; // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // write the entry of the specified tag and the specified Bool value into the SFXConfig instance config.WriteBool(100, true); config.WriteBool(101, false); // get number of entries in the SFXConfig instance entryNum = config.GetSize();
[ public ] SFCError Load( SFXPathConstRef path // path of the configuration file );
This function loads the SFXConfig instance from the specified configuration file saved with the SFXConfig::Save function.
This SFXConfig instance contains the pass of the configuration file specified in the path argument. And if the SFXConfig::Save fucntion is called without specifying no argument, the SFXConfig instance will be save to the file of this path.
Tip | |
---|---|
To use the SFXConfig class, this function needs to be called first. |
Note | |
---|---|
If more than one configuration file are loaded, only the content of the configuration file loaded last will be valid. The contents of the other configuration files will be destroyed. |
SFXConfig config; Bool bool_0(true), bool_1(false); Bool bool_a, bool_b; // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // write the entry of the specified tag and the specified Bool value into the SFXConfig instance config.WriteBool(100, bool_0); config.WriteBool(101, bool_1); // save the SFXConfig instance to the configuration file config.Save(); // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // read the Bool value of the entry with the specified tag from the SFXConfig instance bool_a = config.ReadBool(100, bool_0); bool_b = config.ReadBool(101, bool_1);
SFXConfig::Save | SFXConfig | BREW API IFILEMGR_GetLastError
[ public, const ] SFCError ReadBinary( UInt16 tag // tag VoidConstHandle value // handle of data to store UInt16Ptr length // length of data );
This function reads the Binary value of the entry with the specified tag written with the SFXConfig::WriteBinary function from this SFXConfig instance.
Note | |
---|---|
If the entry of the specified tag and the Binary value does not exist, SFERR_FAILED will be returned. |
SFXConfig config; AChar moji[] = {"abcdefghijkxyz"}; VoidConstPtr data; UInt16 len; // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // write the entry of the specified tag and the specified Binary value into the SFXConfig instance config.WriteBinary(100, (VoidConstPtr)moji, SFXHelper::strlen(moji) + 1); // save the SFXConfig instance to the configuration file config.Save(); // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // read the Binary value of the entry with the specified tag from the SFXConfig instance config.ReadBinary(100, &data, &len);
This function reads the Bool value of the entry with the specified tag written with the SFXConfig::WriteBool function from this SFXConfig instance.
Note | |
---|---|
If the entry of the specified tag and the Bool value does not exist, the default value specified in the initial argument will be returned. |
SFXConfig config; Bool bool_0(true), bool_1(false); Bool bool_a, bool_b; // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // write the entry of the specified tag and the specified Bool value into the SFXConfig instance config.WriteBool(100, bool_0); config.WriteBool(101, bool_1); // save the SFXConfig instance to the configuration file config.Save(); // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // read the Bool value of the entry with the specified tag from the SFXConfig instance bool_a = config.ReadBool(100, bool_0); bool_b = config.ReadBool(101, bool_1);
This function reads the Float32 value of the entry with the specified tag written with the SFXConfig::WriteFloat32 function from this SFXConfig instance.
Note | |
---|---|
If the entry of the specified tag and the Float32 value does not exist, the default value specified in the initial argument will be returned. |
This function reads the Float64 value of the entry with the specified tag written with the SFXConfig::WriteFloat64 function from this SFXConfig instance.
Note | |
---|---|
If the entry of the specified tag and the Float64 value does not exist, the default value specified in the initial argument will be returned. |
SFXConfig config; Float64 float64_0(0.12345), float64_1(0.000000), float64_2(-1.234); Float64 float64_a, float64_b, float64_c; // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // write the entry of the specified tag and the specified Float64 value into the SFXConfig instance config.WriteFloat64(100, float64_0); config.WriteFloat64(101, float64_1); config.WriteFloat64(102, float64_2); // save the SFXConfig instance to the configuration file config.Save(); // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // read the Float64 value of the entry with the specified tag from the SFXConfig instance float64_a = config.ReadFloat64(100, float64_0); float64_b = config.ReadFloat64(101, float64_1); float64_c = config.ReadFloat64(102, float64_2);
[ public, const ] SFXAnsiString ReadSFXAnsiString( UInt16 tag // tag SFXAnsiStringConstRef initial // default value );
This function reads the SFXAnsiString value of the entry with the specified tag written with the SFXConfig::WriteSFXAnsiString function from this SFXConfig instance.
Note | |
---|---|
If the entry of the specified tag and the SFXAnsiString value does not exist, the default value specified in the initial argument will be returned. |
Note | |
---|---|
The returned SFXAnsiString value includes the null character. If its length equals 1 byte, it is the null string. |
SFXConfig config; SFXAnsiString string; // load configuration file config.Load(SFXPath("config.cfg")); // write the entry of the specified tag and the specified SFXAnsiString value into the SFXConfig instance config.WriteSFXAnsiString(100, "Config"); config.WriteSFXAnsiString(101, "Sample"); config.WriteSFXAnsiString(102, "SophiaFramework"); // save the SFXConfig instance to the configuration file config.Save(); // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // read the SFXAnsiString value of the entry with the specified tag from the SFXConfig instance string = config.ReadSFXAnsiString(100, "Read Config");
[ public, const ] SFXBuffer ReadSFXBuffer( UInt16 tag // tag SFXBufferConstRef initial // default value );
This function reads the SFXBuffer value of the entry with the specified tag written with the SFXConfig::WriteSFXBuffer function from this SFXConfig instance.
Note | |
---|---|
If the entry of the specified tag and the SFXBuffer value does not exist, the default value specified in the initial argument will be returned. |
[ public, const ] SFXWideString ReadSFXWideString( UInt16 tag // tag SFXWideStringConstRef initial // default value );
This function reads the SFXWideString value of the entry with the specified tag written with the SFXConfig::WriteSFXWideString function from this SFXConfig instance.
Note | |
---|---|
If the entry of the specified tag and the SFXWideString value does not exist, the default value specified in the initial argument will be returned. |
Note | |
---|---|
The returned SFXWideString value includes the null character. If its length equals 2 bytes, it is the null string. |
SFXConfig config; SFXWideString string; // load configuration file config.Load(SFXPath("config.cfg")); // write the entry of the specified tag and the specified SFXWideString value into the SFXConfig instance config.WriteSFXWideString(100, "Config"); config.WriteSFXWideString(101, "Sample"); config.WriteSFXWideString(102, "SophiaFramework"); // save the SFXConfig instance to the configuration file config.Save(); // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // read the SFXWideString value of the entry with the specified tag from the SFXConfig instance string = config.ReadSFXWideString(100, "Read Config");
This function reads the SInt08 value of the entry with the specified tag written with the SFXConfig::WriteSInt08 function from this SFXConfig instance.
Note | |
---|---|
If the entry of the specified tag and the SInt08 value does not exist, the default value specified in the initial argument will be returned. |
This function reads the SInt16 value of the entry with the specified tag written with the SFXConfig::WriteSInt16 function from this SFXConfig instance.
Note | |
---|---|
If the entry of the specified tag and the SInt16 value does not exist, the default value specified in the initial argument will be returned. |
This function reads the SInt32 value of the entry with the specified tag written with the SFXConfig::WriteSInt32 function from this SFXConfig instance.
Note | |
---|---|
If the entry of the specified tag and the SInt32 value does not exist, the default value specified in the initial argument will be returned. |
SFXConfig config; SInt32 i_0(10), i_1(20), i_2(30); SInt32 i_a, i_b, i_c; // load configuration file config.Load(SFXPath("config.cfg")); // write the entry of the specified tag and the specified SInt32 value into the SFXConfig instance config.WriteSInt32(100, i_0); config.WriteSInt32(101, i_1); config.WriteSInt32(102, i_2); // save the SFXConfig instance to the configuration file config.Save(); // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // read the SInt32 value of the entry with the specified tag from the SFXConfig instance i_a = config.ReadSInt32(100, i_0); i_b = config.ReadSInt32(101, i_1); i_c = config.ReadSInt32(102, i_2);
This function reads the SInt64 value of the entry with the specified tag written with the SFXConfig::WriteSInt64 function from this SFXConfig instance.
Note | |
---|---|
If the entry of the specified tag and the SInt64 value does not exist, the default value specified in the initial argument will be returned. |
This function reads the UInt08 value of the entry with the specified tag written with the SFXConfig::WriteUInt08 function from this SFXConfig instance.
Note | |
---|---|
If the entry of the specified tag and the UInt08 value does not exist, the default value specified in the initial argument will be returned. |
This function reads the UInt16 value of the entry with the specified tag written with the SFXConfig::WriteUInt16 function from this SFXConfig instance.
Note | |
---|---|
If the entry of the specified tag and the UInt16 value does not exist, the default value specified in the initial argument will be returned. |
This function reads the UInt32 value of the entry with the specified tag written with the SFXConfig::WriteUInt32 function from this SFXConfig instance.
Note | |
---|---|
If the entry of the specified tag and the UInt32 value does not exist, the default value specified in the initial argument will be returned. |
This function reads the UInt64 value of the entry with the specified tag written with the SFXConfig::WriteUInt64 function from this SFXConfig instance.
Note | |
---|---|
If the entry of the specified tag and the UInt64 value does not exist, the default value specified in the initial argument will be returned. |
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.
SFXConfig config; // load configuration file config.Load(SFXPath("config.cfg")); // write value of Bool type config.WriteBool(100, true); config.WriteBool(101, false); // delete specified entry config.Remove(101);
[ public ] SFCError Save( SFXPathConstRef path // path of the configuration file );
[ public ] SFCError Save(Void);
This function saves this SFXConfig instance to the specified configuration file, which will be loaded with the SFXConfig::Load function.
If no argument is specified, this SFXConfig instance will be saved to the file from which the SFXConfig::Load function loaded this instance.
SFXConfig config; Bool bool_0(true), bool_1(false); Bool bool_a, bool_b; // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // write the entry of the specified tag and the specified Bool value into the SFXConfig instance config.WriteBool(100, bool_0); config.WriteBool(101, bool_1); // save the SFXConfig instance to the configuration file config.Save(); // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // read the Bool value of the entry with the specified tag from the SFXConfig instance bool_a = config.ReadBool(100, bool_0); bool_b = config.ReadBool(101, bool_1);
SFXConfig::Load | SFXConfig | BREW API IFILEMGR_GetLastError
[ public ] SFCError WriteBinary( UInt16 tag // tag VoidConstPtr value // pointer to binary data UInt16 length // length of binary data );
This function writes the entry of the specified tag and the specified Binary value into this SFXConfig instance, which can be read with the SFXConfig::ReadBinary function.
If the entry with the specified tag has already existed in this SFXConfig instance, its value will be overwritten with the specified Binary value.
SFXConfig config; AChar moji[] = {"abcdefghijkxyz"}; VoidConstPtr data; UInt16 len; // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // write the entry of the specified tag and the specified Binary value into the SFXConfig instance config.WriteBinary(100, (VoidConstPtr)moji, SFXHelper::strlen(moji) + 1); // save the SFXConfig instance to the configuration file config.Save(); // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // read the Binary value of the entry with the specified tag from the SFXConfig instance config.ReadBinary(100, &data, &len);
This function writes the entry of the specified tag and the specified Bool value into this SFXConfig instance, which can be read with the SFXConfig::ReadBool function.
If the entry with the specified tag has already existed in this SFXConfig instance, its value will be overwritten with the specified Bool value.
SFXConfig config; Bool bool_0(true), bool_1(false); Bool bool_a, bool_b; // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // write the entry of the specified tag and the specified Bool value into the SFXConfig instance config.WriteBool(100, bool_0); config.WriteBool(101, bool_1); // save the SFXConfig instance to the configuration file config.Save(); // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // read the Bool value of the entry with the specified tag from the SFXConfig instance bool_a = config.ReadBool(100, bool_0); bool_b = config.ReadBool(101, bool_1);
This function writes the entry of the specified tag and the specified Float32 value into this SFXConfig instance, which can be read with the SFXConfig::ReadFloat32 function.
If the entry with the specified tag has already existed in this SFXConfig instance, its value will be overwritten with the specified Float32 value.
This function writes the entry of the specified tag and the specified Float64 value into this SFXConfig instance, which can be read with the SFXConfig::ReadFloat64 function.
If the entry with the specified tag has already existed in this SFXConfig instance, its value will be overwritten with the specified Float64 value.
SFXConfig config; Float64 float64_0(0.12345), float64_1(0.000000), float64_2(-1.234); Float64 float64_a, float64_b, float64_c; // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // write the entry of the specified tag and the specified Float64 value into the SFXConfig instance config.WriteFloat64(100, float64_0); config.WriteFloat64(101, float64_1); config.WriteFloat64(102, float64_2); // save the SFXConfig instance to the configuration file config.Save(); // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // read the Float64 value of the entry with the specified tag from the SFXConfig instance float64_a = config.ReadFloat64(100, float64_0); float64_b = config.ReadFloat64(101, float64_1); float64_c = config.ReadFloat64(102, float64_2);
[ public ] SFCError WriteSFXAnsiString( UInt16 tag // tag SFXAnsiStringConstRef value // SFXAnsiString to be written );
This function writes the entry of the specified tag and the specified SFXAnsiString value into this SFXConfig instance, which can be read with the SFXConfig::ReadSFXAnsiString function.
If the entry with the specified tag has already existed in this SFXConfig instance, its value will be overwritten with the specified SFXAnsiString value.
If the specified string is empty(or the null string), the null string will be written.
SFXConfig config; SFXAnsiString string; // load configuration file config.Load(SFXPath("config.cfg")); // write the entry of the specified tag and the specified SFXAnsiString value into the SFXConfig instance config.WriteSFXAnsiString(100, "Config"); config.WriteSFXAnsiString(101, "Sample"); config.WriteSFXAnsiString(102, "SophiaFramework"); // save the SFXConfig instance to the configuration file config.Save(); // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // read the SFXAnsiString value of the entry with the specified tag from the SFXConfig instance string = config.ReadSFXAnsiString(100, "Read Config");
[ public ] SFCError WriteSFXBuffer( UInt16 tag // tag SFXBufferConstRef value // data of SFXBuffer type );
This function writes the entry of the specified tag and the specified SFXBuffer value into this SFXConfig instance, which can be read with the SFXConfig::ReadSFXBuffer function.
If the entry with the specified tag has already existed in this SFXConfig instance, its value will be overwritten with the specified SFXBuffer value.
[ public ] SFCError WriteSFXWideString( UInt16 tag // tag SFXWideStringConstRef value // SFXWideString to be written );
This function writes the entry of the specified tag and the specified SFXWideString value into this SFXConfig instance, which can be read with the SFXConfig::ReadSFXWideString function.
If the entry with the specified tag has already existed in this SFXConfig instance, its value will be overwritten with the specified SFXWideString value.
If the specified string is empty(or the null string), the null string will be written.
SFXConfig config; SFXWideString string; // load configuration file config.Load(SFXPath("config.cfg")); // write the entry of the specified tag and the specified SFXWideString value into the SFXConfig instance config.WriteSFXWideString(100, "Config"); config.WriteSFXWideString(101, "Sample"); config.WriteSFXWideString(102, "SophiaFramework"); // save the SFXConfig instance to the configuration file config.Save(); // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // read the SFXWideString value of the entry with the specified tag from the SFXConfig instance string = config.ReadSFXWideString(100, "Read Config");
This function writes the entry of the specified tag and the specified SInt08 value into this SFXConfig instance, which can be read with the SFXConfig::ReadSInt08 function.
If the entry with the specified tag has already existed in this SFXConfig instance, its value will be overwritten with the specified SInt08 value.
This function writes the entry of the specified tag and the specified SInt16 value into this SFXConfig instance, which can be read with the SFXConfig::ReadSInt16 function.
If the entry with the specified tag has already existed in this SFXConfig instance, its value will be overwritten with the specified SInt16 value.
This function writes the entry of the specified tag and the specified SInt32 value into this SFXConfig instance, which can be read with the SFXConfig::ReadSInt32 function.
If the entry with the specified tag has already existed in this SFXConfig instance, its value will be overwritten with the specified SInt32 value.
SFXConfig config; SInt32 i_0(10), i_1(20), i_2(30); SInt32 i_a, i_b, i_c; // load configuration file config.Load(SFXPath("config.cfg")); // write the entry of the specified tag and the specified SInt32 value into the SFXConfig instance config.WriteSInt32(100, i_0); config.WriteSInt32(101, i_1); config.WriteSInt32(102, i_2); // save the SFXConfig instance to the configuration file config.Save(); // load the SFXConfig instance from the configuration file config.Load(SFXPath("config.cfg")); // read the SInt32 value of the entry with the specified tag from the SFXConfig instance i_a = config.ReadSInt32(100, i_0); i_b = config.ReadSInt32(101, i_1); i_c = config.ReadSInt32(102, i_2);
This function writes the entry of the specified tag and the specified SInt64 value into this SFXConfig instance, which can be read with the SFXConfig::ReadSInt64 function.
If the entry with the specified tag has already existed in this SFXConfig instance, its value will be overwritten with the specified SInt64 value.
This function writes the entry of the specified tag and the specified UInt08 value into this SFXConfig instance, which can be read with the SFXConfig::ReadUInt08 function.
If the entry with the specified tag has already existed in this SFXConfig instance, its value will be overwritten with the specified UInt08 value.
This function writes the entry of the specified tag and the specified UInt16 value into this SFXConfig instance, which can be read with the SFXConfig::ReadUInt16 function.
If the entry with the specified tag has already existed in this SFXConfig instance, its value will be overwritten with the specified UInt16 value.
This function writes the entry of the specified tag and the specified UInt32 value into this SFXConfig instance, which can be read with the SFXConfig::ReadUInt32 function.
If the entry with the specified tag has already existed in this SFXConfig instance, its value will be overwritten with the specified UInt32 value.
This function writes the entry of the specified tag and the specified UInt64 value into this SFXConfig instance, which can be read with the SFXConfig::ReadUInt64 function.
If the entry with the specified tag has already existed in this SFXConfig instance, its value will be overwritten with the specified UInt64 value.
Copyright(c) 2002 - 2024 Sophia Cradle Incorporated All Rights Reserved. |