chromium/third_party/dawn/src/tint/utils/text/unicode.cc

// Copyright 2022 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
//    list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
//    this list of conditions and the following disclaimer in the documentation
//    and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
//    contributors may be used to endorse or promote products derived from
//    this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "src/tint/utils/text/unicode.h"

#include <algorithm>

namespace tint {
namespace {

struct CodePointRange {};

inline bool operator<(CodePoint code_point, CodePointRange range) {}
inline bool operator<(CodePointRange range, CodePoint code_point) {}

// Interval ranges of all code points in the Unicode 14 XID_Start set
// This array needs to be in ascending order.
constexpr CodePointRange kXIDStartRanges[] =;

// Number of ranges in kXIDStartRanges
constexpr size_t kNumXIDStartRanges =;

// The additional code point interval ranges for the Unicode 14 XID_Continue
// set. This extends the values in kXIDStartRanges.
// This array needs to be in ascending order.
constexpr CodePointRange kXIDContinueRanges[] =;

// Number of ranges in kXIDContinueRanges
constexpr size_t kNumXIDContinueRanges =;

}  // namespace

bool CodePoint::IsXIDStart() const {}

bool CodePoint::IsXIDContinue() const {}

namespace utf8 {

std::pair<CodePoint, size_t> Decode(const uint8_t* ptr, size_t len) {}

std::pair<CodePoint, size_t> Decode(std::string_view utf8_string) {}

size_t Encode(CodePoint code_point, uint8_t* ptr) {}

bool IsASCII(std::string_view str) {}

}  // namespace utf8

namespace utf16 {

std::pair<CodePoint, size_t> Decode(const uint16_t* ptr, size_t len) {}

std::pair<CodePoint, size_t> Decode(std::string_view utf16_string) {}

size_t Encode(CodePoint code_point, uint16_t* ptr) {}

}  // namespace utf16
}  // namespace tint