version 1.39.2.7, 2001/12/04 16:35:46
|
version 1.40, 2001/11/06 16:26:14
|
|
|
*/ | */ |
Uint32 size() const { return _rep.size() - 1; } | Uint32 size() const { return _rep.size() - 1; } |
| |
/** getData Returns a pointer to the first character in the |
/** Returns a pointer to the first character in the null-terminated string |
null-terminated string string of the String object. |
string. |
@return Pointer to the first character of the String object | @return Pointer to the first character of the String object |
<pre> | <pre> |
String t1 = "abc"; | String t1 = "abc"; |
|
|
*/ | */ |
const Char16* getData() const { return _rep.getData(); } | const Char16* getData() const { return _rep.getData(); } |
| |
/** AallocateCString - llocates an 8 bit representation of this String |
/** AallocateCString - llocates an 8 bit representation of this string. The |
object. The user is responsible for freeing the result. If any |
user is |
characters are truncated, a TruncatedCharacter exception is thrown. |
responsible for freeing the result. If any characters are truncated, |
This exception may be suppressed by passing true as the noThrow |
a TruncatedCharacter exception is thrown. This exception may |
argument. Extra characters may be allocated at the end of the |
be suppressed by passing true as the noThrow argument. Extra |
new string by passing a non-zero value to the extraBytes argument. |
characters may be allocated at the end of the new string by |
|
passing a non-zero value to the extraBytes argument. |
@param extraBytes Defines the number of extra characters to be | @param extraBytes Defines the number of extra characters to be |
allocated at the end of the new string. Default is zero. | allocated at the end of the new string. Default is zero. |
|
|
@param noThrow If true, no exception will be thrown if characters | @param noThrow If true, no exception will be thrown if characters |
are truncated | are truncated |
|
|
@return pointer to the new representation of the string | @return pointer to the new representation of the string |
|
|
@exception Throws TruncatedCharacter exception if any characters are | @exception Throws TruncatedCharacter exception if any characters are |
truncated | truncated |
<pre> | <pre> |
|
|
*/ | */ |
char* allocateCString(Uint32 extraBytes = 0, Boolean noThrow = false) const; | char* allocateCString(Uint32 extraBytes = 0, Boolean noThrow = false) const; |
| |
/** appendToCString - Append the given String object to a C-string. If the |
/** appendToCString - Append the given string to a C-string. If the length |
length is not PEG_NOT_FOUND, then the lesser of the the length argument |
is not PEG_NOT_FOUND, then the lesser of the the length argument and the |
and he length of this string is truncated. Otherwise, the entire string |
length of this string is truncated. Otherwise, the entire string is |
is trunctated. The TruncatedCharacter exception is thrown if any |
trunctated. The TruncatedCharacter exception is thrown if any characters |
characters are truncated. |
are truncated. |
@param str Char pointer to the string to append | @param str Char pointer to the string to append |
@param length Length to append or PEG_NOT_FOUND (Uint32(-1) | @param length Length to append or PEG_NOT_FOUND (Uint32(-1) |
@param noThrow - If false, throw the "TruncatedCharacter" exception of | @param noThrow - If false, throw the "TruncatedCharacter" exception of |
|
|
*/ | */ |
Uint32 find(Char16 c) const; | Uint32 find(Char16 c) const; |
| |
/** Same as above but starts searching from the given position. */ |
|
Uint32 find(Uint32 pos, Char16 c) const; |
|
| |
/** Find the position of the first occurence of the string object. | /** Find the position of the first occurence of the string object. |
This function finds one string inside another | This function finds one string inside another |
|
|
*/ | */ |
static int compareNoCase(const char* s1, const char* s2, Uint32 n); | static int compareNoCase(const char* s1, const char* s2, Uint32 n); |
| |
static int compareNoCase(const char* s1, const char* s2); |
|
|
|
/** Compare two null-terminated strings. | /** Compare two null-terminated strings. |
@param s1 First null-terminated string for the comparison. | @param s1 First null-terminated string for the comparison. |
@param s2 Second null-terminated string for the comparison. | @param s2 Second null-terminated string for the comparison. |
|
|
*/ | */ |
static const String EMPTY; | static const String EMPTY; |
| |
/** Return true if the str parameter matches the pattern. C-Shell style |
static Uint32 _pegasusMin(Uint32 x, Uint32 y) |
glob matching is used. |
{ |
*/ |
return x < y ? x : y; |
static Boolean match(const String& str, const String& pattern); |
} |
|
|
/** Return true if the str parameter matches the pattern. C-Shell style |
|
glob matching is used. Ignore case in all comparisons. |
|
*/ |
|
static Boolean matchNoCase(const String& str, const String& pattern); |
|
| |
private: | private: |
| |
static Uint32 PEG_min(Uint32 x, Uint32 y) { return x < y ? x : y; } |
|
|
|
Array<Char16> _rep; | Array<Char16> _rep; |
}; | }; |
| |
|
|
/** String operator ==. Test for equality between two strings of any of the | /** String operator ==. Test for equality between two strings of any of the |
types String or char*. | types String or char*. |
@return Boolean - True if the strings are equal | @return Boolean - True if the strings are equal |
|
|
*/ | */ |
PEGASUS_COMMON_LINKAGE int CompareNoCase(const char* s1, const char* s2); | PEGASUS_COMMON_LINKAGE int CompareNoCase(const char* s1, const char* s2); |
| |
inline int EqualNoCase(const char* s1, const char* s2) |
|
{ |
|
return CompareNoCase(s1, s2) == 0; |
|
} |
|
|
|
/** Get the next line from the input file. | /** Get the next line from the input file. |
*/ | */ |
PEGASUS_COMMON_LINKAGE Boolean GetLine(PEGASUS_STD(istream)& is, String& line); | PEGASUS_COMMON_LINKAGE Boolean GetLine(PEGASUS_STD(istream)& is, String& line); |