102 void set_arg(
int index,
const std::string &text);
109 void set_arg(
int index,
int value,
int min_length = 0);
116 void set_arg(
int index,
unsigned int value,
int min_length = 0);
123 void set_arg(
int index,
long unsigned int value,
int min_length = 0);
130 void set_arg(
int index,
long long value,
int min_length = 0);
137 void set_arg(
int index,
unsigned long long value,
int min_length = 0);
162 void create_arg(
int index,
int start,
int length);
174 std::vector<ArgPosition> args;
183 template <
class Arg1>
188 template <
class Arg1,
class Arg2>
190 {
StringFormat f(format);
f.set_arg(1, arg1);
f.set_arg(2, arg2);
return f.get_result(); }
193 template <
class Arg1,
class Arg2,
class Arg3>
194 std::string
string_format(
const std::string &format, Arg1 arg1, Arg2 arg2, Arg3 arg3)
195 {
StringFormat f(format);
f.set_arg(1, arg1);
f.set_arg(2, arg2);
f.set_arg(3, arg3);
return f.get_result(); }
198 template <
class Arg1,
class Arg2,
class Arg3,
class Arg4>
199 std::string
string_format(
const std::string &format, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
200 {
StringFormat f(format);
f.set_arg(1, arg1);
f.set_arg(2, arg2);
f.set_arg(3, arg3);
f.set_arg(4, arg4);
return f.get_result(); }
203 template <
class Arg1,
class Arg2,
class Arg3,
class Arg4,
class Arg5>
204 std::string
string_format(
const std::string &format, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5)
205 {
StringFormat f(format);
f.set_arg(1, arg1);
f.set_arg(2, arg2);
f.set_arg(3, arg3);
f.set_arg(4, arg4);
f.set_arg(5, arg5);
return f.get_result(); }
208 template <
class Arg1,
class Arg2,
class Arg3,
class Arg4,
class Arg5,
class Arg6>
209 std::string
string_format(
const std::string &format, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5, Arg6 arg6)
210 {
StringFormat f(format);
f.set_arg(1, arg1);
f.set_arg(2, arg2);
f.set_arg(3, arg3);
f.set_arg(4, arg4);
f.set_arg(5, arg5);
f.set_arg(6, arg6);
return f.get_result(); }
213 template <
class Arg1,
class Arg2,
class Arg3,
class Arg4,
class Arg5,
class Arg6,
class Arg7>
214 std::string
string_format(
const std::string &format, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5, Arg6 arg6, Arg7 arg7)
215 {
StringFormat f(format);
f.set_arg(1, arg1);
f.set_arg(2, arg2);
f.set_arg(3, arg3);
f.set_arg(4, arg4);
f.set_arg(5, arg5);
f.set_arg(6, arg6);
f.set_arg(7, arg7);
return f.get_result(); }
const std::string & get_result() const
Retrieves the formatted string with all argument replacements.
void set_arg(int index, int value, int min_length=0)
Sets an argument (int version)
void set_arg(int index, long unsigned int value, int min_length=0)
Sets an argument (long unsigned int version)
void set_arg(int index, const std::string &text)
Sets an argument (string version)
ArgPosition(int s, int l)
Definition: string_format.h:169
std::string string_format(const std::string &format)
See clan::StringFormat for details.
Definition: string_format.h:179
@ length
value is a keyword
void set_arg(int index, double value)
Sets an argument (double version)
void set_arg(int index, long long value, int min_length=0)
Sets an argument (long long version)
int start
Definition: string_format.h:170
void set_arg(int index, unsigned int value, int min_length=0)
Sets an argument (unsigned int version)
int length
Definition: string_format.h:171
ArgPosition()
Definition: string_format.h:168
void set_arg(int index, unsigned long long value, int min_length=0)
Sets an argument (unsigned long long version)
void set_arg(int index, float value)
Sets an argument (float version)
StringFormat(const std::string &format_string)
Constructs a formatted string object.