/usr/include/globjects/base/formatString.inl is in libglobjects-dev 1.0.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #pragma once
#include <sstream>
#include <cassert>
namespace globjects
{
template <typename T, typename... Args>
void streamprintf(std::ostream& stream, const char* format, const T& value, Args... args)
{
assert(format != nullptr);
while (*format)
{
if (*format == '%' && *++format != '%')
{
auto flags = stream.flags();
parseFormat(stream, format);
stream << value;
stream.flags(flags);
streamprintf(stream, format, args...);
return;
}
else
stream << *format++;
}
}
template <typename... Args>
std::string formatString(const char* format, Args... args)
{
assert(format != nullptr);
std::stringstream ss;
streamprintf(ss, format, args...);
return ss.str();
}
} // namespace globjects
|