Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

UText Class Reference

Inheritance diagram for UText:

ICU IReadable IWritable UString List of all members.

Public Types

enum  CaseOption { Default = 0, SpecialI = 1 }

Public Member Functions

 this (wchar[] content)
package wchar[] get ()
override int opEquals (Object o)
override int opCmp (Object o)
override uint toHash ()
UString copy ()
UString extract (uint start, uint len=uint.max)
uint codePoints (uint start=0, uint length=uint.max)
bool hasSurrogates (uint start=0, uint length=uint.max)
wchar charAt (uint index)
uint length ()
uint compare (UString other, bool codePointOrder=false)
uint compare (wchar[] other, bool codePointOrder=false)
uint compareFolded (UString other, CaseOption option=CaseOption.Default)
uint compareFolded (wchar[] other, CaseOption option=CaseOption.Default)
bool startsWith (UText other)
bool startsWith (wchar[] chars)
bool endsWith (UText other)
bool endsWith (wchar[] chars)
uint indexOf (wchar c, uint start=0)
uint indexOf (UText other, uint start=0)
uint indexOf (wchar[] chars, uint start=0)
uint lastIndexOf (wchar c, uint start=uint.max)
uint lastIndexOf (UText other, uint start=uint.max)
uint lastIndexOf (wchar[] chars, uint start=uint.max)
UString toLower ()
UString toLower (inout ULocale locale)
UString toUpper ()
UString toUpper (inout ULocale locale)
UString toFolded (CaseOption option=CaseOption.Default)
UString unEscape ()
private void pinIndex (inout uint x)
private void pinIndices (inout uint start, inout uint length)
private uint compareFolded (wchar[] s1, wchar[] s2, CaseOption option=CaseOption.Default)
private UString caseConvert (UString.Formatter cvt)

Public Attributes

package uint len
package wchar[] content

Private Types

typedef void * Handle
enum  Error { OK, BufferOverflow = 15 }

Private Member Functions

 this ()
void read (IReader r)
void write (IWriter w)

Static Private Member Functions

void test ()
bool isError (Error e)
void testError (Error e, char[] msg)
char * toString (char[] string)
wchar * toString (wchar[] string)
uint length (char *s)
uint length (wchar *s)
char[] toArray (char *s)
wchar[] toArray (wchar *s)

Private Attributes

bool mutable

Detailed Description

Immutable (read-only) text -- use UString for mutable strings.

Definition at line 530 of file UString.d.


Member Typedef Documentation

typedef void* Handle [protected, inherited]
 

Use this for the primary argument-type to most ICU functions

Definition at line 109 of file ICU.d.


Member Enumeration Documentation

enum CaseOption
 

Enumeration values:
Default 
SpecialI 

Definition at line 545 of file UString.d.

enum Error [protected, inherited]
 

ICU error codes (the ones which are referenced)

Enumeration values:
OK 
BufferOverflow 

Definition at line 117 of file ICU.d.


Member Function Documentation

this  )  [inline, private]
 

Hidden constructor

Definition at line 557 of file UString.d.

this wchar[]  content  )  [inline]
 

Construct read-only wrapper around the given content

Definition at line 567 of file UString.d.

package wchar [] get  )  [inline]
 

Return the valid content from this UText

Definition at line 599 of file UString.d.

Referenced by UList::add(), UString::append(), compare(), endsWith(), UTimeZone::getDefault(), indexOf(), lastIndexOf(), UDecimalFormat::setPattern(), UMessageFormat::setPattern(), UDateFormat::setPattern(), UString::setTo(), and startsWith().

override int opEquals Object  o  )  [inline]
 

Is this UText equal to another?

Definition at line 610 of file UString.d.

References content, and len.

override int opCmp Object  o  )  [inline]
 

Compare this UText to another.

Definition at line 626 of file UString.d.

References content, and len.

override uint toHash  )  [inline]
 

Hash this UText

Definition at line 642 of file UString.d.

UString copy  )  [inline]
 

Clone this UText into a UString

Definition at line 653 of file UString.d.

References UString.

UString extract uint  start,
uint  len = uint.max
[inline]
 

Clone a section of this UText into a UString

Definition at line 664 of file UString.d.

References pinIndices(), and UString.

uint codePoints uint  start = 0,
uint  length = uint.max
[inline]
 

