chromium/third_party/pdfium/core/fxcrt/widestring.cpp

// Copyright 2014 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#include "core/fxcrt/widestring.h"

#include <stddef.h>
#include <string.h>
#include <wchar.h>

#include <algorithm>
#include <sstream>

#include "core/fxcrt/check.h"
#include "core/fxcrt/check_op.h"
#include "core/fxcrt/compiler_specific.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/fx_memcpy_wrappers.h"
#include "core/fxcrt/fx_safe_types.h"
#include "core/fxcrt/fx_system.h"
#include "core/fxcrt/numerics/safe_math.h"
#include "core/fxcrt/span_util.h"
#include "core/fxcrt/string_pool_template.h"
#include "core/fxcrt/utf16.h"

// Instantiate.
template class fxcrt::StringViewTemplate<wchar_t>;
template class fxcrt::StringPoolTemplate<WideString>;
template struct std::hash<WideString>;

#define FORCE_ANSI
#define FORCE_UNICODE
#define FORCE_INT64

namespace {

#if defined(WCHAR_T_IS_32_BIT)
size_t FuseSurrogates(pdfium::span<wchar_t> s) {}
#endif  // defined(WCHAR_T_IS_32_BIT)

constexpr wchar_t kWideTrimChars[] =;

std::optional<size_t> GuessSizeForVSWPrintf(const wchar_t* pFormat,
                                            va_list argList) {}

// Returns string unless we ran out of space.
std::optional<WideString> TryVSWPrintf(size_t size,
                                       const wchar_t* pFormat,
                                       va_list argList) {}

// Appends a Unicode code point to a `WideString` using either UTF-16 or UTF-32,
// depending on the platform's definition of `wchar_t`.
//
// TODO(crbug.com/pdfium/2031): Always use UTF-16.
// TODO(crbug.com/pdfium/2041): Migrate to `WideString`.
void AppendCodePointToWideString(char32_t code_point, WideString& buffer) {}

WideString UTF8Decode(ByteStringView bsStr) {}

}  // namespace

namespace fxcrt {

static_assert;

// static
WideString WideString::FormatInteger(int i) {}

// static
WideString WideString::FormatV(const wchar_t* format, va_list argList) {}

// static
WideString WideString::Format(const wchar_t* pFormat, ...) {}

WideString::WideString(const wchar_t* pStr, size_t nLen) {}

WideString::WideString(wchar_t ch) {}

WideString::WideString(const wchar_t* ptr)
    :{}

WideString::WideString(WideStringView stringSrc) {}

WideString::WideString(WideStringView str1, WideStringView str2) {}

WideString::WideString(const std::initializer_list<WideStringView>& list) {}

WideString& WideString::operator=(const wchar_t* str) {}

WideString& WideString::operator=(WideStringView str) {}

WideString& WideString::operator=(const WideString& that) {}

WideString& WideString::operator=(WideString&& that) noexcept {}

WideString& WideString::operator+=(const wchar_t* str) {}

WideString& WideString::operator+=(wchar_t ch) {}

WideString& WideString::operator+=(const WideString& str) {}

WideString& WideString::operator+=(WideStringView str) {}

bool WideString::operator==(const wchar_t* ptr) const {}

bool WideString::operator==(WideStringView str) const {}

bool WideString::operator==(const WideString& other) const {}

bool WideString::operator<(const wchar_t* ptr) const {}

bool WideString::operator<(WideStringView str) const {}

bool WideString::operator<(const WideString& other) const {}

intptr_t WideString::ReferenceCountForTesting() const {}

ByteString WideString::ToASCII() const {}

ByteString WideString::ToLatin1() const {}

ByteString WideString::ToDefANSI() const {}

ByteString WideString::ToUTF8() const {}

ByteString WideString::ToUTF16LE() const {}

ByteString WideString::ToUCS2LE() const {}

WideString WideString::EncodeEntities() const {}

WideString WideString::Substr(size_t offset) const {}

WideString WideString::Substr(size_t first, size_t count) const {}

WideString WideString::First(size_t count) const {}

WideString WideString::Last(size_t count) const {}

void WideString::MakeLower() {}

void WideString::MakeUpper() {}

// static
WideString WideString::FromASCII(ByteStringView bstr) {}

// static
WideString WideString::FromLatin1(ByteStringView bstr) {}

// static
WideString WideString::FromDefANSI(ByteStringView bstr) {}

// static
WideString WideString::FromUTF8(ByteStringView str) {}

// static
WideString WideString::FromUTF16LE(pdfium::span<const uint8_t> data) {}

WideString WideString::FromUTF16BE(pdfium::span<const uint8_t> data) {}

int WideString::Compare(const wchar_t* str) const {}

int WideString::Compare(const WideString& str) const {}

int WideString::CompareNoCase(const wchar_t* str) const {}

void WideString::TrimWhitespace() {}

void WideString::TrimWhitespaceFront() {}

void WideString::TrimWhitespaceBack() {}
int WideString::GetInteger() const {}

std::wostream& operator<<(std::wostream& os, const WideString& str) {}

std::ostream& operator<<(std::ostream& os, const WideString& str) {}

std::wostream& operator<<(std::wostream& os, WideStringView str) {}

std::ostream& operator<<(std::ostream& os, WideStringView str) {}

}  // namespace fxcrt

uint32_t FX_HashCode_GetW(WideStringView str) {}

uint32_t FX_HashCode_GetLoweredW(WideStringView str) {}