PrevNextUpHome BREW C++ Class Library & GUI Framework & XML Middleware : SophiaFramework 4.1
SFXWideString
Class that represents the string of WChar type.
#include <SFXWideString.h.hpp>
class SFXWideString;
SFMTYPEDEFCLASS(SFXWideString)

Collaboration diagram

 Collaboration diagram of SFXWideStringClass

Description

SFXAnsiString and SFXWideString

In the BREW environment, there are two kinds of character types: the char type that represents single byte character or multi-byte character, and the AECHAR type that represents 2 byte character.

SophiaFramewok defines these two kinds of types as AChar and WChar respectively.

And SophiaFramework provides two kinds of String classes: the SFXAnsiString class for the string of AChar characters and the SFXWideString class for the string of WChar characters.

How to Empty a String

There are two methods to empty a string:

In the former method, its heap is not released. By block allocation support, to allocate new memory is unnecessary when a string is newly created in this heap. Therefore its processing speed is very fast.

In the latter method, its heap is released. Though the released heap is free for other tasks, its processing speed slows down.

Which method to choose depends upon the trade-off between processing speed and memory usage.

Example 497. Method 1: Substitute an empty string or call the SFXWideString::SetLength function:

SFXWideString str = "The best C++ Programming Environment for BREW";

str = ";
// OR:
str.SetLength(0);

// the heap is not released

Example 498. Method 2: Call the Clear Function:

SFXWideString str = "The best C++ Programming Environment for BREW";

str.Clear();

// the heap is released

When short strings are frequently processed, the method of calling the SFXWideString::SetLength function is more efficient.

SFXWideString str;

str = "BREW";
...
str.SetLength(0);
...
str = "C++";
...
str.SetLength(0);
...
str = "GUI";
...
str.SetLength(0);
...
str = "XML";
...

Attach Function and Detach Function

The SFXWideString::Attach function delegates the control privilege of the WChar string to the SFXWideString object. Therefore, it is unnecessary to release the memory of the WChar string. The SFXWideString::Detach function has the reverse functionality.

Though the data is copied by using the SFXWideString::Set function and the substitution operator(=), while using the SFXWideString::Attach function and the SFXWideString::Detach function, data will not be copied.

When there is not enough heap for copying a several hundreds KB string, or to avoid the performance deterioration, use these functions.

What is delegation?: In object oriented programming, delegation means that an object have another deputy object behave like itself.

Example 499. How to use the Attach function

SFXWideString str;
WCharPtr ptr;

// allocate the memory and cast to the WChar string(ptr)
ptr = static_cast<WCharPtr>(MemoryAllocate(10240)); 
...

// delegate the control privilege of WChar string(ptr) to the SFXWideString object(str)
str.Attach(ptr, 10240);
// hereafter, the WChar string(ptr) will be handled as the SFXWideString object(str)

・・・

// after used, the allocated memory will be released automatically

Example 500. How to use the Detach function

SFXWideString str;
WCharPtr ptr;
SInt32 length;

str = "The best application for BREW.";

...

// delegate the control privilege of SFXWideString object(str) to the WChar string(ptr)
ptr = str.Detach(&length);
// hereafter, the SFXWideString object(str) can be handled as the WChar string(ptr)

...

// after used, it is necessary to release the memory of WChar string(ptr) explicitly 
MemoryFree(ptr);

AttachSFXBuffer Function and DetachSFXBuffer Function

These functions are used to delegate the control privilege between the SFXWideString and SFXBuffer objects.

Related information : Attach Function and Detach Function

Reference

SFXWideString | SFXBuffer

Member

