#include "quiche_platform_impl/quiche_command_line_flags_impl.h"
#include <initializer_list>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#include "base/command_line.h"
#include "base/export_template.h"
#include "base/logging.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "net/third_party/quiche/src/quiche/quic/platform/api/quic_logging.h"
namespace quiche {
namespace {
size_t FindLineWrapPosition(const std::string& s, size_t desired_len) { … }
void AppendFlagDescription(const std::string& name,
std::string help,
std::string* out) { … }
[[maybe_unused]] std::vector<std::string> ToQuicheStringVector(
const std::vector<std::string>& v) { … }
#if defined(WCHAR_T_IS_16_BIT)
[[maybe_unused]] std::vector<std::string> ToQuicheStringVector(
const std::vector<std::wstring>& v) {
std::vector<std::string> qsv;
for (const auto& s : v) {
if (!base::IsStringASCII(s)) {
QUIC_LOG(ERROR) << "Unable to convert to ASCII: " << s;
continue;
}
qsv.push_back(base::WideToASCII(s));
}
return qsv;
}
#endif
}
QuicheFlagRegistry& QuicheFlagRegistry::GetInstance() { … }
void QuicheFlagRegistry::RegisterFlag(
const char* name,
std::unique_ptr<QuicheFlagHelper> helper) { … }
bool QuicheFlagRegistry::SetFlags(const base::CommandLine& command_line,
std::string* error_msg) const { … }
void QuicheFlagRegistry::ResetFlags() const { … }
std::string QuicheFlagRegistry::GetHelp() const { … }
template <>
bool TypedQuicheFlagHelper<bool>::SetFlag(const std::string& s) const { … }
template <>
bool TypedQuicheFlagHelper<uint16_t>::SetFlag(const std::string& s) const { … }
template <>
bool TypedQuicheFlagHelper<int32_t>::SetFlag(const std::string& s) const { … }
template <>
bool TypedQuicheFlagHelper<std::string>::SetFlag(const std::string& s) const { … }
template class TypedQuicheFlagHelper<bool>;
template class TypedQuicheFlagHelper<uint16_t>;
template class TypedQuicheFlagHelper<int32_t>;
template class TypedQuicheFlagHelper<std::string>;
QuicheFlagRegistry::QuicheFlagRegistry() = default;
QuicheFlagRegistry::~QuicheFlagRegistry() = default;
std::vector<std::string> QuicheParseCommandLineFlagsImpl(
const char* usage,
int argc,
const char* const* argv) { … }
QuicheParseCommandLineFlagsResult QuicheParseCommandLineFlagsHelper(
const char* usage,
const base::CommandLine& command_line) { … }
void QuichePrintCommandLineFlagHelpImpl(const char* usage) { … }
QuicheParseCommandLineFlagsResult::QuicheParseCommandLineFlagsResult() =
default;
QuicheParseCommandLineFlagsResult::QuicheParseCommandLineFlagsResult(
const QuicheParseCommandLineFlagsResult&) = default;
QuicheParseCommandLineFlagsResult::~QuicheParseCommandLineFlagsResult() =
default;
}