// Copyright 2023 The PDFium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CORE_FXCRT_UTF16_H_ #define CORE_FXCRT_UTF16_H_ #include "core/fxcrt/check.h" namespace pdfium { // The number of suffix bits in a UTF-16 surrogate. inline constexpr int kSurrogateBits = …; // A bitmask for the suffix of a UTF-16 surrogate. inline constexpr char16_t kSurrogateMask = …; // The first supplementary code point, `U+10000`. inline constexpr char32_t kMinimumSupplementaryCodePoint = …; // The last supplementary code point, `U+10FFFF`. inline constexpr char32_t kMaximumSupplementaryCodePoint = …; // The first UTF-16 high surrogate code unit, `U+D800`. inline constexpr char16_t kMinimumHighSurrogateCodeUnit = …; // The last UTF-16 high surrogate code unit, `U+DBFF`. inline constexpr char16_t kMaximumHighSurrogateCodeUnit = …; // The first UTF-16 low surrogate code unit, `U+DC00`. inline constexpr char16_t kMinimumLowSurrogateCodeUnit = …; // The last UTF-16 low surrogate code unit, `U+DFFF`. inline constexpr char16_t kMaximumLowSurrogateCodeUnit = …; // Returns `true` if `code_point` is in a supplementary plane, and therefore // requires encoding as a UTF-16 surrogate pair. constexpr bool IsSupplementary(char32_t code_point) { … } // Returns `true` if `code_point` is a UTF-16 high surrogate. constexpr bool IsHighSurrogate(char32_t code_point) { … } // Returns `true` if `code_point` is a UTF-16 low surrogate. constexpr bool IsLowSurrogate(char32_t code_point) { … } // A UTF-16 surrogate pair. class SurrogatePair final { … }; } // namespace pdfium #endif // CORE_FXCRT_UTF16_H_