17#ifndef __UCHARSTRIEBUILDER_H__
18#define __UCHARSTRIEBUILDER_H__
22#if U_SHOW_CPLUSPLUS_API
35class UCharsTrieElement;
151 virtual UBool matchNodesCanHaveValues()
const override {
return true; }
153 virtual int32_t getMaxBranchLinearSubNodeLength()
const override {
return UCharsTrie::kMaxBranchLinearSubNodeLength; }
154 virtual int32_t getMinLinearMatch()
const override {
return UCharsTrie::kMinLinearMatch; }
155 virtual int32_t getMaxLinearMatchLength()
const override {
return UCharsTrie::kMaxLinearMatchLength; }
157 class UCTLinearMatchNode :
public LinearMatchNode {
159 UCTLinearMatchNode(
const char16_t *units, int32_t len, Node *nextNode);
160 virtual bool operator==(
const Node &other)
const override;
161 virtual void write(StringTrieBuilder &builder)
override;
166 virtual Node *createLinearMatchNode(int32_t i, int32_t unitIndex, int32_t length,
167 Node *nextNode)
const override;
169 UBool ensureCapacity(int32_t length);
170 virtual int32_t write(int32_t unit)
override;
171 int32_t write(
const char16_t *s, int32_t length);
172 virtual int32_t writeElementUnits(int32_t i, int32_t unitIndex, int32_t length)
override;
173 virtual int32_t writeValueAndFinal(int32_t i,
UBool isFinal)
override;
174 virtual int32_t writeValueAndType(
UBool hasValue, int32_t value, int32_t node)
override;
175 virtual int32_t writeDeltaTo(int32_t jumpTarget)
override;
177 UnicodeString strings;
178 UCharsTrieElement *elements;
179 int32_t elementsCapacity;
180 int32_t elementsLength;
185 int32_t ucharsCapacity;
186 int32_t ucharsLength;
"Smart pointer" base class; do not use directly: use LocalPointer etc.
Builder class for UCharsTrie.
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 char16_t-serializes it.
virtual ~UCharsTrieBuilder()
Destructor.
UCharsTrieBuilder(UErrorCode &errorCode)
Constructs an empty builder.
UCharsTrieBuilder & clear()
Removes all (string, value) pairs.
Light-weight, non-const reader class for a UCharsTrie.
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
C++ API: Builder API for trie builders.
UStringTrieBuildOption
Build options for BytesTrieBuilder and CharsTrieBuilder.
C++ API: Trie for mapping Unicode strings (or 16-bit-unit sequences) to integer values.
int8_t UBool
The ICU boolean type, a signed-byte integer.
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside.