Warning, file /include/unicode/ucharstriebuilder.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef __UCHARSTRIEBUILDER_H__
0018 #define __UCHARSTRIEBUILDER_H__
0019
0020 #include "unicode/utypes.h"
0021
0022 #if U_SHOW_CPLUSPLUS_API
0023
0024 #include "unicode/stringtriebuilder.h"
0025 #include "unicode/ucharstrie.h"
0026 #include "unicode/unistr.h"
0027
0028
0029
0030
0031
0032
0033 U_NAMESPACE_BEGIN
0034
0035 class UCharsTrieElement;
0036
0037
0038
0039
0040
0041
0042
0043 class U_COMMON_API UCharsTrieBuilder : public StringTrieBuilder {
0044 public:
0045
0046
0047
0048
0049
0050 UCharsTrieBuilder(UErrorCode &errorCode);
0051
0052
0053
0054
0055
0056 virtual ~UCharsTrieBuilder();
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072 UCharsTrieBuilder &add(const UnicodeString &s, int32_t value, UErrorCode &errorCode);
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092 UCharsTrie *build(UStringTrieBuildOption buildOption, UErrorCode &errorCode);
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119 UnicodeString &buildUnicodeString(UStringTrieBuildOption buildOption, UnicodeString &result,
0120 UErrorCode &errorCode);
0121
0122
0123
0124
0125
0126
0127
0128 UCharsTrieBuilder &clear() {
0129 strings.remove();
0130 elementsLength=0;
0131 ucharsLength=0;
0132 return *this;
0133 }
0134
0135 private:
0136 UCharsTrieBuilder(const UCharsTrieBuilder &other) = delete;
0137 UCharsTrieBuilder &operator=(const UCharsTrieBuilder &other) = delete;
0138
0139 void buildUChars(UStringTrieBuildOption buildOption, UErrorCode &errorCode);
0140
0141 virtual int32_t getElementStringLength(int32_t i) const override;
0142 virtual char16_t getElementUnit(int32_t i, int32_t unitIndex) const override;
0143 virtual int32_t getElementValue(int32_t i) const override;
0144
0145 virtual int32_t getLimitOfLinearMatch(int32_t first, int32_t last, int32_t unitIndex) const override;
0146
0147 virtual int32_t countElementUnits(int32_t start, int32_t limit, int32_t unitIndex) const override;
0148 virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t unitIndex, int32_t count) const override;
0149 virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, char16_t unit) const override;
0150
0151 virtual UBool matchNodesCanHaveValues() const override { return true; }
0152
0153 virtual int32_t getMaxBranchLinearSubNodeLength() const override { return UCharsTrie::kMaxBranchLinearSubNodeLength; }
0154 virtual int32_t getMinLinearMatch() const override { return UCharsTrie::kMinLinearMatch; }
0155 virtual int32_t getMaxLinearMatchLength() const override { return UCharsTrie::kMaxLinearMatchLength; }
0156
0157 class UCTLinearMatchNode : public LinearMatchNode {
0158 public:
0159 UCTLinearMatchNode(const char16_t *units, int32_t len, Node *nextNode);
0160 virtual bool operator==(const Node &other) const override;
0161 virtual void write(StringTrieBuilder &builder) override;
0162 private:
0163 const char16_t *s;
0164 };
0165
0166 virtual Node *createLinearMatchNode(int32_t i, int32_t unitIndex, int32_t length,
0167 Node *nextNode) const override;
0168
0169 UBool ensureCapacity(int32_t length);
0170 virtual int32_t write(int32_t unit) override;
0171 int32_t write(const char16_t *s, int32_t length);
0172 virtual int32_t writeElementUnits(int32_t i, int32_t unitIndex, int32_t length) override;
0173 virtual int32_t writeValueAndFinal(int32_t i, UBool isFinal) override;
0174 virtual int32_t writeValueAndType(UBool hasValue, int32_t value, int32_t node) override;
0175 virtual int32_t writeDeltaTo(int32_t jumpTarget) override;
0176
0177 UnicodeString strings;
0178 UCharsTrieElement *elements;
0179 int32_t elementsCapacity;
0180 int32_t elementsLength;
0181
0182
0183
0184 char16_t *uchars;
0185 int32_t ucharsCapacity;
0186 int32_t ucharsLength;
0187 };
0188
0189 U_NAMESPACE_END
0190
0191 #endif
0192
0193 #endif