Count unicode code points in the length UChar code units of the string. A code point may occupy either one or two UChar code units. Counting code points involves reading all code units.

Definition at line 679 of file UString.d.

References pinIndices().

Referenced by hasSurrogates().

bool hasSurrogates uint  start = 0,
uint  length = uint.max
[inline]
 

Return an indication whether or not there are surrogate pairs within the string.

Definition at line 692 of file UString.d.

References codePoints(), and pinIndices().

wchar charAt uint  index  )  [inline]
 

Return the character at the specified position.

Definition at line 704 of file UString.d.

Referenced by UString::trim(), and unEscape().

uint length  )  [inline]
 

Return the length of the valid content

Definition at line 715 of file UString.d.

Referenced by UDecimalFormat::setPattern(), and UDateFormat::setPattern().

uint compare UString  other,
bool  codePointOrder = false
[inline]
 

The comparison can be done in code unit order or in code point order. They differ only in UTF-16 when comparing supplementary code points (U+10000..U+10ffff) to BMP code points near the end of the BMP (i.e., U+e000..U+ffff).

In code unit order, high BMP code points sort after supplementary code points because they are stored as pairs of surrogates which are at U+d800..U+dfff.

Definition at line 733 of file UString.d.

References get().

uint compare wchar[]  other,
bool  codePointOrder = false
[inline]
 

The comparison can be done in code unit order or in code point order. They differ only in UTF-16 when comparing supplementary code points (U+10000..U+10ffff) to BMP code points near the end of the BMP (i.e., U+e000..U+ffff).

In code unit order, high BMP code points sort after supplementary code points because they are stored as pairs of surrogates which are at U+d800..U+dfff.

Definition at line 751 of file UString.d.

uint compareFolded UString  other,
CaseOption  option = CaseOption.Default
[inline]
 

The comparison can be done in UTF-16 code unit order or in code point order. They differ only when comparing supplementary code points (U+10000..U+10ffff) to BMP code points near the end of the BMP (i.e., U+e000..U+ffff).

In code unit order, high BMP code points sort after supplementary code points because they are stored as pairs of surrogates which are at U+d800..U+dfff.

Definition at line 769 of file UString.d.

References content.

Referenced by compareFolded(), endsWith(), and startsWith().

uint compareFolded wchar[]  other,
CaseOption  option = CaseOption.Default
[inline]
 

The comparison can be done in UTF-16 code unit order or in code point order. They differ only when comparing supplementary code points (U+10000..U+10ffff) to BMP code points near the end of the BMP (i.e., U+e000..U+ffff).

In code unit order, high BMP code points sort after supplementary code points because they are stored as pairs of surrogates which are at U+d800..U+dfff.

Definition at line 787 of file UString.d.

References compareFolded().

bool startsWith UText  other  )  [inline]
 

Does this UText start with specified string?

Definition at line 798 of file UString.d.

References get().

bool startsWith wchar[]  chars  )  [inline]
 

Does this UText start with specified string?

Definition at line 809 of file UString.d.

References compareFolded().

bool endsWith UText  other  )  [inline]
 

Does this UText end with specified string?

Definition at line 822 of file UString.d.

References get().

bool endsWith wchar[]  chars  )  [inline]
 

Does this UText end with specified string?

Definition at line 833 of file UString.d.

References compareFolded().

uint indexOf wchar  c,
uint  start = 0
[inline]
 

Find the first occurrence of a BMP code point in a string. A surrogate code point is found only if its match in the text is not part of a surrogate pair.

Definition at line 848 of file UString.d.

References pinIndex().

Referenced by indexOf(), and test().

uint indexOf UText  other,
uint  start = 0
[inline]
 

Find the first occurrence of a substring in a string.

The substring is found at code point boundaries. That means that if the substring begins with a trail surrogate or ends with a lead surrogate, then it is found only if these surrogates stand alone in the text. Otherwise, the substring edge units would be matched against halves of surrogate pairs.

Definition at line 869 of file UString.d.

References get(), and indexOf().

uint indexOf wchar[]  chars,
uint  start = 0
[inline]
 

Find the first occurrence of a substring in a string.

The substring is found at code point boundaries. That means that if the substring begins with a trail surrogate or ends with a lead surrogate, then it is found only if these surrogates stand alone in the text. Otherwise, the substring edge units would be matched against halves of surrogate pairs.

