#include "unicode/utypes.h"
#if !UCONFIG_NO_NORMALIZATION
#include "unicode/bytestream.h"
#include "unicode/edits.h"
#include "unicode/normalizer2.h"
#include "unicode/stringoptions.h"
#include "unicode/ucptrie.h"
#include "unicode/udata.h"
#include "unicode/umutablecptrie.h"
#include "unicode/ustring.h"
#include "unicode/utf16.h"
#include "unicode/utf8.h"
#include "bytesinkutil.h"
#include "cmemory.h"
#include "mutex.h"
#include "normalizer2impl.h"
#include "putilimp.h"
#include "uassert.h"
#include "ucptrie_impl.h"
#include "uset_imp.h"
#include "uvector.h"
U_NAMESPACE_BEGIN
namespace {
inline uint8_t leadByteForCP(UChar32 c) { … }
UChar32 codePointFromValidUTF8(const uint8_t *cpStart, const uint8_t *cpLimit) { … }
UChar32 previousHangulOrJamo(const uint8_t *start, const uint8_t *p) { … }
int32_t getJamoTMinusBase(const uint8_t *src, const uint8_t *limit) { … }
void
appendCodePointDelta(const uint8_t *cpStart, const uint8_t *cpLimit, int32_t delta,
ByteSink &sink, Edits *edits) { … }
}
ReorderingBuffer::ReorderingBuffer(const Normalizer2Impl &ni, UnicodeString &dest,
UErrorCode &errorCode) : … { … }
UBool ReorderingBuffer::init(int32_t destCapacity, UErrorCode &errorCode) { … }
UBool ReorderingBuffer::equals(const char16_t *otherStart, const char16_t *otherLimit) const { … }
UBool ReorderingBuffer::equals(const uint8_t *otherStart, const uint8_t *otherLimit) const { … }
UBool ReorderingBuffer::appendSupplementary(UChar32 c, uint8_t cc, UErrorCode &errorCode) { … }
UBool ReorderingBuffer::append(const char16_t *s, int32_t length, UBool isNFD,
uint8_t leadCC, uint8_t trailCC,
UErrorCode &errorCode) { … }
UBool ReorderingBuffer::appendZeroCC(UChar32 c, UErrorCode &errorCode) { … }
UBool ReorderingBuffer::appendZeroCC(const char16_t *s, const char16_t *sLimit, UErrorCode &errorCode) { … }
void ReorderingBuffer::remove() { … }
void ReorderingBuffer::removeSuffix(int32_t suffixLength) { … }
UBool ReorderingBuffer::resize(int32_t appendLength, UErrorCode &errorCode) { … }
void ReorderingBuffer::skipPrevious() { … }
uint8_t ReorderingBuffer::previousCC() { … }
void ReorderingBuffer::insert(UChar32 c, uint8_t cc) { … }
struct CanonIterData : public UMemory { … };
Normalizer2Impl::~Normalizer2Impl() { … }
void
Normalizer2Impl::init(const int32_t *inIndexes, const UCPTrie *inTrie,
const uint16_t *inExtraData, const uint8_t *inSmallFCD) { … }
U_CDECL_BEGIN
static uint32_t U_CALLCONV
segmentStarterMapper(const void * , uint32_t value) { … }
U_CDECL_END
void
Normalizer2Impl::addLcccChars(UnicodeSet &set) const { … }
void
Normalizer2Impl::addPropertyStarts(const USetAdder *sa, UErrorCode & ) const { … }
void
Normalizer2Impl::addCanonIterPropertyStarts(const USetAdder *sa, UErrorCode &errorCode) const { … }
const char16_t *
Normalizer2Impl::copyLowPrefixFromNulTerminated(const char16_t *src,
UChar32 minNeedDataCP,
ReorderingBuffer *buffer,
UErrorCode &errorCode) const { … }
UnicodeString &
Normalizer2Impl::decompose(const UnicodeString &src, UnicodeString &dest,
UErrorCode &errorCode) const { … }
void
Normalizer2Impl::decompose(const char16_t *src, const char16_t *limit,
UnicodeString &dest,
int32_t destLengthEstimate,
UErrorCode &errorCode) const { … }
const char16_t *
Normalizer2Impl::decompose(const char16_t *src, const char16_t *limit,
ReorderingBuffer *buffer,
UErrorCode &errorCode) const { … }
const char16_t *
Normalizer2Impl::decomposeShort(const char16_t *src, const char16_t *limit,
UBool stopAtCompBoundary, UBool onlyContiguous,
ReorderingBuffer &buffer, UErrorCode &errorCode) const { … }
UBool Normalizer2Impl::decompose(UChar32 c, uint16_t norm16,
ReorderingBuffer &buffer,
UErrorCode &errorCode) const { … }
const uint8_t *
Normalizer2Impl::decomposeUTF8(uint32_t options,
const uint8_t *src, const uint8_t *limit,
ByteSink *sink, Edits *edits, UErrorCode &errorCode) const { … }
const uint8_t *
Normalizer2Impl::decomposeShort(const uint8_t *src, const uint8_t *limit,
StopAt stopAt, UBool onlyContiguous,
ReorderingBuffer &buffer, UErrorCode &errorCode) const { … }
const char16_t *
Normalizer2Impl::getDecomposition(UChar32 c, char16_t buffer[4], int32_t &length) const { … }
const char16_t *
Normalizer2Impl::getRawDecomposition(UChar32 c, char16_t buffer[30], int32_t &length) const { … }
void Normalizer2Impl::decomposeAndAppend(const char16_t *src, const char16_t *limit,
UBool doDecompose,
UnicodeString &safeMiddle,
ReorderingBuffer &buffer,
UErrorCode &errorCode) const { … }
UBool Normalizer2Impl::hasDecompBoundaryBefore(UChar32 c) const { … }
UBool Normalizer2Impl::norm16HasDecompBoundaryBefore(uint16_t norm16) const { … }
UBool Normalizer2Impl::hasDecompBoundaryAfter(UChar32 c) const { … }
UBool Normalizer2Impl::norm16HasDecompBoundaryAfter(uint16_t norm16) const { … }
int32_t Normalizer2Impl::combine(const uint16_t *list, UChar32 trail) { … }
void Normalizer2Impl::addComposites(const uint16_t *list, UnicodeSet &set) const { … }
void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStartIndex,
UBool onlyContiguous) const { … }
UChar32
Normalizer2Impl::composePair(UChar32 a, UChar32 b) const { … }
UBool
Normalizer2Impl::compose(const char16_t *src, const char16_t *limit,
UBool onlyContiguous,
UBool doCompose,
ReorderingBuffer &buffer,
UErrorCode &errorCode) const { … }
const char16_t *
Normalizer2Impl::composeQuickCheck(const char16_t *src, const char16_t *limit,
UBool onlyContiguous,
UNormalizationCheckResult *pQCResult) const { … }
void Normalizer2Impl::composeAndAppend(const char16_t *src, const char16_t *limit,
UBool doCompose,
UBool onlyContiguous,
UnicodeString &safeMiddle,
ReorderingBuffer &buffer,
UErrorCode &errorCode) const { … }
UBool
Normalizer2Impl::composeUTF8(uint32_t options, UBool onlyContiguous,
const uint8_t *src, const uint8_t *limit,
ByteSink *sink, Edits *edits, UErrorCode &errorCode) const { … }
UBool Normalizer2Impl::hasCompBoundaryBefore(const char16_t *src, const char16_t *limit) const { … }
UBool Normalizer2Impl::hasCompBoundaryBefore(const uint8_t *src, const uint8_t *limit) const { … }
UBool Normalizer2Impl::hasCompBoundaryAfter(const char16_t *start, const char16_t *p,
UBool onlyContiguous) const { … }
UBool Normalizer2Impl::hasCompBoundaryAfter(const uint8_t *start, const uint8_t *p,
UBool onlyContiguous) const { … }
const char16_t *Normalizer2Impl::findPreviousCompBoundary(const char16_t *start, const char16_t *p,
UBool onlyContiguous) const { … }
const char16_t *Normalizer2Impl::findNextCompBoundary(const char16_t *p, const char16_t *limit,
UBool onlyContiguous) const { … }
uint8_t Normalizer2Impl::getPreviousTrailCC(const char16_t *start, const char16_t *p) const { … }
uint8_t Normalizer2Impl::getPreviousTrailCC(const uint8_t *start, const uint8_t *p) const { … }
#if (defined(_MSC_VER) && (defined(_M_ARM64)) && (_MSC_VER < 1924))
#pragma optimize( "", off )
#endif
uint16_t Normalizer2Impl::getFCD16FromNormData(UChar32 c) const { … }
#if (defined(_MSC_VER) && (defined(_M_ARM64)) && (_MSC_VER < 1924))
#pragma optimize( "", on )
#endif
uint16_t Normalizer2Impl::getFCD16FromMaybeOrNonZeroCC(uint16_t norm16) const { … }
const char16_t *
Normalizer2Impl::makeFCD(const char16_t *src, const char16_t *limit,
ReorderingBuffer *buffer,
UErrorCode &errorCode) const { … }
void Normalizer2Impl::makeFCDAndAppend(const char16_t *src, const char16_t *limit,
UBool doMakeFCD,
UnicodeString &safeMiddle,
ReorderingBuffer &buffer,
UErrorCode &errorCode) const { … }
const char16_t *Normalizer2Impl::findPreviousFCDBoundary(const char16_t *start, const char16_t *p) const { … }
const char16_t *Normalizer2Impl::findNextFCDBoundary(const char16_t *p, const char16_t *limit) const { … }
CanonIterData::CanonIterData(UErrorCode &errorCode) : … { … }
CanonIterData::~CanonIterData() { … }
void CanonIterData::addToStartSet(UChar32 origin, UChar32 decompLead, UErrorCode &errorCode) { … }
class InitCanonIterData { … };
U_CDECL_BEGIN
static void U_CALLCONV
initCanonIterData(Normalizer2Impl *impl, UErrorCode &errorCode) { … }
U_CDECL_END
void InitCanonIterData::doInit(Normalizer2Impl *impl, UErrorCode &errorCode) { … }
void Normalizer2Impl::makeCanonIterDataFromNorm16(UChar32 start, UChar32 end, const uint16_t norm16,
CanonIterData &newData,
UErrorCode &errorCode) const { … }
UBool Normalizer2Impl::ensureCanonIterData(UErrorCode &errorCode) const { … }
int32_t Normalizer2Impl::getCanonValue(UChar32 c) const { … }
const UnicodeSet &Normalizer2Impl::getCanonStartSet(int32_t n) const { … }
UBool Normalizer2Impl::isCanonSegmentStarter(UChar32 c) const { … }
UBool Normalizer2Impl::getCanonStartSet(UChar32 c, UnicodeSet &set) const { … }
U_NAMESPACE_END
U_NAMESPACE_USE
U_CAPI int32_t U_EXPORT2
unorm2_swap(const UDataSwapper *ds,
const void *inData, int32_t length, void *outData,
UErrorCode *pErrorCode) { … }
#endif