SophiaFramework UNIVERSE 5.3 |
The SFXProperty class is used to manage the set of the key / value pair elements in the appended order.
The SFXProperty class is similar to the SFXArray or SFXHashmap class, but different in that both key and value are of the SFXAnsiString type and more than one element may have the same string key.
Example 830. Setting an element
property.Set("unix", "??"); property.Append("macos", "CR"); property.Insert(1, "windows", "CRLF"); property.Set("unix", "LF"); property.Append("macos", "LF");
Constructor/Destructor |
---|
SFXProperty( Void ) Constructor of the SFXProperty class.
|
~SFXProperty( Void ) Destructor of the SFXProperty class.
|
Public Functions | |
---|---|
SFCError |
Append(
SFXAnsiStringConstRef key
, SFXAnsiStringConstRef value
) Append the specified key / value pair element to this property.
|
Void |
Clear(
SFXAnsiStringConstRef key
, Bool sensitive = true
) Delete the elements.
|
Void |
Clear( Void ) Delete the elements.
|
Bool |
Contains(
SFXAnsiStringConstRef key
, Bool sensitive = true
) Check whether or not the element with the specified key is contained by this property.
|
static SFXPropertyConstRef |
EmptyInstance( Void ) Get an empty property.
|
SInt32 |
FirstIndexOf(
SFXAnsiStringConstRef key
, SInt32 index = SINT32_MINIMUM
, Bool sensitive = true
) Get the first index of the element to match the specified key by searching from the beginning.
|
SFXAnsiStringConstRef |
Get(
SFXAnsiStringConstRef key
, Bool sensitive = true
) Get the value of the pair element to match the specified key.
|
SFXAnsiStringConstRef |
GetKey(
SInt32 index
) Get the key of the pair element at the specified index.
|
SInt32 |
GetSize( Void ) Get the number of the pair elements in this property.
|
SFXAnsiStringConstRef |
GetValue(
SInt32 index
) Get the value of the pair element at the specified index.
|
SFCError |
Insert(
SInt32 index
, SFXAnsiStringConstRef key
, SFXAnsiStringConstRef value
) Insert the specified key / value pair element at the specified index.
|
Bool |
IsEmpty( Void ) Check whether or not this property is empty.
|
SInt32 |
LastIndexOf(
SFXAnsiStringConstRef key
, SInt32 index = SINT32_MAXIMUM
, Bool sensitive = true
) Get the last index of the element to match the specified key by searching from the end.
|
Void |
Remove(
SInt32 begin
, SInt32 end
) Remove the pair element at the specified index or ones in the specified range.
|
Void |
Remove(
SInt32 index
) Remove the pair element at the specified index or ones in the specified range.
|
SFCError |
Set(
SFXAnsiStringConstRef key
, SFXAnsiStringConstRef value
, Bool sensitive = true
) Set the value of the pair element with the specified key.
|
SFCError |
SetKey(
SInt32 index
, SFXAnsiStringConstRef key
) Set the key of the pair element at the specified index to the specified key.
|
SFCError |
SetValue(
SInt32 index
, SFXAnsiStringConstRef value
) Get the value of the pair element at the specified index to the specified value.
|
[ public, explicit ] SFXProperty(Void);
This constructor does nothing.
[ public ] ~SFXProperty(Void);
This destructor deletes all the key / value pair elements from this property by calling the SFXProperty::Clear function internally.
[ public ] SFCError Append( SFXAnsiStringConstRef key // key of string SFXAnsiStringConstRef value // value of string );
This function Append the specified key / value pair element to this property.
Note | |
---|---|
More than one pair element can have the same key. |
Note | |
---|---|
Both of the key and the value of the pair element are of the SFXAnsiString type. |
SFXProperty::Insert | SFXProperty::Set | SFXProperty::Remove | SFXAnsiString
[ public ] Void Clear( SFXAnsiStringConstRef key // key of string Bool sensitive = true // whether or not the key is case-sensitive );
[ public ] Void Clear(Void);
This function deletes the elements.
If the key argument is specified, the elements related with it will be deleted.
If no argument is specified, all the elements will be deleted.
Note | |
---|---|
This function is called in the SFXProperty::~SFXProperty destructor. |
[ public, const ] Bool Contains( SFXAnsiStringConstRef key // key of string Bool sensitive = true // whether or not the key will be compared with case-sensitivity );
This function checks whether or not the element with the specified key is contained by this property.
If false is specified in the sensitive argument, the key will be compared without case-sensitivity. By defualt, true is set.
Note | |
---|---|
The key of the pair element is of the SFXAnsiString type. |
[ public, static ] SFXPropertyConstRef EmptyInstance(Void);
This function gets an instance that represents an empty property.
[ public, const ] SInt32 FirstIndexOf( SFXAnsiStringConstRef key // key of string to match SInt32 index = SINT32_MINIMUM // index to search from Bool sensitive = true // whether or not the key will be compared with case-sensitivity );
This function gets the first index of the element to match the specified key by searching from the beginning.
By specifying the index argument, you can search from any position other than the beginning. (The origin index is 0.)
If false is specified in the sensitive argument, the key will be compared without case-sensitivity. By defualt, this argument is set to true.
[ public, const ] SFXAnsiStringConstRef Get( SFXAnsiStringConstRef key // key of string to match Bool sensitive = true // whether or not the key will be compared with case-sensitivity );
Value of the pair element to match the specified key or the null string(SFXAnsiString::EmptyInstance).
This function gets the value of the pair element to match the specified key.
If more than one pair element have the same key specified in the key argument, the value of the pair element whose index is the greatest among them will be returned.
If no element matches the specified key, the null string(SFXAnsiString::EmptyInstance) will be returned.
If false is specified in the sensitive argument, the key will be compared without case-sensitivity. By defualt, true is set.
Note | |
---|---|
Both of the key and the value of the pair element are of the SFXAnsiString type. |
SFXProperty::Set | SFXAnsiString::EmptyInstance | SFXAnsiString
[ public, const ] SFXAnsiStringConstRef GetKey( SInt32 index // index );
Key of the pair element at the specified index or the null string(SFXAnsiString::EmptyInstance).
This function gets the key of the pair element at the specified index.
If no element exists at the specified index, the null string(SFXAnsiString::EmptyInstance) will be returned.
Note | |
---|---|
The key of the pair element is of the SFXAnsiString type. |
SFXProperty::SetKey | SFXAnsiString::EmptyInstance | SFXAnsiString
[ public, const ] SInt32 GetSize(Void);
Number of the pair elements in this property.
This function gets the number of the pair elements in this property.
[ public, const ] SFXAnsiStringConstRef GetValue( SInt32 index // index );
Value of the pair element at the specified index or the null string(SFXAnsiString::EmptyInstance).
This function gets the value of the pair element at the specified index.
If no element exists at the specified index, the null string(SFXAnsiString::EmptyInstance) will be returned.
Note | |
---|---|
The value of the pair element is of the SFXAnsiString type. |
SFXProperty::SetValue | SFXAnsiString::EmptyInstance | SFXAnsiString
[ public ] SFCError Insert( SInt32 index // index to insert at SFXAnsiStringConstRef key // key of string SFXAnsiStringConstRef value // value of string );
This function inserts the specified key / value pair element at the specified index.
More than one pair element have the same key in this property.
Note | |
---|---|
Both of the key and the value of the pair element are of the SFXAnsiString type. |
SFXProperty::Append | SFXProperty::Set | SFXProperty::Remove | SFXAnsiString
[ public, const ] Bool IsEmpty(Void);
This function checks whether or not this property is empty.
[ public, const ] SInt32 LastIndexOf( SFXAnsiStringConstRef key // key of string to match SInt32 index = SINT32_MAXIMUM // index to search from Bool sensitive = true // whether or not the key will be compared with case-sensitivity );
This function gets the last index of the element to match the specified key by searching from the end.
By specifying the index argument, you can search from any position other than the end. (The origin index is 0.)
If false is specified in the sensitive argument, the key will be compared without case-sensitivity. By defualt, this argument is set to true.
[ public ] Void Remove( SInt32 begin // beginning index to remove(this index is included) SInt32 end // ending index to remove(this index is not included) );
[ public ] Void Remove( SInt32 index // index to remove );
This function removes the pair element at the specified index or ones in the specified range..
Note | |
---|---|
Though the value specified in the begin argument will be included in the indexes of the pair elements to be deleted, one specified in the end argument will not be included. |
SFXProperty::Insert | SFXProperty::Append | SFXProperty::Set
[ public ] SFCError Set( SFXAnsiStringConstRef key // key of string SFXAnsiStringConstRef value // value of string Bool sensitive = true // whether or not the key will be compared with case-sensitivity );
This function sets the value of the pair element with the specified key.
If more than one pair element have the same key specified in the key argument, the value of the pair element whose index is the greatest among them will be overwitten.
If no element matches the specified key, the pair element with the specified key and value will be appended to this property.
If false is specified in the sensitive argument, the key will be compared without case-sensitivity. By defualt, true is set.
Note | |
---|---|
Both of the key and the value of the pair element are of the SFXAnsiString type. |
SFXProperty::Append | SFXProperty::Insert | SFXProperty::Remove | SFXAnsiString
[ public ] SFCError SetKey( SInt32 index // index SFXAnsiStringConstRef key // key of string );
This function sets the key of the pair element at the specified index to the specified key.
If no element exists at the specified index, SFERR_INVALID_PARAM will be returned.
Note | |
---|---|
The key of the pair element is of the SFXAnsiString type. |
[ public ] SFCError SetValue( SInt32 index // index SFXAnsiStringConstRef value // value of string );
This function sets the value of the pair element at the specified index to the specified value.
If no element exists at the specified index, SFERR_INVALID_PARAM will be returned.
Note | |
---|---|
The value of the pair element is of the SFXAnsiString type. |
Copyright(c) 2002 - 2024 Sophia Cradle Incorporated All Rights Reserved. |