All Classes Functions Variables Typedefs Friends Pages
Public Member Functions | List of all members
Glympse::IString Struct Referenceabstract

An immutable sequence of characters/code units. More...

#include <IString.h>

Inheritance diagram for Glympse::IString:
Inheritance graph
[legend]

Public Member Functions

virtual int32 length ()=0
 Returns the size of this string. More...
 
virtual GString trim ()=0
 Copies this string removing white space characters from the beginning and end of the string. More...
 
virtual unichar charAt (int32 index)=0
 Returns the character at the specified offset in this string. More...
 
virtual int32 indexOf (char seperator)=0
 Searches in this string for the first index of the specified character. More...
 
virtual int32 indexOf (char seperator, int32 start)=0
 Searches in this string for the first index of the specified character. More...
 
virtual int32 indexOf (const GString &str)=0
 Searches in this string for the index of the specified string. More...
 
virtual int32 indexOf (const char *str, int32 start)=0
 Searches in this string for the index of the specified string. More...
 
virtual int32 indexOf (const GString &str, int32 start)=0
 Searches in this string for the index of the specified string. More...
 
virtual int32 lastIndexOf (char seperator)=0
 Returns the last index of the code point c, or -1. More...
 
virtual GString append (const char *str)=0
 Appends the string to current string and returns new string. More...
 
virtual GString append (const GString &str)=0
 This method is provided for convenience. More...
 
virtual bool startsWith (const char *prefix)=0
 Compares the specified string to this string to determine if the specified string is a prefix. More...
 
virtual bool startsWith (const GString &prefix)=0
 Compares the specified string to this string to determine if the specified string is a prefix. More...
 
virtual bool endsWith (const char *suffix)=0
 Compares the specified string to this string to determine if the specified string is a suffix. More...
 
virtual bool endsWith (const GString &suffix)=0
 This method is provided for convenience. More...
 
virtual GArray< GString >::ptr split (const char *separator)=0
 Splits this string using the supplied str. More...
 
virtual GArray< GString >::ptr split (const GString &str)=0
 This method is provided for convenience. More...
 
virtual GString replace (const char *target, const char *replacement)=0
 Copies this string replacing occurrences of the specified target sequence with another sequence. More...
 
virtual GString replace (const GString &target, const GString &replacement)=0
 This method is provided for convenience. More...
 
virtual GString toLowerCase ()=0
 Converts this string to lower case, using the rules of the user's default locale. More...
 
virtual bool equals (const char *str)=0
 Compares the specified string to this string and returns true if they are equal. More...
 
virtual bool equals (const GString &str)=0
 This method is provided for convenience. More...
 
virtual bool equals (const GCommon &obj)=0
 This method is provided for convenience. More...
 
virtual bool equalsIgnoreCase (const char *str)=0
 Compares the specified string to this string ignoring the case of the characters and returns true if they are equal. More...
 
virtual bool equalsIgnoreCase (const GString &str)=0
 This method is provided for convenience. More...
 
virtual int32 compareTo (const GString &str)=0
 Compares the specified string to this string using the Unicode values of the characters. More...
 
virtual const char * getBytes ()=0
 Provides access to the array containing the characters of this string. More...
 
virtual const char * toCharArray ()=0
 This method is provided for convenience. More...
 
- Public Member Functions inherited from Glympse::ICommon
virtual int32 retain ()=0
 Add a reference to our object in a COM-like way.
 
virtual int32 release ()=0
 Release a reference to our object in a COM-like way.
 
virtual int32 hold ()=0
 Add a reference to our object in a COM-like way.
 
virtual int32 unhold ()=0
 Release a reference to our object in a COM-like way.
 
virtual int32 hashCode ()=0
 Returns an integer hash code for this object.
 
virtual GString toString ()=0
 Returns a string containing a concise, human-readable description of this object. More...
 
virtual void attachObject (const GCommon &obj)=0
 Asociates arbitrary object with the instance.
 
virtual GCommon extractObject ()=0
 Extracts associated object or NULL if no association is established.
 

Additional Inherited Members

- Protected Member Functions inherited from Glympse::ICommon
virtual ~ICommon ()
 Destructor is protected to deny explicit object deallocation. More...
 

Detailed Description

An immutable sequence of characters/code units.

A string is represented by array of UTF-8 values.

Member Function Documentation

virtual GString Glympse::IString::append ( const char *  str)
pure virtual

Appends the string to current string and returns new string.

Parameters
strthe string to append to current string.
Returns
a new string containing a concatenation of current string and the argument.
virtual GString Glympse::IString::append ( const GString str)
pure virtual

This method is provided for convenience.

See append(const char*) for more details.

virtual unichar Glympse::IString::charAt ( int32  index)
pure virtual

Returns the character at the specified offset in this string.

Parameters
indexthe zero-based index in this string.
Returns
Returns the character at the index.
virtual int32 Glympse::IString::compareTo ( const GString str)
pure virtual

Compares the specified string to this string using the Unicode values of the characters.

Returns 0 if the strings contain the same characters in the same order. Returns a negative integer if the first non-equal character in this string has a Unicode value which is less than the Unicode value of the character at the same position in the specified string, or if this string is a prefix of the specified string. Returns a positive integer if the first non-equal character in this string has a Unicode value which is greater than the Unicode value of the character at the same position in the specified string, or if the specified string is a prefix of this string.

Parameters
strthe string to compare.
Returns
0 if the strings are equal, a negative integer if this string is before the specified string, or a positive integer if this string is after the specified string.
virtual bool Glympse::IString::endsWith ( const char *  suffix)
pure virtual

Compares the specified string to this string to determine if the specified string is a suffix.

