PrevNextUpHome BREW C++ Class Library & GUI Framework & XML Middleware : SophiaFramework 4.1
SFXProperty
Class that manages several pairs of string key and its string value.
#include <SFXProperty.h.hpp>
class SFXProperty;
SFMTYPEDEFCLASS(SFXProperty)

Description

The SFXProperty class is similar to the SFXArray or SFXHashmap class, but different in that both key and value are of string type and more than one element may have the same string key.

Example 480. Define an instance variable

SFXProperty property;

Example 481. Set an element

property.Set("unix", "??");
property.Append("macos", "CR");
property.Insert(1, "windows", "CRLF");
property.Set("unix", "LF");
property.Append("macos", "LF");

Example 482. Get an element

SFXAnsiString str1 = property.Get("unix");
SFXAnsiString str2 = property.GetKey(2);
SFXAnsiString str3 = property.GetValue(2);

Example 483. Get the number of elements

SInt32 n = property.GetSize();

Example 484. Delete an element

property.Remove(2);
property.Clear("macos");
property.Clear();

Reference

SFXArray | SFXHashmap

Member

Constructor/Destructor
SFXProperty( Void )
Constructor of SFXProperty class.
~SFXProperty( Void )
Destructor of SFXProperty class.
Public Functions
SFCError Append( SFXAnsiStringConstRef key , SFXAnsiStringConstRef value )
Append a pair element of string key and its string value. ( more than two pair elements can have the same string key )
Void Clear( SFXAnsiStringConstRef key , Bool sensitive = true )
Clear( Void )
Clear the elements related with the specified key or all the elements.
Bool Contains( SFXAnsiStringConstRef key , Bool sensitive = true )
Check whether the element with specified key is contained or not.
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 with the specified key, searching from the beginning.
SFXAnsiStringConstRef Get( SFXAnsiStringConstRef key , Bool sensitive = true )
Get the value of pair element to match with the specified key.
SFXAnsiStringConstRef GetKey( SInt32 index )
Get the key of element at the specified index.
SInt32 GetSize( Void )
Get the size. ( the number of pair elements of string key and its string value )
SFXAnsiStringConstRef GetValue( SInt32 index )
Get the value of element at the specified index.
SFCError Insert( SInt32 index , SFXAnsiStringConstRef key , SFXAnsiStringConstRef value )
Insert an element of string key and its string value at the specified index.
Bool IsEmpty( Void )
Check whether the property is empty or not.
SInt32 LastIndexOf( SFXAnsiStringConstRef key , SInt32 index = SINT32_MAXIMUM , Bool sensitive = true )
Get the last index of the element to match with the specified key, searching from the end.
Void Remove( SInt32 begin , SInt32 end )
Remove( SInt32 index )
Remove the elements at the specified index or range.
SFCError Set( SFXAnsiStringConstRef key , SFXAnsiStringConstRef value , Bool sensitive = true )
Set the value of pair element with the specified key.
SFCError SetKey( SInt32 index , SFXAnsiStringConstRef key )
Set the key of element at the specified index.
SFCError SetValue( SInt32 index , SFXAnsiStringConstRef value )
Get the value of element at the specified index.

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

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

SFXProperty::Append
Append a pair element of string key and its string value. ( more than two pair elements can have the same string key )
[ public ]
SFCError Append(
    SFXAnsiStringConstRef key     // key of string
    SFXAnsiStringConstRef value   // value of string
);

Return value

  • Success : SFERR_NO_ERROR
  • If insufficient memory : SFERR_NO_MEMOERY
  • If failed : SFERR_FAILED

Reference

SFXProperty::Insert | SFXProperty::Set


SFXProperty::Clear
Clear the elements related with the specified key or all the elements.
[ public ]
Void Clear(
    SFXAnsiStringConstRef key   // key of string
    Bool sensitive = true       // case-sensitive on string key or not
);
[ public ]
Void Clear(Void);

Description

If the "key" argument is specified, the elements related with it are deleted.

If the argument is empty, all the elements are deleted.


SFXProperty::Contains
Check whether the element with specified key is contained or not.
[ public, const ]
Bool Contains(
    SFXAnsiStringConstRef key   // key of string
    Bool sensitive = true       // case-sensitive on string key or not
);

Return value

  • If contained : true
  • If not contained : false

SFXProperty::EmptyInstance
Get an empty property.
[ public, static ]
SFXPropertyConstRef EmptyInstance(Void);

Description

Get an instance that represents an empty property.


