about summary refs log tree commit diff
path: root/absl/strings/internal/str_format/bind.cc
diff options
context:
space:
mode:
authorXiaoyi Zhang <zhangxy@google.com>2020-02-21T16·05+0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2020-02-21T16·05+0000
commit2a5633fc077a58528cdbfe78720f3f6bfdc6044d (patch)
tree36175e9725b2e6cc65230983925e692abdbd6b9c /absl/strings/internal/str_format/bind.cc
parentf9b3d6e493c1b6ab3dbdab71c5f8fa849db4abaf (diff)
parent914ff44510505f209d8e85a01e31f4c5fb1b6a5b (diff)
Merge "Export of internal Abseil changes"
Diffstat (limited to 'absl/strings/internal/str_format/bind.cc')
-rw-r--r--absl/strings/internal/str_format/bind.cc27
1 files changed, 16 insertions, 11 deletions
diff --git a/absl/strings/internal/str_format/bind.cc b/absl/strings/internal/str_format/bind.cc
index 2d19b613e43d..27522fdb4f62 100644
--- a/absl/strings/internal/str_format/bind.cc
+++ b/absl/strings/internal/str_format/bind.cc
@@ -66,18 +66,22 @@ inline bool ArgContext::Bind(const UnboundConversion* unbound,
         return false;
     }
 
-    bound->set_width(width);
-    bound->set_precision(precision);
-    bound->set_flags(unbound->flags);
-    if (force_left)
-      bound->set_left(true);
+    FormatConversionSpecImplFriend::SetWidth(width, bound);
+    FormatConversionSpecImplFriend::SetPrecision(precision, bound);
+
+    if (force_left) {
+      Flags flags = unbound->flags;
+      flags.left = true;
+      FormatConversionSpecImplFriend::SetFlags(flags, bound);
+    } else {
+      FormatConversionSpecImplFriend::SetFlags(unbound->flags, bound);
+    }
   } else {
-    bound->set_flags(unbound->flags);
-    bound->set_width(-1);
-    bound->set_precision(-1);
+    FormatConversionSpecImplFriend::SetFlags(unbound->flags, bound);
+    FormatConversionSpecImplFriend::SetWidth(-1, bound);
+    FormatConversionSpecImplFriend::SetPrecision(-1, bound);
   }
-
-  bound->set_conv(unbound->conv);
+  FormatConversionSpecImplFriend::SetConversionChar(unbound->conv, bound);
   bound->set_arg(arg);
   return true;
 }
@@ -139,7 +143,8 @@ class SummarizingConverter {
     UntypedFormatSpecImpl spec("%d");
 
     std::ostringstream ss;
-    ss << "{" << Streamable(spec, {*bound.arg()}) << ":" << bound.flags();
+    ss << "{" << Streamable(spec, {*bound.arg()}) << ":"
+       << FormatConversionSpecImplFriend::FlagsToString(bound);
     if (bound.width() >= 0) ss << bound.width();
     if (bound.precision() >= 0) ss << "." << bound.precision();
     ss << bound.conv() << "}";