// © 2018 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html // utrie_swap.cpp // created: 2018aug08 Markus W. Scherer #include "unicode/utypes.h" #include "cmemory.h" #include "ucptrie_impl.h" #include "udataswp.h" #include "utrie.h" #include "utrie2_impl.h" // These functions for swapping different generations of ICU code point tries are here // so that their implementation files need not depend on swapper code, // need not depend on each other, and so that other swapper code // need not depend on other trie code. namespace { constexpr int32_t ASCII_LIMIT = …; } // namespace U_CAPI int32_t U_EXPORT2 utrie_swap(const UDataSwapper *ds, const void *inData, int32_t length, void *outData, UErrorCode *pErrorCode) { … } U_CAPI int32_t U_EXPORT2 utrie2_swap(const UDataSwapper *ds, const void *inData, int32_t length, void *outData, UErrorCode *pErrorCode) { … } U_CAPI int32_t U_EXPORT2 ucptrie_swap(const UDataSwapper *ds, const void *inData, int32_t length, void *outData, UErrorCode *pErrorCode) { … } namespace { /** * Gets the trie version from 32-bit-aligned memory containing the serialized form * of a UTrie (version 1), a UTrie2 (version 2), or a UCPTrie (version 3). * * @param data a pointer to 32-bit-aligned memory containing the serialized form of a trie * @param length the number of bytes available at data; * can be more than necessary (see return value) * @param anyEndianOk If false, only platform-endian serialized forms are recognized. * If true, opposite-endian serialized forms are recognized as well. * @return the trie version of the serialized form, or 0 if it is not * recognized as a serialized trie */ int32_t getVersion(const void *data, int32_t length, UBool anyEndianOk) { … } } // namespace U_CAPI int32_t U_EXPORT2 utrie_swapAnyVersion(const UDataSwapper *ds, const void *inData, int32_t length, void *outData, UErrorCode *pErrorCode) { … }