SFXProperty::FirstIndexOf
Get the first index of the element to match with the specified key, searching from the beginning.
[ public, const ]
SInt32 FirstIndexOf(
    SFXAnsiStringConstRef key       // key of string to match with
    SInt32 index = SINT32_MINIMUM   // starting index to search from
    Bool sensitive = true           // case-sensitive on string key or not
);

Return value

  • Success : first index of the element to match with the specified key
  • If failed : -1

Description

Search from beginning to end, and get the first index of the element to match with the specified key.

By specifying a starting index, you can search from any position other than the beginning. (The origin index is 0.)

Reference

SFXProperty::LastIndexOf


SFXProperty::Get
Get the value of pair element to match with the specified key.
[ public, const ]
SFXAnsiStringConstRef Get(
    SFXAnsiStringConstRef key   // key of string to match with
    Bool sensitive = true       // case-sensitive on string key or not
);

Return value

If there is an element to match with the specified key, rerurn its value.

If not , return null.

Reference

SFXProperty::Set


SFXProperty::GetKey
Get the key of element at the specified index.
[ public, const ]
SFXAnsiStringConstRef GetKey(
    SInt32 index   // index
);

Return value

If there is an element at the specified index, rerurn its key.

If not , return null.

Reference

SFXProperty::SetKey


SFXProperty::GetSize
Get the size. ( the number of pair elements of string key and its string value )
[ public, const ]
SInt32 GetSize(Void);

SFXProperty::GetValue
Get the value of element at the specified index.
[ public, const ]
SFXAnsiStringConstRef GetValue(
    SInt32 index   // index
);

Return value

If there is an element at the specified index, rerurn its value.

If not , return null.

Reference

SFXProperty::SetValue


SFXProperty::Insert
Insert an element of string key and its string value at the specified index.
[ public ]
SFCError Insert(
    SInt32 index                  // index to insert at
    SFXAnsiStringConstRef key     // key of string
    SFXAnsiStringConstRef value   // value of string
);

Return value

  • Success : SFERR_NO_ERROR
  • If insufficient memory: SFERR_NO_MEMOERY
  • If failed : SFERR_FAILED

Reference

SFXProperty::Append | SFXProperty::Set


SFXProperty::IsEmpty
Check whether the property is empty or not.
[ public, const ]
Bool IsEmpty(Void);

Return value

  • If empty : true
  • If not empty : false

SFXProperty::LastIndexOf
Get the last index of the element to match with the specified key, searching from the end.
[ public, const ]
SInt32 LastIndexOf(
    SFXAnsiStringConstRef key       // key of string to match with
    SInt32 index = SINT32_MAXIMUM   // starting index to search from
    Bool sensitive = true           // case-sensitive on string key or not
);

Return value

  • Success : last index of the element to match with the specified key
  • If failed : -1

Description

Search from end to beginning, and get the last index of the element to match with the specified key.

By specifying a starting index, you can search from any position other than the end. (The origin index is 0.)

Reference

SFXProperty::FirstIndexOf


SFXProperty::Remove
Remove the elements at the specified index or range.
[ public ]
Void Remove(
    SInt32 begin   // beginning index to remove
    SInt32 end     // end index to remove
);
[ public ]
Void Remove(
    SInt32 index   // index to remove
);

SFXProperty::Set
Set the value of pair element with the specified key.
[ public ]
SFCError Set(
    SFXAnsiStringConstRef key     // key of string
    SFXAnsiStringConstRef value   // value of string
    Bool sensitive = true         // case-sensitive on string key or not
);

Return value

  • Success : SFERR_NO_ERROR
  • If insufficient memory : SFERR_NO_MEMOERY
  • If failed : SFERR_FAILED

Description

If there are already elements with the specified key, the element of which index is minimum is overwritten.

Reference

SFXProperty::Append | SFXProperty::Insert


SFXProperty::SetKey
Set the key of element at the specified index.
[ public ]
SFCError SetKey(
    SInt32 index                // index
    SFXAnsiStringConstRef key   // key of string
);

Return value

  • Success : SFERR_NO_ERROR
  • If there is no pair of key and its value at the specified index : SFERR_INVALID_PARAM
  • If insufficient memory : SFERR_NO_MEMOERY

Reference

SFXProperty::GetKey


SFXProperty::SetValue
Get the value of element at the specified index.
[ public ]
SFCError SetValue(
    SInt32 index                  // index
    SFXAnsiStringConstRef value   // value of string
);

Return value

If there is an element at the specified index, rerurn its key.

If not , return null.

Reference

SFXProperty::GetValue