Constructor/Destructor
SFXWideString( Void )
Constructor of SFXWideString class.
SFXWideString( SFXWideStringConstRef string )
Constructor of SFXWideString class.
SFXWideString( SFXWideStringConstRef string )
Constructor of SFXWideString class.
SFXWideString( WCharConstPtr string , SInt32 length = -1 )
Constructor of SFXWideString class.
SFXWideString( WCharConstPtr string , SInt32 length = -1 )
Constructor of SFXWideString class.
SFXWideString( WChar character )
Constructor of SFXWideString class.
SFXWideString( SFXBufferConstRef buffer )
Constructor of SFXWideString class.
SFXWideString( UInt16 threshold , UInt16 cluster )
Constructor of SFXWideString class.
~SFXWideString( Void )
Destructor of SFXWideString class.
Public Functions
SFCError Add( SFXWideStringConstRef string )
Add( WChar character )
Add( WCharConstPtr string , SInt32 length = -1 )
Add a string
SFXWideString AsLower( Void )
Convert the string into lower characters.
SInt32 AsSInt32( SInt32 substitute = 0 )
Convert the string into SInt32 type.
UInt32 AsUInt32( UInt32 substitute = 0 )
Convert the string into UInt32 type.
SFXWideString AsUpper( Void )
Convert the string into capital character.
SFCError Attach( WCharPtr string , SInt32 length = -1 )
Delegate the control privilege of specified WChar string to the SFXWideString object.
SFCError AttachSFXBuffer( SFXBufferPtr buffer )
Delegate the control privilege of specified SFXBuffer object to the SFXWideString object.
Void Clear( Void )
Clear the string.
SInt32 Compare( SFXWideStringConstRef string , Bool sensitive = true )
Compare( WCharConstPtr string , Bool sensitive = true )
Compare with a specified string by dictionary order.
SFXWideString Concat( SFXWideStringConstRef string )
Concat( WChar character )
Concat( WCharConstPtr string , SInt32 length = -1 )
Concatenate with a specified string.
SFCError Copy( SInt32 index , SFXWideStringConstRef string )
Copy( SInt32 index , WCharConstPtr string , SInt32 length = -1 )
Overwrite with a specified string.
WCharPtr Detach( SInt32Ptr length = null )
Delegate the control privilege of the SFXWideString object to the specified WChar string.
SFCError DetachSFXBuffer( SFXBufferPtr buffer )
Delegate the control privilege of specified SFXWideString object to the SFXBuffer object.
static
SFXWideStringConstRef
EmptyInstance( Void )
Get an empty string.
Bool EndsWith( SFXWideStringConstRef string , Bool sensitive = true )
EndsWith( WChar character , Bool sensitive = true )
EndsWith( WCharConstPtr string , Bool sensitive = true )
Check whether the string ends with a specified string or not.
Bool Equals( SFXWideStringConstRef string , Bool sensitive = true )
Equals( WCharConstPtr string , Bool sensitive = true )
Check whether the string equals the specified string or not.
Void Fill( WChar character )
Fill the string with specified character.
SInt32 FirstIndexOf( SFXWideStringConstRef string , SInt32 index = SINT32_MINIMUM , Bool sensitive = true )
FirstIndexOf( WChar character , SInt32 index = SINT32_MINIMUM , Bool sensitive = true )
FirstIndexOf( WCharConstPtr string , SInt32 index = SINT32_MINIMUM , Bool sensitive = true )
Get the first index of SFXWideString object to match with a specified data, searching from the beginning.
static
SFXWideString
Format( va_ref< SFXWideStringConst > format , ... )
Format( WCharConstPtr format , ... )
Format( WCharConstPtr format , ... )
Format( va_ref< SFXWideStringConst > format , ... )
Create a string by using the format.
static
SFXWideString
FormatV( SFXWideStringConstRef format , va_list argument )
FormatV( WCharConstPtr format , va_list argument )
FormatV( WCharConstPtr format , va_list argument )
FormatV( SFXWideStringConstRef format , va_list argument )
Create a string by using the format with a variable-length argument.
WCharPtr GetBuffer( Void )
Get the pointer to the internal buffer of string.
WCharConstPtr GetBuffer( Void )
Get the pointer to the internal buffer of string.
WCharConstPtr GetCString( Void )
Get the const pointer to the internal buffer of string. The buffer cannot be updated through this pointer.
WChar GetChar( SInt32 index )
Get the character at the specified index.
UInt16 GetCluster( Void )
Get the cluster size of internal buffer memory.
SInt32 GetLength( Void )
Get the length of string.
SInt32 GetLengthCString( Void )
Get the length of string until the first null character.
UInt16 GetThreshold( Void )
Get the minimum value of internal buffer.
SFXWideString Insert( SInt32 index , SFXWideStringConstRef string )
Insert( SInt32 index , WChar character )
Insert( SInt32 index , WCharConstPtr string , SInt32 length = -1 )
Insert a string or character at the specified index of SFXWideString object.
Bool IsAlpha( Void )
Check whether all the characters in the string are alphabetic or not.
Bool IsAlphaDigit( Void )
Check whether all the characters in the string are alphanumeric or not.
Bool IsAscii( Void )
Check whether all the characters in the string are Ascii or not.
Bool IsControl( Void )
Check whether all the characters in the string are control or not.
Bool IsDigit( Void )
Check whether all the characters in the string are digit or not.
Bool IsEmpty( Void )
Check whether the length of string is 0 or not.
Bool IsEmptyCString( Void )
Check whether the first character is a null or not.
Bool IsGraph( Void )
Check whether all the characters in the string are graph or not.
Bool IsHexDigit( Void )
Check whether all the characters in the string are Hex digit or not.
Bool IsLower( Void )
Check whether all the characters in the string are lower or not.
Bool IsPrint( Void )
Check whether all the characters in the string are printable or not.
Bool IsPunct( Void )
Check whether all the characters in the string are not space nor alphanumeric but printable or not.
Bool IsSpace( Void )
Check whether or not all the characters in the string are spaces or line-feed.
Bool IsUpper( Void )
Check whether all the characters in the string are capital or not.
Bool Isnull( Void )
Check whether all the characters in the string are null or not.
SInt32 LastIndexOf( SFXWideStringConstRef string , SInt32 index = SINT32_MAXIMUM , Bool sensitive = true )
LastIndexOf( WChar character , SInt32 index = SINT32_MAXIMUM , Bool sensitive = true )
LastIndexOf( WCharConstPtr string , SInt32 index = SINT32_MAXIMUM , Bool sensitive = true )
Get the last index of SFXWideString object to match with a specified data, searching from the end.
SFCError Mul( SInt32 repeat )
Repeat the string by the specified times.
SFXWideString Remove( SInt32 begin , SInt32 end )
Remove the characters within the specified range.
SFXWideString Replace( SFXWideStringConstRef fstring , SFXWideStringConstRef tstring , Bool sensitive = true )
Replace( WChar fcharacter , WCharConstPtr tstring , SInt32 tlength , Bool sensitive = true )
Replace( WChar fcharacter , WCharConstPtr tstring , Bool sensitive = true )
Replace( WCharConstPtr fstring , SInt32 flength , WChar tcharacter , Bool sensitive = true )
Replace( WCharConstPtr fstring , WChar tcharacter , Bool sensitive = true )
Replace( WChar fcharacter , WChar tcharacter , Bool sensitive = true )
Replace( WChar fcharacter , SFXWideStringConstRef tstring , Bool sensitive = true )
Replace( SFXWideStringConstRef fstring , WChar tcharacter , Bool sensitive = true )
Replace( WCharConstPtr fstring , SInt32 flength , WCharConstPtr tstring , SInt32 tlength , Bool sensitive = true )
Replace( WCharConstPtr fstring , WCharConstPtr tstring , Bool sensitive = true )
Replace( WCharConstPtr fstring , SInt32 flength , SFXWideStringConstRef tstring , Bool sensitive = true )
Replace( WCharConstPtr fstring , SFXWideStringConstRef tstring , Bool sensitive = true )
Replace( SFXWideStringConstRef fstring , WCharConstPtr tstring , SInt32 tlength , Bool sensitive = true )
Replace( SFXWideStringConstRef fstring , WCharConstPtr tstring , Bool sensitive = true )
Replace the string.
SFCError Set( SFXWideStringConstRef string )
Set( SFXBufferConstRef buffer )
Set( WChar character )
Set( WCharConstPtr string , SInt32 length = -1 )
Set( WCharConstPtr string , SInt32 length = -1 )
Set( SFXWideStringConstRef string )
Set the string.
SFCError SetChar( SInt32 index , WChar character )
Set a character at the specified index.
Void SetCluster( UInt16 size )
Set the cluster size of internal buffer memory.
SFCError SetLength( SInt32 length )
Set the length of string.
Void SetThreshold( UInt16 size )
Set the minimum size of internal buffer.
Bool StartsWith( SFXWideStringConstRef string , Bool sensitive = true )
StartsWith( WChar character , Bool sensitive = true )
StartsWith( WCharConstPtr string , Bool sensitive = true )
Check whether the string starts with a specified string or not.
SFCError Sub( SFXWideStringConstRef string )
Sub( WChar character )
Sub( WCharConstPtr string , SInt32 length = -1 )
Delete the specified string from the end of source string.
SFXWideString Substring( SInt32 begin , SInt32 end )
Get the sub-string from the source string.
Void ToLower( Void )
Convert the string into lower characters.
Void ToUpper( Void )
Convert the string into capital characters.
SFXWideString Trim( SFXWideStringConstRef string , Bool sensitive = true )
Trim( Void )
Trim( WChar character , Bool sensitive = true )
Trim( WCharConstPtr string , Bool sensitive = true )
Trim the blank characters or the specified string/character from the beginning and end of source string.
SFXWideString TrimLeft( SFXWideStringConstRef string , Bool sensitive = true )
TrimLeft( Void )
TrimLeft( WChar character , Bool sensitive = true )
TrimLeft( WCharConstPtr string , Bool sensitive = true )
Trim the blank characters or the specified string/character from the beginning of source string.
SFXWideString TrimRight( SFXWideStringConstRef string , Bool sensitive = true )
TrimRight( Void )
TrimRight( WChar character , Bool sensitive = true )
TrimRight( WCharConstPtr string , Bool sensitive = true )
Trim the blank characters or the specified string/character from the end of source string.
SFXWideString Truncate( Void )
Get the string until the first "null" character.
SFXWideStringRef operator*=( SInt32 repeat )
Repeat the string by the specified times.
SFXWideStringRef operator+=( SFXWideStringConstRef string )
operator+=( WChar character )
operator+=( WCharConstPtr string )
Add string.
SFXWideStringRef operator-=( SFXWideStringConstRef string )
operator-=( WChar character )
operator-=( WCharConstPtr string )
Delete the specified string from the end of source string.
SFXWideStringRef operator<<( SFXWideStringRef left , SFXWideStringConstRef right )
operator<<( SFXWideStringRef left , WChar right )
operator<<( SFXWideStringRef left , WCharConstPtr right )
operator<<( SFXWideStringRef left , WCharConstPtr right )
operator<<( SFXWideStringRef left , SFXWideStringConstRef right )
Append a string on the end of string.
SFXWideStringRef operator=( SFXWideStringConstRef string )
operator=( WCharConstPtr string )
operator=( WCharConstPtr string )
operator=( SFXWideStringConstRef string )
Substitute the string with a specified string.
WCharRef operator[]( SInt32 index )
Get the character at the specified index.
WCharConstRef operator[]( SInt32 index )
Get the character at the specified index.
Bool operator==( SFXWideStringConstRef left , SFXWideStringConstRef right )
operator==( WCharConstPtr left , SFXWideStringConstRef right )
operator==( WCharConstPtr left , SFXWideStringConstRef right )
operator==( SFXWideStringConstRef left , WCharConstPtr right )
operator==( SFXWideStringConstRef left , WCharConstPtr right )
operator==( SFXWideStringConstRef left , SFXWideStringConstRef right )
Check the "=" relation.
Bool operator>=( SFXWideStringConstRef left , SFXWideStringConstRef right )
operator>=( WCharConstPtr left , SFXWideStringConstRef right )
operator>=( WCharConstPtr left , SFXWideStringConstRef right )
operator>=( SFXWideStringConstRef left , WCharConstPtr right )
operator>=( SFXWideStringConstRef left , WCharConstPtr right )
operator>=( SFXWideStringConstRef left , SFXWideStringConstRef right )
Check the ">=" relation.
Bool operator>( SFXWideStringConstRef left , SFXWideStringConstRef right )
operator>( WCharConstPtr left , SFXWideStringConstRef right )
operator>( WCharConstPtr left , SFXWideStringConstRef right )
operator>( SFXWideStringConstRef left , WCharConstPtr right )
operator>( SFXWideStringConstRef left , WCharConstPtr right )
operator>( SFXWideStringConstRef left , SFXWideStringConstRef right )
Check the ">" relation.
Bool operator<=( SFXWideStringConstRef left , SFXWideStringConstRef right )
operator<=( WCharConstPtr left , SFXWideStringConstRef right )
operator<=( WCharConstPtr left , SFXWideStringConstRef right )
operator<=( SFXWideStringConstRef left , WCharConstPtr right )
operator<=( SFXWideStringConstRef left , WCharConstPtr right )
operator<=( SFXWideStringConstRef left , SFXWideStringConstRef right )
Check the "<=" relation.
Bool operator<( SFXWideStringConstRef left , SFXWideStringConstRef right )
operator<( WCharConstPtr left , SFXWideStringConstRef right )
operator<( WCharConstPtr left , SFXWideStringConstRef right )
operator<( SFXWideStringConstRef left , WCharConstPtr right )
operator<( SFXWideStringConstRef left , WCharConstPtr right )
operator<( SFXWideStringConstRef left , SFXWideStringConstRef right )
Check the "<" relation.
SFXWideString operator-( SFXWideStringConstRef left , SFXWideStringConstRef right )
operator-( WChar left , SFXWideStringConstRef right )
operator-( SFXWideStringConstRef left , WChar right )
operator-( WCharConstPtr left , SFXWideStringConstRef right )
operator-( WCharConstPtr left , SFXWideStringConstRef right )
operator-( SFXWideStringConstRef left , WCharConstPtr right )
operator-( SFXWideStringConstRef left , WCharConstPtr right )
operator-( SFXWideStringConstRef left , SFXWideStringConstRef right )
Delete the specified string from the end of left-hand string.
SFXWideString operator*( SFXWideStringConstRef left , SInt32 right )
Repeat the string by the specified times.
Bool operator!=( SFXWideStringConstRef left , SFXWideStringConstRef right )
operator!=( WCharConstPtr left , SFXWideStringConstRef right )
operator!=( WCharConstPtr left , SFXWideStringConstRef right )
operator!=( SFXWideStringConstRef left , WCharConstPtr right )
operator!=( SFXWideStringConstRef left , WCharConstPtr right )
operator!=( SFXWideStringConstRef left , SFXWideStringConstRef right )
Check the "!=" relation.
SFXWideString operator+( SFXWideStringConstRef left , SFXWideStringConstRef right )
operator+( WChar left , SFXWideStringConstRef right )
operator+( SFXWideStringConstRef left , WChar right )
operator+( WCharConstPtr left , SFXWideStringConstRef right )
operator+( WCharConstPtr left , SFXWideStringConstRef right )
operator+( SFXWideStringConstRef left , WCharConstPtr right )
operator+( SFXWideStringConstRef left , WCharConstPtr right )
operator+( SFXWideStringConstRef left , SFXWideStringConstRef right )
Add string.
Types
DefaultEnum
Constants that represent the threshold of internal heap size and the default value of cluster size.
Global Functions
Bool operator==( SFXWideStringConstRef left , SFXWideStringConstRef right )
operator==( WCharConstPtr left , SFXWideStringConstRef right )
operator==( WCharConstPtr left , SFXWideStringConstRef right )
operator==( SFXWideStringConstRef left , WCharConstPtr right )
operator==( SFXWideStringConstRef left , WCharConstPtr right )
operator==( SFXWideStringConstRef left , SFXWideStringConstRef right )
Check the "=" relation.
Bool operator>=( SFXWideStringConstRef left , SFXWideStringConstRef right )
operator>=( WCharConstPtr left , SFXWideStringConstRef right )
operator>=( WCharConstPtr left , SFXWideStringConstRef right )
operator>=( SFXWideStringConstRef left , WCharConstPtr right )
operator>=( SFXWideStringConstRef left , WCharConstPtr right )
operator>=( SFXWideStringConstRef left , SFXWideStringConstRef right )
Check the ">=" relation.
Bool operator>( SFXWideStringConstRef left , SFXWideStringConstRef right )
operator>( WCharConstPtr left , SFXWideStringConstRef right )
operator>( WCharConstPtr left , SFXWideStringConstRef right )
operator>( SFXWideStringConstRef left , WCharConstPtr right )
operator>( SFXWideStringConstRef left , WCharConstPtr right )
operator>( SFXWideStringConstRef left , SFXWideStringConstRef right )
Check the ">" relation.
Bool operator<=( SFXWideStringConstRef left , SFXWideStringConstRef right )
operator<=( WCharConstPtr left , SFXWideStringConstRef right )
operator<=( WCharConstPtr left , SFXWideStringConstRef right )
operator<=( SFXWideStringConstRef left , WCharConstPtr right )
operator<=( SFXWideStringConstRef left , WCharConstPtr right )
operator<=( SFXWideStringConstRef left , SFXWideStringConstRef right )
Check the "<=" relation.
Bool operator<( SFXWideStringConstRef left , SFXWideStringConstRef right )
operator<( WCharConstPtr left , SFXWideStringConstRef right )
operator<( WCharConstPtr left , SFXWideStringConstRef right )
operator<( SFXWideStringConstRef left , WCharConstPtr right )
operator<( SFXWideStringConstRef left , WCharConstPtr right )
operator<( SFXWideStringConstRef left , SFXWideStringConstRef right )
Check the "<" relation.
SFXWideString operator-( SFXWideStringConstRef left , SFXWideStringConstRef right )
operator-( WChar left , SFXWideStringConstRef right )
operator-( SFXWideStringConstRef left , WChar right )
operator-( WCharConstPtr left , SFXWideStringConstRef right )
operator-( WCharConstPtr left , SFXWideStringConstRef right )
operator-( SFXWideStringConstRef left , WCharConstPtr right )
operator-( SFXWideStringConstRef left , WCharConstPtr right )
operator-( SFXWideStringConstRef left , SFXWideStringConstRef right )
Delete the specified string from the end of left-hand string.
SFXWideString operator*( SFXWideStringConstRef left , SInt32 right )
Repeat the string by the specified times.
Bool operator!=( SFXWideStringConstRef left , SFXWideStringConstRef right )
operator!=( WCharConstPtr left , SFXWideStringConstRef right )
operator!=( WCharConstPtr left , SFXWideStringConstRef right )
operator!=( SFXWideStringConstRef left , WCharConstPtr right )
operator!=( SFXWideStringConstRef left , WCharConstPtr right )
operator!=( SFXWideStringConstRef left , SFXWideStringConstRef right )
Check the "!=" relation.
SFXWideString operator+( SFXWideStringConstRef left , SFXWideStringConstRef right )
operator+( WChar left , SFXWideStringConstRef right )
operator+( SFXWideStringConstRef left , WChar right )
operator+( WCharConstPtr left , SFXWideStringConstRef right )
operator+( WCharConstPtr left , SFXWideStringConstRef right )
operator+( SFXWideStringConstRef left , WCharConstPtr right )
operator+( SFXWideStringConstRef left , WCharConstPtr right )
operator+( SFXWideStringConstRef left , SFXWideStringConstRef right )
Add string.

