#include "quiche/common/structured_headers.h"
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <optional>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include "absl/algorithm/container.h"
#include "absl/container/flat_hash_set.h"
#include "absl/strings/ascii.h"
#include "absl/strings/escaping.h"
#include "absl/strings/numbers.h"
#include "absl/strings/str_format.h"
#include "absl/strings/string_view.h"
#include "absl/types/span.h"
#include "quiche/common/platform/api/quiche_logging.h"
namespace quiche {
namespace structured_headers {
namespace {
#define DIGIT …
#define LCALPHA …
#define UCALPHA …
#define TCHAR …
constexpr char kTokenChars09[] = …;
constexpr char kTokenChars[] = …;
constexpr char kKeyChars09[] = …;
constexpr char kKeyChars[] = …;
constexpr char kSP[] = …;
constexpr char kOWS[] = …;
#undef DIGIT
#undef LCALPHA
#undef UCALPHA
constexpr int64_t kMaxInteger = …;
constexpr int64_t kMinInteger = …;
constexpr double kTooLargeDecimal = …;
void StripLeft(absl::string_view& s, absl::string_view remove) { … }
class StructuredHeaderParser { … };
class StructuredHeaderSerializer { … };
}
absl::string_view ItemTypeToString(Item::ItemType type) { … }
bool IsValidToken(absl::string_view str) { … }
Item::Item() { … }
Item::Item(std::string value, Item::ItemType type) { … }
Item::Item(const char* value, Item::ItemType type)
: … { … }
Item::Item(int64_t value) : … { … }
Item::Item(double value) : … { … }
Item::Item(bool value) : … { … }
bool operator==(const Item& lhs, const Item& rhs) { … }
ParameterizedItem::ParameterizedItem() = default;
ParameterizedItem::ParameterizedItem(const ParameterizedItem&) = default;
ParameterizedItem& ParameterizedItem::operator=(const ParameterizedItem&) =
default;
ParameterizedItem::ParameterizedItem(Item id, Parameters ps)
: … { … }
ParameterizedItem::~ParameterizedItem() = default;
ParameterizedMember::ParameterizedMember() = default;
ParameterizedMember::ParameterizedMember(const ParameterizedMember&) = default;
ParameterizedMember& ParameterizedMember::operator=(
const ParameterizedMember&) = default;
ParameterizedMember::ParameterizedMember(std::vector<ParameterizedItem> id,
bool member_is_inner_list,
Parameters ps)
: … { … }
ParameterizedMember::ParameterizedMember(std::vector<ParameterizedItem> id,
Parameters ps)
: … { … }
ParameterizedMember::ParameterizedMember(Item id, Parameters ps)
: … { … }
ParameterizedMember::~ParameterizedMember() = default;
ParameterisedIdentifier::ParameterisedIdentifier() = default;
ParameterisedIdentifier::ParameterisedIdentifier(
const ParameterisedIdentifier&) = default;
ParameterisedIdentifier& ParameterisedIdentifier::operator=(
const ParameterisedIdentifier&) = default;
ParameterisedIdentifier::ParameterisedIdentifier(Item id, Parameters ps)
: … { … }
ParameterisedIdentifier::~ParameterisedIdentifier() = default;
Dictionary::Dictionary() = default;
Dictionary::Dictionary(const Dictionary&) = default;
Dictionary::Dictionary(Dictionary&&) = default;
Dictionary::Dictionary(std::vector<DictionaryMember> members)
: … { … }
Dictionary::~Dictionary() = default;
Dictionary::iterator Dictionary::begin() { … }
Dictionary::const_iterator Dictionary::begin() const { … }
Dictionary::iterator Dictionary::end() { … }
Dictionary::const_iterator Dictionary::end() const { … }
ParameterizedMember& Dictionary::operator[](std::size_t idx) { … }
const ParameterizedMember& Dictionary::operator[](std::size_t idx) const { … }
ParameterizedMember& Dictionary::at(std::size_t idx) { … }
const ParameterizedMember& Dictionary::at(std::size_t idx) const { … }
ParameterizedMember& Dictionary::operator[](absl::string_view key) { … }
ParameterizedMember& Dictionary::at(absl::string_view key) { … }
const ParameterizedMember& Dictionary::at(absl::string_view key) const { … }
Dictionary::const_iterator Dictionary::find(absl::string_view key) const { … }
Dictionary::iterator Dictionary::find(absl::string_view key) { … }
bool Dictionary::empty() const { … }
std::size_t Dictionary::size() const { … }
bool Dictionary::contains(absl::string_view key) const { … }
void Dictionary::clear() { … }
std::optional<ParameterizedItem> ParseItem(absl::string_view str) { … }
std::optional<Item> ParseBareItem(absl::string_view str) { … }
std::optional<ParameterisedList> ParseParameterisedList(absl::string_view str) { … }
std::optional<ListOfLists> ParseListOfLists(absl::string_view str) { … }
std::optional<List> ParseList(absl::string_view str) { … }
std::optional<Dictionary> ParseDictionary(absl::string_view str) { … }
std::optional<std::string> SerializeItem(const Item& value) { … }
std::optional<std::string> SerializeItem(const ParameterizedItem& value) { … }
std::optional<std::string> SerializeList(const List& value) { … }
std::optional<std::string> SerializeDictionary(const Dictionary& value) { … }
}
}