Parameters
suffixthe suffix to look for.
Returns
true if the specified string is a suffix of this string, false otherwise.
virtual bool Glympse::IString::endsWith ( const GString suffix)
pure virtual

This method is provided for convenience.

See endsWith(const char*) for more details.

virtual bool Glympse::IString::equals ( const char *  str)
pure virtual

Compares the specified string to this string and returns true if they are equal.

Parameters
strthe string to compare.
Returns
true if the specified string is equal to this string, false otherwise.
virtual bool Glympse::IString::equals ( const GString str)
pure virtual

This method is provided for convenience.

See equals(const char*) for more details.

virtual bool Glympse::IString::equals ( const GCommon obj)
pure virtual

This method is provided for convenience.

See equals(const char*) for more details.

Implements Glympse::ICommon.

virtual bool Glympse::IString::equalsIgnoreCase ( const char *  str)
pure virtual

Compares the specified string to this string ignoring the case of the characters and returns true if they are equal.

Parameters
strthe string to compare.
Returns
true if the specified string is equal to this string, false otherwise.
virtual bool Glympse::IString::equalsIgnoreCase ( const GString str)
pure virtual

This method is provided for convenience.

See equalsIgnoreCase(const char*) for more details.

virtual const char* Glympse::IString::getBytes ( )
pure virtual

Provides access to the array containing the characters of this string.

The array contains string representation in UTF-8 encoding.

You should never modify contents of the returned array.

Returns
a character array containing the characters of this string.
virtual int32 Glympse::IString::indexOf ( char  seperator)
pure virtual

Searches in this string for the first index of the specified character.

The search for the character starts at the beginning and moves towards the end of this string.

Parameters
seperatorthe character to find.
Returns
the index in this string of the specified character, -1 if the character isn't found.
virtual int32 Glympse::IString::indexOf ( char  seperator,
int32  start 
)
pure virtual

Searches in this string for the first index of the specified character.

The search for the character starts at the beginning and moves towards the end of this string.

Parameters
seperatorthe character to find.
startthe starting offset.
Returns
the index in this string of the specified character, -1 if the character isn't found.
virtual int32 Glympse::IString::indexOf ( const GString str)
pure virtual

Searches in this string for the index of the specified string.

The search for the string starts at the beginning and moves towards the end of this string.

Parameters
strthe string to find.
Returns
Returns the index of the first character of the specified string in this string, -1 if the specified string is not a substring.
virtual int32 Glympse::IString::indexOf ( const char *  str,
int32  start 
)
pure virtual

Searches in this string for the index of the specified string.

The search for the string starts at the specified offset and moves towards the end of this string.

Parameters
strthe string to find.
startthe starting offset.
Returns
Returns the index of the first character of the specified string in this string, -1 if the specified string is not a substring.
virtual int32 Glympse::IString::indexOf ( const GString str,
int32  start 
)
pure virtual

Searches in this string for the index of the specified string.

The search for the string starts at the specified offset and moves towards the end of this string.

Parameters
strthe string to find.
startthe starting offset.
Returns
Returns the index of the first character of the specified string in this string, -1 if the specified string is not a substring.
virtual int32 Glympse::IString::lastIndexOf ( char  seperator)
pure virtual

Returns the last index of the code point c, or -1.

The search for the character starts at the end and moves towards the beginning of this string.

Parameters
seperatorthe character to find.
Returns
the index in this string of the specified character, -1 if the character isn't found.
virtual int32 Glympse::IString::length ( )
pure virtual

Returns the size of this string.

For strings having unicode characters, it returns a number of bytes occupied by a string representation in UTF-8 encoding.

Returns
the number of characters in this string.
virtual GString Glympse::IString::replace ( const char *  target,
const char *  replacement 
)
pure virtual

Copies this string replacing occurrences of the specified target sequence with another sequence.

The string is processed from the beginning to the end.

Parameters
targetthe sequence to replace.
replacementthe replacement sequence.
Returns
Returns the resulting string.
virtual GString Glympse::IString::replace ( const GString target,
const GString replacement 
)
pure virtual

This method is provided for convenience.

See replace(const char*, const char*) for more details.

virtual GArray<GString>::ptr Glympse::IString::split ( const char *  separator)
pure virtual

Splits this string using the supplied str.

Returns
an array of substrings if this instance is delimited by one or more of the characters in separator. an array consisting of a single element containing this instance, if this instance contains none of the characters in separator.
virtual GArray<GString>::ptr Glympse::IString::split ( const GString str)
pure virtual

This method is provided for convenience.

See split(const char*) for more details.

virtual bool Glympse::IString::startsWith ( const char *  prefix)
pure virtual

Compares the specified string to this string to determine if the specified string is a prefix.

Parameters
prefixthe prefix to look for.
Returns
true if the specified string is a prefix of this string, false otherwise.
virtual bool Glympse::IString::startsWith ( const GString prefix)
pure virtual

Compares the specified string to this string to determine if the specified string is a prefix.

Parameters
prefixthe prefix to look for.
Returns
true if the specified string is a prefix of this string, false otherwise.
virtual const char* Glympse::IString::toCharArray ( )
pure virtual

This method is provided for convenience.

See getBytes() for more details.

virtual GString Glympse::IString::toLowerCase ( )
pure virtual

Converts this string to lower case, using the rules of the user's default locale.

Returns
Returns a new lower case string, or this if it's already all lower case.
virtual GString Glympse::IString::trim ( )
pure virtual

Copies this string removing white space characters from the beginning and end of the string.

Returns
a new string with characters <= \u0020 removed from the beginning and the end.

The documentation for this struct was generated from the following file: