ICU 4.8.1.1
4.8.1.1
|
Builder class for UCharsTrie. More...
#include <ucharstriebuilder.h>
Data Structures | |
class | UCTLinearMatchNode |
Public Member Functions | |
UCharsTrieBuilder (UErrorCode &errorCode) | |
Constructs an empty builder. | |
virtual | ~UCharsTrieBuilder () |
Destructor. | |
UCharsTrieBuilder & | add (const UnicodeString &s, int32_t value, UErrorCode &errorCode) |
Adds a (string, value) pair. | |
UCharsTrie * | build (UStringTrieBuildOption buildOption, UErrorCode &errorCode) |
Builds a UCharsTrie for the add()ed data. | |
UnicodeString & | buildUnicodeString (UStringTrieBuildOption buildOption, UnicodeString &result, UErrorCode &errorCode) |
Builds a UCharsTrie for the add()ed data and UChar-serializes it. | |
UCharsTrieBuilder & | clear () |
Removes all (string, value) pairs. |
Builder class for UCharsTrie.
This class is not intended for public subclassing.
Definition at line 33 of file ucharstriebuilder.h.
UCharsTrieBuilder::UCharsTrieBuilder | ( | UErrorCode & | errorCode | ) |
Constructs an empty builder.
errorCode | Standard ICU error code. |
virtual UCharsTrieBuilder::~UCharsTrieBuilder | ( | ) | [virtual] |
Destructor.
UCharsTrieBuilder& UCharsTrieBuilder::add | ( | const UnicodeString & | s, |
int32_t | value, | ||
UErrorCode & | errorCode | ||
) |
Adds a (string, value) pair.
The string must be unique. The string contents will be copied; the builder does not keep a reference to the input UnicodeString or its buffer.
s | The input string. |
value | The value associated with this string. |
errorCode | Standard ICU error code. Its input value must pass the U_SUCCESS() test, or else the function returns immediately. Check for U_FAILURE() on output or use with function chaining. (See User Guide for details.) |
UCharsTrie* UCharsTrieBuilder::build | ( | UStringTrieBuildOption | buildOption, |
UErrorCode & | errorCode | ||
) |
Builds a UCharsTrie for the add()ed data.
Once built, no further data can be add()ed until clear() is called.
This method passes ownership of the builder's internal result array to the new trie object. Another call to any build() variant will re-serialize the trie. After clear() has been called, a new array will be used as well.
buildOption | Build option, see UStringTrieBuildOption. |
errorCode | Standard ICU error code. Its input value must pass the U_SUCCESS() test, or else the function returns immediately. Check for U_FAILURE() on output or use with function chaining. (See User Guide for details.) |
UnicodeString& UCharsTrieBuilder::buildUnicodeString | ( | UStringTrieBuildOption | buildOption, |
UnicodeString & | result, | ||
UErrorCode & | errorCode | ||
) |
Builds a UCharsTrie for the add()ed data and UChar-serializes it.
Once built, no further data can be add()ed until clear() is called.
Multiple calls to buildUnicodeString() set the UnicodeStrings to the builder's same UChar array, without rebuilding. If buildUnicodeString() is called after build(), the trie will be re-serialized into a new array. If build() is called after buildUnicodeString(), the trie object will become the owner of the previously returned array. After clear() has been called, a new array will be used as well.
buildOption | Build option, see UStringTrieBuildOption. |
result | A UnicodeString which will be set to the UChar-serialized UCharsTrie for the add()ed data. |
errorCode | Standard ICU error code. Its input value must pass the U_SUCCESS() test, or else the function returns immediately. Check for U_FAILURE() on output or use with function chaining. (See User Guide for details.) |
UCharsTrieBuilder& UCharsTrieBuilder::clear | ( | ) | [inline] |
Removes all (string, value) pairs.
New data can then be add()ed and a new trie can be built.
Definition at line 111 of file ucharstriebuilder.h.