7 #include <packager/hls/base/tag.h>
11 #include <absl/strings/str_format.h>
16 Tag::Tag(
const std::string& name, std::string* buffer) : buffer_(buffer) {
17 absl::StrAppendFormat(buffer_,
"%s:", name.c_str());
20 void Tag::AddString(
const std::string& key,
const std::string& value) {
22 absl::StrAppendFormat(buffer_,
"%s=%s", key.c_str(), value.c_str());
25 void Tag::AddQuotedString(
const std::string& key,
const std::string& value) {
27 absl::StrAppendFormat(buffer_,
"%s=\"%s\"", key.c_str(), value.c_str());
30 void Tag::AddNumber(
const std::string& key, uint64_t value) {
32 absl::StrAppendFormat(buffer_,
"%s=%" PRIu64, key.c_str(), value);
35 void Tag::AddFloat(
const std::string& key,
float value) {
37 absl::StrAppendFormat(buffer_,
"%s=%.3f", key.c_str(), value);
40 void Tag::AddNumberPair(
const std::string& key,
45 absl::StrAppendFormat(buffer_,
"%s=%" PRIu64
"%c%" PRIu64, key.c_str(),
46 number1, separator, number2);
49 void Tag::AddQuotedNumberPair(
const std::string& key,
54 absl::StrAppendFormat(buffer_,
"%s=\"%" PRIu64
"%c%" PRIu64
"\"", key.c_str(),
55 number1, separator, number2);
58 void Tag::NextField() {
All the methods that are virtual are virtual for mocking.