SFXWideString::SFXWideString
Constructor of SFXWideString class.
[ public, explicit ]
SFXWideString(Void);
[ public ]
SFXWideString(
    SFXWideStringConstRef string   // source string for copying
);
[ public ]
SFXWideString(
    SFXWideStringConstRef string   // source string for copying
);
[ public ]
SFXWideString(
    WCharConstPtr string   // WChar pointer to Source string for copying
    SInt32 length = -1     // length of string
);
[ public ]
SFXWideString(
    WCharConstPtr string   // WChar pointer to Source string for copying
    SInt32 length = -1     // length of string
);
[ public, explicit ]
SFXWideString(
    WChar character   // WChar string
);
[ public, explicit ]
SFXWideString(
    SFXBufferConstRef buffer   // source buffer for copying
);
[ public, explicit ]
SFXWideString(
    UInt16 threshold   // the mininum value of buffer size
    UInt16 cluster     // cluster size
);

Description

When the SFXWideString class or the SFXWideString class is specified for the constructor of the SFXWideString class, the string is copied.

If the pointer of WChar or WChar is specified, it is interpreted and copied as a null-terminated string.

If the length is specified, binary string contains null can be processed, too.

When WChar is specified, only one character is made.

Reference

SFXWideString::Set | SFXWideString::operator=


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

