Add String Formatting Util

(Merged from http://go/wvgerrit/160042.)

Since we don't have access to std::format yet, this patch adds a
function to wvutil to format text into a std::string.

Bug: 255466913
Test: x86-64
Test: raven
Change-Id: I28043da76af5b4772a29fa7e7241343caf9b54a1
This commit is contained in:
John "Juce" Bruce
2022-11-14 21:20:40 -08:00
committed by John Bruce
parent a3e67a9104
commit ff73463d0b
5 changed files with 124 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
// Copyright 2022 Google LLC. All Rights Reserved. This file and proprietary
// source code may only be used and distributed under the Widevine License
// Agreement.
#ifndef WVCDM_UTIL_STRING_FORMAT_H_
#define WVCDM_UTIL_STRING_FORMAT_H_
#include <string>
namespace wvutil {
#ifdef __GNUC__
[[gnu::format(printf, 2, 3)]]
#endif
bool FormatString(std::string* out, const char* fmt, ...);
} // namespace wvutil
#endif // WVCDM_UTIL_STRING_FORMAT_H_