mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-14 02:57:45 +01:00
add additional overloads for Poco::format
This commit is contained in:
parent
35ce47c66e
commit
701a34f2e7
@ -117,7 +117,7 @@ void Foundation_API format(std::string& result, const std::string& fmt, const st
|
|||||||
template <
|
template <
|
||||||
typename T,
|
typename T,
|
||||||
typename... Args>
|
typename... Args>
|
||||||
void format(std::string &result, const std::string &fmt, T arg1, Args... args)
|
void format(std::string& result, const std::string& fmt, T arg1, Args... args)
|
||||||
/// Appends the formatted string to result.
|
/// Appends the formatted string to result.
|
||||||
{
|
{
|
||||||
std::vector<Any> values;
|
std::vector<Any> values;
|
||||||
@ -129,11 +129,39 @@ void format(std::string &result, const std::string &fmt, T arg1, Args... args)
|
|||||||
|
|
||||||
|
|
||||||
template <
|
template <
|
||||||
typename FMT,
|
|
||||||
typename T,
|
typename T,
|
||||||
typename... Args,
|
typename... Args>
|
||||||
typename std::enable_if<std::is_const<typename std::remove_reference<FMT>::type>::value, int>::type = 0>
|
void format(std::string& result, const char* fmt, T arg1, Args... args)
|
||||||
std::string format(FMT &fmt, T arg1, Args... args)
|
/// Appends the formatted string to result.
|
||||||
|
{
|
||||||
|
std::vector<Any> values;
|
||||||
|
values.reserve(sizeof...(Args) + 1);
|
||||||
|
values.emplace_back(arg1);
|
||||||
|
values.insert(values.end(), { args... });
|
||||||
|
format(result, fmt, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <
|
||||||
|
typename T,
|
||||||
|
typename... Args>
|
||||||
|
std::string format(const std::string& fmt, T arg1, Args... args)
|
||||||
|
/// Returns the formatted string.
|
||||||
|
{
|
||||||
|
std::vector<Any> values;
|
||||||
|
values.reserve(sizeof...(Args) + 1);
|
||||||
|
values.emplace_back(arg1);
|
||||||
|
values.insert(values.end(), { args... });
|
||||||
|
std::string result;
|
||||||
|
format(result, fmt, values);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <
|
||||||
|
typename T,
|
||||||
|
typename... Args>
|
||||||
|
std::string format(const char* fmt, T arg1, Args... args)
|
||||||
/// Returns the formatted string.
|
/// Returns the formatted string.
|
||||||
{
|
{
|
||||||
std::vector<Any> values;
|
std::vector<Any> values;
|
||||||
|
Loading…
Reference in New Issue
Block a user