Definition at line 886 of file UString.d.

References pinIndex().

uint lastIndexOf wchar  c,
uint  start = uint.max
[inline]
 

Find the last occurrence of a BMP code point in a string. A surrogate code point is found only if its match in the text is not part of a surrogate pair.

Definition at line 903 of file UString.d.

References pinIndex().

Referenced by lastIndexOf().

uint lastIndexOf UText  other,
uint  start = uint.max
[inline]
 

Find the last occurrence of a BMP code point in a string. A surrogate code point is found only if its match in the text is not part of a surrogate pair.

Definition at line 920 of file UString.d.

References get(), and lastIndexOf().

uint lastIndexOf wchar[]  chars,
uint  start = uint.max
[inline]
 

Find the last occurrence of a substring in a string.

The substring is found at code point boundaries. That means that if the substring begins with a trail surrogate or ends with a lead surrogate, then it is found only if these surrogates stand alone in the text. Otherwise, the substring edge units would be matched against halves of surrogate pairs.

Definition at line 937 of file UString.d.

References pinIndex().

UString toLower  )  [inline]
 

Lowercase the characters into a seperate UString.

Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original.

Definition at line 955 of file UString.d.

UString toLower inout ULocale  locale  )  [inline]
 

Lowercase the characters into a seperate UString.

Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original.

Definition at line 969 of file UString.d.

References caseConvert(), and ICU::toString().

UString toUpper  )  [inline]
 

Uppercase the characters into a seperate UString.

Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original.

Definition at line 988 of file UString.d.

Referenced by test().

UString toUpper inout ULocale  locale  )  [inline]
 

Uppercase the characters into a seperate UString.

Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original.

Definition at line 1002 of file UString.d.

References caseConvert(), and ICU::toString().

UString toFolded CaseOption  option = CaseOption.Default  )  [inline]
 

Case-fold the characters into a seperate UString.

Case-folding is locale-independent and not context-sensitive, but there is an option for whether to include or exclude mappings for dotted I and dotless i that are marked with 'I' in CaseFolding.txt. The result may be longer or shorter than the original.

Definition at line 1024 of file UString.d.

References caseConvert().

UString unEscape  )  [inline]
 

Unescape a string of characters and write the resulting Unicode characters to the destination buffer. The following escape sequences are recognized:

uhhhh 4 hex digits; h in [0-9A-Fa-f] Uhhhhhhhh 8 hex digits xhh 1-2 hex digits x{h...} 1-8 hex digits ooo 1-3 octal digits; o in [0-7] cX control-X; X is masked with 0x1F

as well as the standard ANSI C escapes:

a => U+0007, \b => U+0008, \t => U+0009, \n => U+000A, v => U+000B, \f => U+000C, \r => U+000D, \e => U+001B, \" =U+0022, \' => U+0027, \? => U+003F, \\ => U+005C

Anything else following a backslash is generically escaped. For example, "[a\\-z]" returns "[a-z]".

If an escape sequence is ill-formed, this method returns an empty string. An example of an ill-formed sequence is "\\u" followed by fewer than 4 hex digits.

Definition at line 1062 of file UString.d.

References UString::append(), charAt(), UString::truncate(), and UString.

Referenced by test().

private void pinIndex inout uint  x  )  [inline]
 

Pin the given index to a valid position.

Definition at line 1107 of file UString.d.

Referenced by indexOf(), lastIndexOf(), and UString::setCharAt().

private void pinIndices inout uint  start,
inout uint  length
[inline]
 

Pin the given index and length to a valid position.

Definition at line 1119 of file UString.d.

Referenced by UString::append(), codePoints(), extract(), hasSurrogates(), UString::remove(), and UString::setTo().

private uint compareFolded wchar[]  s1,
wchar[]  s2,
CaseOption  option = CaseOption.Default
[inline]
 

Helper for comparison methods

Definition at line 1134 of file UString.d.

References ICU::testError().

private UString caseConvert UString.Formatter  cvt  )  [inline]
 

Helper for conversion methods

Definition at line 1149 of file UString.d.

References UString::format(), and UString.

Referenced by toFolded(), toLower(), and toUpper().

void test  )  [inline, static, private]
 

Definition at line 1231 of file UString.d.

