diff options
author | Abseil Team <absl-team@google.com> | 2020-02-07 13:06:07 -0800 |
---|---|---|
committer | Andy Getz <durandal@google.com> | 2020-02-07 16:58:49 -0500 |
commit | d95d1567165d449e4c213ea31a15cbb112a9865f (patch) | |
tree | fee6dca04f49a417f87c4c96551f366279cf9b61 /absl/strings/internal/str_format/extension.h | |
parent | 24713a7036a81498334807fa5c7ad3cb7c643711 (diff) |
Export of internal Abseil changes
--
832be2d52d7695cf72fd70248909791fb8ad1003 by Gennadiy Rozental <rogeeff@google.com>:
Migrate some FlagImpl fields to bit fields.
To save padding space we are migrating some fields representing bool and enums into bit fields. Eventually we'll use remaining padding space for call_once control flag.
No other semantic changes made in this CL.
PiperOrigin-RevId: 293878165
--
09162bba5fd8eddacfd732d46fcfeb33074a259f by Samuel Benzaquen <sbenza@google.com>:
Correctly initialize the `length_mod` member.
Now that it is a raw enum, the default initialization is not enough.
PiperOrigin-RevId: 293827817
--
842b7b805d75c5ab670c52ccd7368cdeba11853d by Matthew Brown <matthewbr@google.com>:
Move str_format_internal::LengthMod from extension.h to parser.h; change to enum
PiperOrigin-RevId: 293697274
GitOrigin-RevId: 832be2d52d7695cf72fd70248909791fb8ad1003
Change-Id: I90899519e9480543e22638616fdf31a41e7f75c0
Diffstat (limited to 'absl/strings/internal/str_format/extension.h')
-rw-r--r-- | absl/strings/internal/str_format/extension.h | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/absl/strings/internal/str_format/extension.h b/absl/strings/internal/str_format/extension.h index 0a764035..4868eac3 100644 --- a/absl/strings/internal/str_format/extension.h +++ b/absl/strings/internal/str_format/extension.h @@ -136,54 +136,6 @@ struct Flags { } }; -struct ABSL_DLL LengthMod { - public: - enum Id : uint8_t { - h, hh, l, ll, L, j, z, t, q, none - }; - static const size_t kNumValues = none + 1; - - LengthMod() : id_(none) {} - - // Index into the opaque array of LengthMod enums. - // Requires: i < kNumValues - static LengthMod FromIndex(size_t i) { - return LengthMod(kSpecs[i].value); - } - - static LengthMod FromId(Id id) { return LengthMod(id); } - - // The length modifier std::string associated with a specified LengthMod. - string_view name() const { - const Spec& spec = kSpecs[id_]; - return {spec.name, spec.name_length}; - } - - Id id() const { return id_; } - - friend bool operator==(const LengthMod& a, const LengthMod& b) { - return a.id() == b.id(); - } - friend bool operator!=(const LengthMod& a, const LengthMod& b) { - return !(a == b); - } - friend std::ostream& operator<<(std::ostream& os, const LengthMod& v) { - return os << v.name(); - } - - private: - struct Spec { - Id value; - const char *name; - size_t name_length; - }; - static const Spec kSpecs[]; - - explicit LengthMod(Id id) : id_(id) {} - - Id id_; -}; - // clang-format off #define ABSL_CONVERSION_CHARS_EXPAND_(X_VAL, X_SEP) \ /* text */ \ @@ -306,7 +258,6 @@ struct ABSL_DLL ConversionChar { class ConversionSpec { public: Flags flags() const { return flags_; } - LengthMod length_mod() const { return length_mod_; } ConversionChar conv() const { // Keep this field first in the struct . It generates better code when // accessing it when ConversionSpec is passed by value in registers. @@ -322,7 +273,6 @@ class ConversionSpec { int precision() const { return precision_; } void set_flags(Flags f) { flags_ = f; } - void set_length_mod(LengthMod lm) { length_mod_ = lm; } void set_conv(ConversionChar c) { conv_ = c; } void set_width(int w) { width_ = w; } void set_precision(int p) { precision_ = p; } @@ -331,7 +281,6 @@ class ConversionSpec { private: ConversionChar conv_; Flags flags_; - LengthMod length_mod_; int width_; int precision_; }; |