chromium/ui/base/template_expressions.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "ui/base/template_expressions.h"

#include <stddef.h>

#include <optional>
#include <ostream>
#include <string_view>

#include "base/check_op.h"
#include "base/no_destructor.h"
#include "base/strings/escape.h"
#include "base/values.h"
#include "build/chromeos_buildflags.h"

#if DCHECK_IS_ON()
#include "third_party/re2/src/re2/re2.h"  // nogncheck
#endif

namespace {
const char kLeader[] =;
const size_t kLeaderSize =;
const char kKeyOpen =;
const char kKeyClose =;
const char kHtmlTemplateEnd[] =;
const char kHtmlTemplateStart[] =;
const size_t kHtmlTemplateStartSize =;

enum HtmlTemplateType {};

struct HtmlTemplate {};

HtmlTemplate FindHtmlTemplate(std::string_view source) {}

// Escape quotes and backslashes ('"\).
std::string PolymerParameterEscape(const std::string& in_string,
                                   bool is_javascript) {}

bool EscapeForJS(const std::string& in_string,
                 std::optional<char> in_previous,
                 std::string* out_string) {}

#if DCHECK_IS_ON()
// Checks whether the replacement has an unsubstituted placeholder, e.g. "$1".
bool HasUnexpectedPlaceholder(const std::string& key,
                              const std::string& replacement) {}
#endif  // DCHECK_IS_ON()

bool ReplaceTemplateExpressionsInternal(
    std::string_view source,
    const ui::TemplateReplacements& replacements,
    bool is_javascript,
    std::string* formatted,
    bool skip_unexpected_placeholder_check = false) {}

}  // namespace

namespace ui {

void TemplateReplacementsFromDictionaryValue(
    const base::Value::Dict& dictionary,
    TemplateReplacements* replacements) {}

bool ReplaceTemplateExpressionsInJS(std::string_view source,
                                    const TemplateReplacements& replacements,
                                    std::string* formatted) {}

std::string ReplaceTemplateExpressions(std::string_view source,
                                       const TemplateReplacements& replacements,
                                       bool skip_unexpected_placeholder_check) {}
}  // namespace ui