Description

The internal string buffer is released.


SFXWideString::Add
Add a string
[ public ]
SFCError Add(
    SFXWideStringConstRef string   // string to add
);
[ public ]
SFCError Add(
    WCharConstPtr string   // string to add
    SInt32 length = -1     // length of the string
);
[ public ]
SFCError Add(
    WChar character   // character to add
);

Return value

  • Success : SFERR_NO_ERROR
  • If insufficient : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

The Add function influences the character string. If want to keep the source string, use the Concat() function.

Reference

SFXWideString::Concat | SFXWideString::Sub | SFXWideString::Mul | SFXWideString::operator<< | operator+ | SFXWideString::operator+=


SFXWideString::AsLower
Convert the string into lower characters.
[ public, const ]
SFXWideString AsLower(Void);

Description

The source string will not be modified by calling the AsLower() function.

Reference

SFXWideString::AsUpper | SFXWideString::ToLower


SFXWideString::AsSInt32
Convert the string into SInt32 type.
[ public, const ]
SInt32 AsSInt32(
    SInt32 substitute = 0   // the value when the conversion is failed
);

Description

If unable to convert, a specified value is returned to substitute.

Reference

SFXWideString::AsUInt32


SFXWideString::AsUInt32
Convert the string into UInt32 type.
[ public, const ]
UInt32 AsUInt32(
    UInt32 substitute = 0   // the value when the conversion is failed
);