References indexOf(), UString::padLeading(), UString::padTrailing(), toUpper(), UString::trim(), unEscape(), and UString.

bool isError Error  e  )  [inline, static, protected, inherited]
 

Definition at line 127 of file ICU.d.

Referenced by UConverter::detectSignature(), UString::format(), and UConverter::this().

void testError Error  e,
char[]  msg
[inline, static, protected, inherited]
 

Definition at line 145 of file ICU.d.

Referenced by UCalendar::add(), compareFolded(), UConverter::decode(), UConverter::encode(), UResourceBundle::get(), UCalendar::get(), UResourceBundle::getBinary(), UResourceBundle::getInt(), UResourceBundle::getIntVector(), UCalendar::getLimit(), UResourceBundle::getLocale(), UCalendar::getMillis(), UConverter::getName(), UResourceBundle::getNextString(), UResourceBundle::getString(), UDateFormat::getTwoDigitYearStart(), UCalendar::inDaylightTime(), UDateFormat::parse(), UCalendar::roll(), UCalendar::setDate(), UCalendar::setDateTime(), UCalendar::setMillis(), UDecimalFormat::setPattern(), UMessageFormat::setPattern(), UCalendar::setTimeZone(), UDateFormat::setTwoDigitYearStart(), UResourceBundle::this(), UNumberFormat::this(), UMessageFormat::this(), UDateFormat::this(), and UCalendar::this().

char* toString char[]  string  )  [inline, static, protected, inherited]
 

Definition at line 155 of file ICU.d.

Referenced by UConverter::compareNames(), UResourceBundle::getResource(), UResourceBundle::getString(), UCalendar::getTimeZoneName(), UMessageFormat::setLocale(), UResourceBundle::this(), UMessageFormat::this(), UDateFormat::this(), toLower(), ICU::toString(), and toUpper().

wchar* toString wchar[]  string  )  [inline, static, protected, inherited]
 

Definition at line 175 of file ICU.d.

References ICU::toString().

uint length char *  s  )  [inline, static, protected, inherited]
 

Definition at line 184 of file ICU.d.

References strlen().

uint length wchar *  s  )  [inline, static, protected, inherited]
 

Definition at line 193 of file ICU.d.

References wcslen().

char [] toArray char *  s  )  [inline, static, protected, inherited]
 

Definition at line 202 of file ICU.d.

References strlen().

Referenced by UConverter::detectSignature(), UResourceBundle::getKey(), UResourceBundle::getLocale(), UMessageFormat::getLocale(), and UConverter::getName().

wchar [] toArray wchar *  s  )  [inline, static, protected, inherited]
 

Definition at line 213 of file ICU.d.

References wcslen().

void read IReader  r  )  [inherited]
 

Reimplemented in Payload, InvalidatorPayload, Message, Task, Channel, RollCall, ReaderToken, and LineScanner.

Referenced by AbstractReader::get(), testClassIO(), testClassSerialization(), testCompositeIO(), and testRemoteCacheLoader().

void write IWriter  w  )  [inherited]
 

Reimplemented in Payload, InvalidatorPayload, Message, Task, Channel, RollCall, ResponseLine, Cookie, HttpCookies, HttpMessage, HttpRequest, HttpResponse, HttpTokens, NewlineWriter, FilePath, Token, and Uri.

Referenced by PickleWriter::freeze(), HttpClient::open(), AbstractWriter::put(), testClassIO(), testClassSerialization(), testCompositeIO(), testRemoteCacheLoader(), and HttpRequest::write().


Member Data Documentation

package uint len
 

Definition at line 535 of file UString.d.

Referenced by opCmp(), opEquals(), UDateFormat::parse(), UNumberFormat::parseDouble(), UNumberFormat::parseInteger(), UNumberFormat::parseLong(), and UMessageFormat::setPattern().

package wchar [] content
 

Definition at line 536 of file UString.d.

Referenced by UString::append(), compareFolded(), opCmp(), opEquals(), UDateFormat::parse(), UNumberFormat::parseDouble(), UNumberFormat::parseInteger(), UNumberFormat::parseLong(), and UString::setTo().

bool mutable [private]
 

Definition at line 542 of file UString.d.


The documentation for this class was generated from the following file:
Generated on Sun Nov 7 19:07:14 2004 for Mango by doxygen 1.3.6