22 #ifndef __BYTESTRIEBUILDER_H__
23 #define __BYTESTRIEBUILDER_H__
27 #if U_SHOW_CPLUSPLUS_API
37 class BytesTrieElement;
130 friend class ::BytesTrieTest;
137 virtual int32_t getElementStringLength(int32_t i)
const;
138 virtual char16_t getElementUnit(int32_t i, int32_t byteIndex)
const;
139 virtual int32_t getElementValue(int32_t i)
const;
141 virtual int32_t getLimitOfLinearMatch(int32_t first, int32_t last, int32_t byteIndex)
const;
143 virtual int32_t countElementUnits(int32_t start, int32_t limit, int32_t byteIndex)
const;
144 virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t byteIndex, int32_t count)
const;
145 virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t byteIndex, char16_t byte)
const;
147 virtual UBool matchNodesCanHaveValues()
const {
return false; }
149 virtual int32_t getMaxBranchLinearSubNodeLength()
const {
return BytesTrie::kMaxBranchLinearSubNodeLength; }
150 virtual int32_t getMinLinearMatch()
const {
return BytesTrie::kMinLinearMatch; }
151 virtual int32_t getMaxLinearMatchLength()
const {
return BytesTrie::kMaxLinearMatchLength; }
156 class BTLinearMatchNode :
public LinearMatchNode {
158 BTLinearMatchNode(
const char *units, int32_t len, Node *nextNode);
160 virtual void write(StringTrieBuilder &builder);
165 virtual Node *createLinearMatchNode(int32_t i, int32_t byteIndex, int32_t length,
166 Node *nextNode)
const;
168 UBool ensureCapacity(int32_t length);
169 virtual int32_t write(int32_t byte);
170 int32_t write(
const char *b, int32_t length);
171 virtual int32_t writeElementUnits(int32_t i, int32_t byteIndex, int32_t length);
172 virtual int32_t writeValueAndFinal(int32_t i,
UBool isFinal);
173 virtual int32_t writeValueAndType(
UBool hasValue, int32_t value, int32_t node);
174 virtual int32_t writeDeltaTo(int32_t jumpTarget);
175 static int32_t internalEncodeDelta(int32_t i,
char intBytes[]);
178 BytesTrieElement *elements;
179 int32_t elementsCapacity;
180 int32_t elementsLength;
185 int32_t bytesCapacity;
193 #endif // __BYTESTRIEBUILDER_H__
C++ API: Builder API for trie builders.
C++ API: Trie for mapping byte sequences to integer values.
Builder class for BytesTrie.
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
Light-weight, non-const reader class for a BytesTrie.
C++ API: StringPiece: Read-only byte string wrapper class.
UStringTrieBuildOption
Build options for BytesTrieBuilder and CharsTrieBuilder.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Basic definitions for ICU, for both C and C++ APIs.
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside...
A string-like object that points to a sized piece of memory.
int8_t UBool
The ICU boolean type, a signed-byte integer.