class BytesTrieElement; class CharString; /** * Builder class for BytesTrie. * * This class is not intended for public subclassing. * @stable ICU 4.8
*/ class U_COMMON_API BytesTrieBuilder : public StringTrieBuilder { public: /** * Constructs an empty builder. * @param errorCode Standard ICU error code. * @stable ICU 4.8
*/
BytesTrieBuilder(UErrorCode &errorCode);
/** * Adds a (byte sequence, value) pair. * The byte sequence must be unique. * The bytes will be copied; the builder does not keep * a reference to the input StringPiece or its data(). * @param s The input byte sequence. * @param value The value associated with this byte sequence. * @param 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.) * @return *this * @stable ICU 4.8
*/
BytesTrieBuilder &add(StringPiece s, int32_t value, UErrorCode &errorCode);
/** * Builds a BytesTrie for the add()ed data. * Once built, no further data can be add()ed until clear() is called. * * A BytesTrie cannot be empty. At least one (byte sequence, value) pair * must have been add()ed. * * 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. * @param buildOption Build option, see UStringTrieBuildOption. * @param 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.) * @return A new BytesTrie for the add()ed data. * @stable ICU 4.8
*/
BytesTrie *build(UStringTrieBuildOption buildOption, UErrorCode &errorCode);
/** * Builds a BytesTrie for the add()ed data and byte-serializes it. * Once built, no further data can be add()ed until clear() is called. * * A BytesTrie cannot be empty. At least one (byte sequence, value) pair * must have been add()ed. * * Multiple calls to buildStringPiece() return StringPieces referring to the * builder's same byte array, without rebuilding. * If buildStringPiece() is called after build(), the trie will be * re-serialized into a new array (because build() passes on ownership). * If build() is called after buildStringPiece(), the trie object returned * by build() will become the owner of the underlying string for the * previously returned StringPiece. * After clear() has been called, a new array will be used as well. * @param buildOption Build option, see UStringTrieBuildOption. * @param 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.) * @return A StringPiece which refers to the byte-serialized BytesTrie for the add()ed data. * @stable ICU 4.8
*/
StringPiece buildStringPiece(UStringTrieBuildOption buildOption, UErrorCode &errorCode);
/** * Removes all (byte sequence, value) pairs. * New data can then be add()ed and a new trie can be built. * @return *this * @stable ICU 4.8
*/
BytesTrieBuilder &clear();
private: friendclass ::BytesTrieTest;
BytesTrieBuilder(const BytesTrieBuilder &other) = delete; // no copy constructor
BytesTrieBuilder &operator=(const BytesTrieBuilder &other) = delete; // no assignment operator
CharString *strings; // Pointer not object so we need not #include internal charstr.h.
BytesTrieElement *elements;
int32_t elementsCapacity;
int32_t elementsLength;
// Byte serialization of the trie. // Grows from the back: bytesLength measures from the end of the buffer! char *bytes;
int32_t bytesCapacity;
int32_t bytesLength;
};
U_NAMESPACE_END
#endif/* U_SHOW_CPLUSPLUS_API */
#endif// __BYTESTRIEBUILDER_H__
Messung V0.5
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.