Description

If unable to convert, a specified value is returned to substitute.

Reference

SFXWideString::AsSInt32


SFXWideString::AsUpper
Convert the string into capital character.
[ public, const ]
SFXWideString AsUpper(Void);

Description

The source string will not be modified by calling the AsUpper() function.

Reference

SFXWideString::AsLower | SFXWideString::ToUpper


SFXWideString::Attach
Delegate the control privilege of specified WChar string to the SFXWideString object.
[ public ]
SFCError Attach(
    WCharPtr string      // string managed by SFXWideString
    SInt32 length = -1   // length of the string
);

Return value

  • Success : SFERR_NO_ERROR
  • If failed : SFERR_INVALID_PARAM

Description

The SFXWideString::Attach function is more efficient than the SFXWideString::Set function, since the WChar string is not copied and the problem on insufficient memory or performance deterioration can be avoided.

The memory allocated to the WChar string will be released automatically when the SFXWideString object is released. To release the memory allocated to the WChar string explicitly, it is necessary to call the SFXWideString::Detach function.

Example

SFXWideString str;
WCharPtr ptr;

// allocate the memory and cast to the WChar string(ptr)
ptr = static_cast<WCharPtr>(MemoryAllocate(10240));

...

// delegate the control privilege of WChar string(ptr) to the SFXWideString object(str)
str.Attach(ptr, 10240);
// hereafter, the WChar string(ptr) will be handled as the SFXWideString object(str)

