2015-03-09 20:18:10 +00:00
|
|
|
#ifndef BENCHMARK_STRING_UTIL_H_
|
|
|
|
#define BENCHMARK_STRING_UTIL_H_
|
2015-03-06 22:01:05 +00:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <sstream>
|
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
namespace benchmark {
|
|
|
|
|
|
|
|
void AppendHumanReadable(int n, std::string* str);
|
|
|
|
|
|
|
|
std::string HumanReadableNumber(double n);
|
|
|
|
|
|
|
|
std::string StringPrintF(const char* format, ...);
|
|
|
|
|
|
|
|
inline std::ostream&
|
|
|
|
StringCatImp(std::ostream& out) noexcept
|
|
|
|
{
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class First, class ...Rest>
|
|
|
|
inline std::ostream&
|
|
|
|
StringCatImp(std::ostream& out, First&& f, Rest&&... rest)
|
|
|
|
{
|
|
|
|
out << std::forward<First>(f);
|
|
|
|
return StringCatImp(out, std::forward<Rest>(rest)...);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class ...Args>
|
|
|
|
inline std::string StrCat(Args&&... args)
|
|
|
|
{
|
|
|
|
std::ostringstream ss;
|
|
|
|
StringCatImp(ss, std::forward<Args>(args)...);
|
|
|
|
return ss.str();
|
|
|
|
}
|
|
|
|
|
2015-03-27 21:06:33 +00:00
|
|
|
void ReplaceAll(std::string* str, const std::string& from,
|
|
|
|
const std::string& to);
|
|
|
|
|
2015-03-06 22:01:05 +00:00
|
|
|
} // end namespace benchmark
|
|
|
|
|
2015-03-09 20:18:10 +00:00
|
|
|
#endif // BENCHMARK_STRING_UTIL_H_
|