Go to the documentation of this file.
16 #include "absl/flags/marshalling.h"
23 #include <type_traits>
26 #include "absl/base/config.h"
27 #include "absl/base/log_severity.h"
28 #include "absl/base/macros.h"
29 #include "absl/strings/ascii.h"
30 #include "absl/strings/match.h"
31 #include "absl/strings/numbers.h"
32 #include "absl/strings/str_cat.h"
33 #include "absl/strings/str_format.h"
34 #include "absl/strings/str_join.h"
35 #include "absl/strings/str_split.h"
36 #include "absl/strings/string_view.h"
40 namespace flags_internal {
46 const char* kTrue[] = {
"1",
"t",
"true",
"y",
"yes"};
47 const char* kFalse[] = {
"0",
"f",
"false",
"n",
"no"};
48 static_assert(
sizeof(kTrue) ==
sizeof(kFalse),
"true_false_equal");
71 const bool hex = (
text.size() >= 2 &&
text[0] ==
'0' &&
76 template <
typename IntType>
87 if (
static_cast<short>(val) != val)
89 *
dst =
static_cast<short>(val);
96 if (
static_cast<unsigned short>(val) !=
99 *
dst =
static_cast<unsigned short>(val);
174 template <
typename T>
185 roundtrip_val ==
v) {
206 *
err =
"no value provided";
209 if (
text.front() ==
'k' ||
text.front() ==
'K')
text.remove_prefix(1);
231 *
err =
"only integers and absl::LogSeverity enumerators are accepted";
ABSL_MUST_USE_RESULT absl::string_view StripAsciiWhitespace(absl::string_view str)
strings_internal::Splitter< typename strings_internal::SelectDelimiter< Delimiter >::type, AllowEmpty, absl::string_view > StrSplit(strings_internal::ConvertibleToStringView text, Delimiter d)
bool ParseFlagImpl(absl::string_view text, IntType &dst)
ABSL_NAMESPACE_BEGIN bool ParseFlag(absl::string_view input, T *dst, std::string *error)
std::string StrCat(const AlphaNum &a, const AlphaNum &b)
ABSL_MUST_USE_RESULT std::string StrFormat(const FormatSpec< Args... > &format, const Args &... args)
ABSL_NAMESPACE_BEGIN bool SimpleAtof(absl::string_view str, float *out)
static int NumericBase(absl::string_view text)
std::string Unparse(FlagOpFn op, const void *val)
std::string UnparseFlag(const T &v)
constexpr const char * LogSeverityName(absl::LogSeverity s)
#define ABSL_ARRAYSIZE(array)
#define ABSL_NAMESPACE_END
#define T(upbtypeconst, upbtype, ctype, default_value)
bool AbslParseFlag(absl::string_view text, absl::LogSeverity *dst, std::string *err)
#define ABSL_NAMESPACE_BEGIN
std::string StrJoin(Iterator start, Iterator end, absl::string_view sep, Formatter &&fmt)
constexpr absl::LogSeverity NormalizeLogSeverity(absl::LogSeverity s)
ABSL_NAMESPACE_BEGIN bool EqualsIgnoreCase(absl::string_view piece1, absl::string_view piece2) noexcept
std::string AbslUnparseFlag(absl::LogSeverity v)
bool SimpleAtod(absl::string_view str, double *out)
bool AbslParseFlag(absl::string_view text, bool *dst, std::string *)
std::string AbslUnparseFlag(absl::string_view v)
ABSL_MUST_USE_RESULT bool safe_strtoi_base(absl::string_view s, int_type *out, int base)
std::string UnparseFloatingPointVal(T v)
grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:21