・・・

// after used, the allocated memory will be released automatically

Reference

SFXWideString::Detach


SFXWideString::AttachSFXBuffer
Delegate the control privilege of specified SFXBuffer object to the SFXWideString object.
[ public ]
SFCError AttachSFXBuffer(
    SFXBufferPtr buffer   // buffer to use
);

Return value

  • Success : SFERR_NO_ERROR
  • If the buffer parameter is null, or failed : SFERR_INVALID_PARAM

Description

The SFXWideString::AttachSFXBuffer function is more efficient than the SFXWideString::Set function, since the SFXBuffer object is not copied and the problem on insufficient memory or performance deterioration can be avoided.

The SFXBuffer object instance will be released automatically when the SFXWideString object is released. To release the SFXBuffer object explicitly, it is necessary to call the SFXWideString::DetachSFXBuffer function.

Example

SFXWideString str;
SFXBuffer buffer;

// allocate the memory for the SFXBuffer object(buffer)
buffer.SetSize(10240);

...

// delegate the control privilege of SFXBuffer object(buffer) to the SFXWideString object(str)
str.AttachSFXBuffer(&buffer);
// hereafter, the SFXBuffer object(buffer) will be handled as the SFXWideString object(str)

・・・

// after used, the allocated memory will be released automatically

Reference

