/** * \file * \brief C++ API: Builder for icu::UCharsTrie
*/
U_NAMESPACE_BEGIN
class UCharsTrieElement;
/** * Builder class for UCharsTrie. * * This class is not intended for public subclassing. * @stable ICU 4.8
*/ class U_COMMON_API UCharsTrieBuilder : public StringTrieBuilder { public: /** * Constructs an empty builder. * @param errorCode Standard ICU error code. * @stable ICU 4.8
*/
UCharsTrieBuilder(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. * @param s The input string. * @param value The value associated with this string. * @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
*/
UCharsTrieBuilder &add(const UnicodeString &s, int32_t value, UErrorCode &errorCode);
/** * Builds a UCharsTrie for the add()ed data. * Once built, no further data can be add()ed until clear() is called. * * A UCharsTrie cannot be empty. At least one (string, 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 UCharsTrie for the add()ed data. * @stable ICU 4.8
*/
UCharsTrie *build(UStringTrieBuildOption buildOption, UErrorCode &errorCode);
/** * Builds a UCharsTrie for the add()ed data and char16_t-serializes it. * Once built, no further data can be add()ed until clear() is called. * * A UCharsTrie cannot be empty. At least one (string, value) pair * must have been add()ed. * * Multiple calls to buildUnicodeString() set the UnicodeStrings to the * builder's same char16_t array, without rebuilding. * If buildUnicodeString() is called after build(), the trie will be * re-serialized into a new array (because build() passes on ownership). * If build() is called after buildUnicodeString(), the trie object returned * by build() will become the owner of the underlying data for the * previously returned UnicodeString. * After clear() has been called, a new array will be used as well. * @param buildOption Build option, see UStringTrieBuildOption. * @param result A UnicodeString which will be set to the char16_t-serialized * UCharsTrie for the add()ed data. * @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 result * @stable ICU 4.8
*/
UnicodeString &buildUnicodeString(UStringTrieBuildOption buildOption, UnicodeString &result,
UErrorCode &errorCode);
/** * Removes all (string, value) pairs. * New data can then be add()ed and a new trie can be built. * @return *this * @stable ICU 4.8
*/
UCharsTrieBuilder &clear() {
strings.remove();
elementsLength=0;
ucharsLength=0; return *this;
}
private:
UCharsTrieBuilder(const UCharsTrieBuilder &other) = delete; // no copy constructor
UCharsTrieBuilder &operator=(const UCharsTrieBuilder &other) = delete; // no assignment operator
// char16_t serialization of the trie. // Grows from the back: ucharsLength measures from the end of the buffer!
char16_t *uchars;
int32_t ucharsCapacity;
int32_t ucharsLength;
};
U_NAMESPACE_END
#endif/* U_SHOW_CPLUSPLUS_API */
#endif// __UCHARSTRIEBUILDER_H__
Messung V0.5
¤ Dauer der Verarbeitung: 0.10 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.