SFXWideString::Attach | SFXWideString::Detach | SFXWideString::DetachSFXBuffer


SFXWideString::Clear
Clear the string.
[ public ]
Void Clear(Void);

Description

It releases the heap.


SFXWideString::Compare
Compare with a specified string by dictionary order.
[ public, const ]
SInt32 Compare(
    SFXWideStringConstRef string   // string to cpmpare with
    Bool sensitive = true          // case-sensitive or not
);
[ public, const ]
SInt32 Compare(
    WCharConstPtr string    // string to cpmpare with
    Bool sensitive = true   // case-sensitive or not
);

Return value

  • If the string is less than the specified string : Minus value
  • If the string equals the specified string : 0
  • If the string is greater than the specified string : Positive value

Reference

SFXWideString::Equals | operator== | operator!=


SFXWideString::Concat
Concatenate with a specified string.
[ public, const ]
SFXWideString Concat(
    SFXWideStringConstRef string   // string to concatenate with
);
[ public, const ]
SFXWideString Concat(
    WCharConstPtr string   // string to concatenate with
    SInt32 length = -1     // length of the string
);
[ public, const ]
SFXWideString Concat(
    WChar character   // character to concatenate with
);

Return value

It returns the concatenated string.

Description

The SFXWideString::Concat function concatenates the end of source string with a specified string. The source string will not be modified.

Reference

SFXWideString::Add | operator+ | SFXWideString::operator+=


SFXWideString::Copy
Overwrite with a specified string.
[ public ]
SFCError Copy(
    SInt32 index                   // starting position to overwrite
    SFXWideStringConstRef string   // string to overwrite with
);
[ public ]
SFCError Copy(
    SInt32 index           // starting position to overwrite
    WCharConstPtr string   // string to overwrite with
    SInt32 length = -1     // length of the string
);

Return value

  • Success : SFERR_NO_ERROR
  • If exceeds the end of source string : SFERR_INVALID_PARAM

Description

If the string after overwriting exceeds the end of source string, the source string is restored and return SFERR_INVALID_PARAM.


SFXWideString::Detach
Delegate the control privilege of the SFXWideString object to the specified WChar string.
[ public ]
WCharPtr Detach(
    SInt32Ptr length = null   // the pointer to the length of the string
);

Return value

Return a WChar string which the SFXWideString object has.

Description

The SFXWideString::Detach function is more efficient than the SFXWideString::GetChar function, since the SFXWideString object is not copied and the problem on insufficient memory or performance deterioration can be avoided.

Example

SFXWideString str;
WCharPtr ptr;
SInt32 length;

str = "The best application for BREW.";

...

// delegate the control privilege of SFXWideString object(str) to the WChar string(ptr)
ptr = str.Detach(&length);
// hereafter, the SFXWideString object will be handled as the WChar string(ptr)

...

// after used, it is necessary to release the memory of WChar string(ptr)
MemoryFree(ptr);

Reference

SFXWideString::Attach


SFXWideString::DetachSFXBuffer
Delegate the control privilege of specified SFXWideString object to the SFXBuffer object.
[ public ]
SFCError DetachSFXBuffer(
    SFXBufferPtr buffer   // pointer to the SFXBuffer object that will be substituted by a string data
);

Return value

  • Success : SFERR_NO_ERROR
  • If the buffer parameter is null, or failed : SFERR_INVALID_PARAM

Description

The SFXWideString object is not copied and the problem on insufficient memory or performance deterioration can be avoided.

Example

SFXWideString str;
SFXBuffer buffer;

str = "The best application for BREW.";

...

// delegate the control privilege of SFXWideString object(str) to the SFXBuffer object(buffer)
str.DetachSFXBuffer(&buffer);  
// hereafter, the SFXWideString object will be handled as the SFXBuffer object(buffer)

・・・

// after used, the SFXBuffer object(buffer) will be released automatically

Reference

SFXWideString::Attach | SFXWideString::AttachSFXBuffer | SFXWideString::Detach


SFXWideString::EmptyInstance
Get an empty string.
[ public, static ]
SFXWideStringConstRef EmptyInstance(Void);

Description

Return the reference to the instance of enpty string as the return value of function.


SFXWideString::EndsWith
Check whether the string ends with a specified string or not.
[ public, const ]
Bool EndsWith(
    SFXWideStringConstRef string   // string to check with
    Bool sensitive = true          // case-sensitive or not
);
[ public, const ]
Bool EndsWith(
    WCharConstPtr string    // string to check with
    Bool sensitive = true   // case-sensitive or not
);
[ public, const ]
Bool EndsWith(
    WChar character         // string to check with
    Bool sensitive = true   // case-sensitive or not
);

Return value

  • If ends with a specified string : true
  • Otherwise : false

Reference

SFXWideString::StartsWith


SFXWideString::Equals
Check whether the string equals the specified string or not.
[ public, const ]
Bool Equals(
    SFXWideStringConstRef string   // string to compare with
    Bool sensitive = true          // case-sensitive or not
);
[ public, const ]
Bool Equals(
    WCharConstPtr string    // string to compare with
    Bool sensitive = true   // case-sensitive or not
);

Return value

  • If equals the specified string : true
  • Otherwise : false

Reference

SFXWideString::Compare | operator== | operator!=


SFXWideString::Fill
Fill the string with specified character.
[ public ]
Void Fill(
    WChar character   // character
);

SFXWideString::FirstIndexOf
Get the first index of SFXWideString object to match with a specified data, searching from the beginning.
[ public, const ]
SInt32 FirstIndexOf(
    SFXWideStringConstRef string    // string to match with
    SInt32 index = SINT32_MINIMUM   // starting index to search from
    Bool sensitive = true           // case-sensitive or not
);
[ public, const ]
SInt32 FirstIndexOf(
    WCharConstPtr string            // string to match with
    SInt32 index = SINT32_MINIMUM   // starting index to search from
    Bool sensitive = true           // case-sensitive or not
);
[ public, const ]
SInt32 FirstIndexOf(
    WChar character                 // character to match with
    SInt32 index = SINT32_MINIMUM   // starting index to search from
    Bool sensitive = true           // case-sensitive or not
);

Return value

  • Success : The first index where found.
  • If failed : -1

Description

To search from other than the beginning, specify the starting index to match with. (The origin index is 0.)

Reference

SFXWideString::LastIndexOf


SFXWideString::Format
Create a string by using the format.
[ public, static ]
SFXWideString Format(
    va_ref< SFXWideStringConst > format   // string that represents a format
    ...                                   // data
);
[ public, static ]
SFXWideString Format(
    va_ref< SFXWideStringConst > format   // string that represents a format
    ...                                   // data
);
[ public, static ]
SFXWideString Format(
    WCharConstPtr format   // string that represents a format
    ...                    // data
);
[ public, static ]
SFXWideString Format(
    WCharConstPtr format   // string that represents a format
    ...                    // data
);

Description

The SFXWideString::Format function is almost the same as the printf function in C language, the format on float is not available.

Example

SIntN year = 2003;
SIntN month = 8;
SFXWideString str = SFXWideString::Format("%d Year %d Month ", year, month);

Reference

BREW API VSNPRINTF


SFXWideString::FormatV
Create a string by using the format with a variable-length argument.
[ public, static ]
SFXWideString FormatV(
    SFXWideStringConstRef format   // string that represents a format
    va_list argument               // variable-length argument
);
[ public, static ]
SFXWideString FormatV(
    SFXWideStringConstRef format   // string that represents a format
    va_list argument               // variable-length argument
);
[ public, static ]
SFXWideString FormatV(
    WCharConstPtr format   // string that represents a format
    va_list argument       // variable-length argument
);
[ public, static ]
SFXWideString FormatV(
    WCharConstPtr format   // string that represents a format
    va_list argument       // variable-length argument
);

Description