Tapkee
|
Namespaces | |
internal | |
utils | |
wrappers | |
Classes | |
class | formatting_error |
class | ValueWrapper |
Functions | |
std::string | format (const std::string &fmt, const ValueWrapper a) |
std::string | format (const std::string &fmt, const ValueWrapper a, const ValueWrapper b) |
std::string | format (const std::string &fmt, const ValueWrapper a, const ValueWrapper b, const ValueWrapper c) |
std::string | format (const std::string &fmt, const ValueWrapper a, const ValueWrapper b, const ValueWrapper c, const ValueWrapper d) |
std::string | format (const std::string &fmt, const ValueWrapper a, const ValueWrapper b, const ValueWrapper c, const ValueWrapper d, const ValueWrapper e) |
std::string | format (const std::string &fmt, const ValueWrapper a, const ValueWrapper b, const ValueWrapper c, const ValueWrapper d, const ValueWrapper e, const ValueWrapper f) |
std::string | format (const std::string &fmt, const ValueWrapper a, const ValueWrapper b, const ValueWrapper c, const ValueWrapper d, const ValueWrapper e, const ValueWrapper f, const ValueWrapper g) |
std::string | format (const std::string &fmt, const ValueWrapper a, const ValueWrapper b, const ValueWrapper c, const ValueWrapper d, const ValueWrapper e, const ValueWrapper f, const ValueWrapper g, const ValueWrapper h) |
std::string | format (const std::string &fmt, const ValueWrapper a, const ValueWrapper b, const ValueWrapper c, const ValueWrapper d, const ValueWrapper e, const ValueWrapper f, const ValueWrapper g, const ValueWrapper h, const ValueWrapper i) |
std::string | format (const std::string &fmt, const ValueWrapper a, const ValueWrapper b, const ValueWrapper c, const ValueWrapper d, const ValueWrapper e, const ValueWrapper f, const ValueWrapper g, const ValueWrapper h, const ValueWrapper i, const ValueWrapper j) |
template<typename T > | |
wrappers::HexWrapper< T > | hex (T value) |
template<typename T > | |
wrappers::OctWrapper< T > | oct (T value) |
wrappers::HexWrapper< size_t > | raw (void *value) |
wrappers::HexWrapper< size_t > | raw (const void *value) |
Variables | |
static const int | WORLD_VERSION = 0 |
static const int | MAJOR_VERSION = 1 |
static const int | MINOR_VERSION = 2 |
const std::string | placeholder = "{}" |
static unsigned int | default_precision = 9 |
static const wrappers::WidthWrapperBuilderHelper | width |
static const wrappers::PrecisionWrapperBuilderHelper | precision |
A simple formatter that uses simple "{}" placeholder. Resembles SLF4J and Python format.
Copyright (c) 2013, Sergey Lisitsyn lisit All rights reserved. syn. s.o@g mail .com
Distributed under the BSD 2-clause license:
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
std::string format | ( | const std::string & | fmt, |
const ValueWrapper | a | ||
) |
Constructs a string using the provided formatting string and arguments. Essentially, replaces all placeholders ("{}") in the string with the corresponding string representations of provided arguments (in the same order).
This function performs substitution of one variable.
Doesn't change the formatting string. Uses no shared state thus supposed to be thread-safe.
fmt | the formatting string that contains one {} placeholder. |
a | any variable which type has the stream insertion operator (operator<<) implemented. |
formatting_error | in case the number of placeholders doesn't match the number of provided parameters |
Definition at line 411 of file formatting.hpp.
std::string format | ( | const std::string & | fmt, |
const ValueWrapper | a, | ||
const ValueWrapper | b | ||
) |
Constructs a string using the provided formatting string and arguments. Essentially, replaces all placeholders ("{}") in the string with the corresponding string representations of provided arguments (in the same order).
This function performs substitution of one variable.
Doesn't change the formatting string. Uses no shared state thus supposed to be thread-safe.
fmt | the formatting string that contains 2 {} placeholders. |
a | any variable which type has the stream insertion operator (operator<<) implemented. |
b | any variable which type has the stream insertion operator (operator<<) implemented. |
formatting_error | in case the number of placeholders doesn't match the number of provided parameters |
Definition at line 418 of file formatting.hpp.
std::string format | ( | const std::string & | fmt, |
const ValueWrapper | a, | ||
const ValueWrapper | b, | ||
const ValueWrapper | c | ||
) |
Constructs a string using the provided formatting string and arguments. Essentially, replaces all placeholders ("{}") in the string with the corresponding string representations of provided arguments (in the same order).
This function performs substitution of one variable.
Doesn't change the formatting string. Uses no shared state thus supposed to be thread-safe.
fmt | the formatting string that contains 3 {} placeholders. |
a | any variable which type has the stream insertion operator (operator<<) implemented. |
b | any variable which type has the stream insertion operator (operator<<) implemented. |
c | any variable which type has the stream insertion operator (operator<<) implemented. |
formatting_error | in case the number of placeholders doesn't match the number of provided parameters |
Definition at line 425 of file formatting.hpp.
std::string format | ( | const std::string & | fmt, |
const ValueWrapper | a, | ||
const ValueWrapper | b, | ||
const ValueWrapper | c, | ||
const ValueWrapper | d | ||
) |
Constructs a string using the provided formatting string and arguments. Essentially, replaces all placeholders ("{}") in the string with the corresponding string representations of provided arguments (in the same order).
This function performs substitution of one variable.
Doesn't change the formatting string. Uses no shared state thus supposed to be thread-safe.
fmt | the formatting string that contains 4 {} placeholders. |
a | any variable which type has the stream insertion operator (operator<<) implemented. |
b | any variable which type has the stream insertion operator (operator<<) implemented. |
c | any variable which type has the stream insertion operator (operator<<) implemented. |
d | any variable which type has the stream insertion operator (operator<<) implemented. |
formatting_error | in case the number of placeholders doesn't match the number of provided parameters |
Definition at line 433 of file formatting.hpp.
std::string format | ( | const std::string & | fmt, |
const ValueWrapper | a, | ||
const ValueWrapper | b, | ||
const ValueWrapper | c, | ||
const ValueWrapper | d, | ||
const ValueWrapper | e | ||
) |
Constructs a string using the provided formatting string and arguments. Essentially, replaces all placeholders ("{}") in the string with the corresponding string representations of provided arguments (in the same order).
This function performs substitution of one variable.
Doesn't change the formatting string. Uses no shared state thus supposed to be thread-safe.
fmt | the formatting string that contains 5 {} placeholders. |
a | any variable which type has the stream insertion operator (operator<<) implemented. |
b | any variable which type has the stream insertion operator (operator<<) implemented. |
c | any variable which type has the stream insertion operator (operator<<) implemented. |
d | any variable which type has the stream insertion operator (operator<<) implemented. |
e | any variable which type has the stream insertion operator (operator<<) implemented. |
formatting_error | in case the number of placeholders doesn't match the number of provided parameters |
Definition at line 441 of file formatting.hpp.
std::string format | ( | const std::string & | fmt, |
const ValueWrapper | a, | ||
const ValueWrapper | b, | ||
const ValueWrapper | c, | ||
const ValueWrapper | d, | ||
const ValueWrapper | e, | ||
const ValueWrapper | f | ||
) |
Constructs a string using the provided formatting string and arguments. Essentially, replaces all placeholders ("{}") in the string with the corresponding string representations of provided arguments (in the same order).
This function performs substitution of one variable.
Doesn't change the formatting string. Uses no shared state thus supposed to be thread-safe.
fmt | the formatting string that contains 6 {} placeholders. |
a | any variable which type has the stream insertion operator (operator<<) implemented. |
b | any variable which type has the stream insertion operator (operator<<) implemented. |
c | any variable which type has the stream insertion operator (operator<<) implemented. |
d | any variable which type has the stream insertion operator (operator<<) implemented. |
e | any variable which type has the stream insertion operator (operator<<) implemented. |
f | any variable which type has the stream insertion operator (operator<<) implemented. |
formatting_error | in case the number of placeholders doesn't match the number of provided parameters |
Definition at line 450 of file formatting.hpp.
std::string format | ( | const std::string & | fmt, |
const ValueWrapper | a, | ||
const ValueWrapper | b, | ||
const ValueWrapper | c, | ||
const ValueWrapper | d, | ||
const ValueWrapper | e, | ||
const ValueWrapper | f, | ||
const ValueWrapper | g | ||
) |
Constructs a string using the provided formatting string and arguments. Essentially, replaces all placeholders ("{}") in the string with the corresponding string representations of provided arguments (in the same order).
This function performs substitution of one variable.
Doesn't change the formatting string. Uses no shared state thus supposed to be thread-safe.
fmt | the formatting string that contains 7 {} placeholders. |
a | any variable which type has the stream insertion operator (operator<<) implemented. |
b | any variable which type has the stream insertion operator (operator<<) implemented. |
c | any variable which type has the stream insertion operator (operator<<) implemented. |
d | any variable which type has the stream insertion operator (operator<<) implemented. |
e | any variable which type has the stream insertion operator (operator<<) implemented. |
f | any variable which type has the stream insertion operator (operator<<) implemented. |
g | any variable which type has the stream insertion operator (operator<<) implemented. |
formatting_error | in case the number of placeholders doesn't match the number of provided parameters |
Definition at line 459 of file formatting.hpp.
std::string format | ( | const std::string & | fmt, |
const ValueWrapper | a, | ||
const ValueWrapper | b, | ||
const ValueWrapper | c, | ||
const ValueWrapper | d, | ||
const ValueWrapper | e, | ||
const ValueWrapper | f, | ||
const ValueWrapper | g, | ||
const ValueWrapper | h | ||
) |
Constructs a string using the provided formatting string and arguments. Essentially, replaces all placeholders ("{}") in the string with the corresponding string representations of provided arguments (in the same order).
This function performs substitution of one variable.
Doesn't change the formatting string. Uses no shared state thus supposed to be thread-safe.
fmt | the formatting string that contains 8 {} placeholders. |
a | any variable which type has the stream insertion operator (operator<<) implemented. |
b | any variable which type has the stream insertion operator (operator<<) implemented. |
c | any variable which type has the stream insertion operator (operator<<) implemented. |
d | any variable which type has the stream insertion operator (operator<<) implemented. |
e | any variable which type has the stream insertion operator (operator<<) implemented. |
f | any variable which type has the stream insertion operator (operator<<) implemented. |
g | any variable which type has the stream insertion operator (operator<<) implemented. |
h | any variable which type has the stream insertion operator (operator<<) implemented. |
formatting_error | in case the number of placeholders doesn't match the number of provided parameters |
Definition at line 469 of file formatting.hpp.
std::string format | ( | const std::string & | fmt, |
const ValueWrapper | a, | ||
const ValueWrapper | b, | ||
const ValueWrapper | c, | ||
const ValueWrapper | d, | ||
const ValueWrapper | e, | ||
const ValueWrapper | f, | ||
const ValueWrapper | g, | ||
const ValueWrapper | h, | ||
const ValueWrapper | i | ||
) |
Constructs a string using the provided formatting string and arguments. Essentially, replaces all placeholders ("{}") in the string with the corresponding string representations of provided arguments (in the same order).
This function performs substitution of one variable.
Doesn't change the formatting string. Uses no shared state thus supposed to be thread-safe.
fmt | the formatting string that contains 9 {} placeholders. |
a | any variable which type has the stream insertion operator (operator<<) implemented. |
b | any variable which type has the stream insertion operator (operator<<) implemented. |
c | any variable which type has the stream insertion operator (operator<<) implemented. |
d | any variable which type has the stream insertion operator (operator<<) implemented. |
e | any variable which type has the stream insertion operator (operator<<) implemented. |
f | any variable which type has the stream insertion operator (operator<<) implemented. |
g | any variable which type has the stream insertion operator (operator<<) implemented. |
h | any variable which type has the stream insertion operator (operator<<) implemented. |
i | any variable which type has the stream insertion operator (operator<<) implemented. |
formatting_error | in case the number of placeholders doesn't match the number of provided parameters |
Definition at line 479 of file formatting.hpp.
std::string format | ( | const std::string & | fmt, |
const ValueWrapper | a, | ||
const ValueWrapper | b, | ||
const ValueWrapper | c, | ||
const ValueWrapper | d, | ||
const ValueWrapper | e, | ||
const ValueWrapper | f, | ||
const ValueWrapper | g, | ||
const ValueWrapper | h, | ||
const ValueWrapper | i, | ||
const ValueWrapper | j | ||
) |
Constructs a string using the provided formatting string and arguments. Essentially, replaces all placeholders ("{}") in the string with the corresponding string representations of provided arguments (in the same order).
This function performs substitution of one variable.
Doesn't change the formatting string. Uses no shared state thus supposed to be thread-safe.
fmt | the formatting string that contains 10 {} placeholders. |
a | any variable which type has the stream insertion operator (operator<<) implemented. |
b | any variable which type has the stream insertion operator (operator<<) implemented. |
c | any variable which type has the stream insertion operator (operator<<) implemented. |
d | any variable which type has the stream insertion operator (operator<<) implemented. |
e | any variable which type has the stream insertion operator (operator<<) implemented. |
f | any variable which type has the stream insertion operator (operator<<) implemented. |
g | any variable which type has the stream insertion operator (operator<<) implemented. |
h | any variable which type has the stream insertion operator (operator<<) implemented. |
i | any variable which type has the stream insertion operator (operator<<) implemented. |
j | any variable which type has the stream insertion operator (operator<<) implemented. |
formatting_error | in case the number of placeholders doesn't match the number of provided parameters |
Definition at line 490 of file formatting.hpp.
wrappers::HexWrapper<T> formatting::hex | ( | T | value | ) |
Returns a wrapper that makes the provided value represented as hex when formatting.
E.g. formatting::hex(10) => '0xA'
value | a numerical value to be presented as hex |
Definition at line 173 of file wrappers.hpp.
wrappers::OctWrapper<T> formatting::oct | ( | T | value | ) |
Returns a wrapper that makes the provided value represented as oct when formatting.
E.g formatting::oct(9) => '011'
value | a numerical value to be presented as oct |
Definition at line 186 of file wrappers.hpp.
wrappers::HexWrapper<size_t> formatting::raw | ( | void * | value | ) |
Returns a wrapper that makes the provided pointer represented as hex value of a pointer.
value | a pointer to be represented as hex |
Definition at line 196 of file wrappers.hpp.
wrappers::HexWrapper<size_t> formatting::raw | ( | const void * | value | ) |
Returns a wrapper that makes the provided pointer represented as hex value of a pointer.
value | a pointer to be represented as hex |
Definition at line 207 of file wrappers.hpp.
|
static |
Default precision - be careful to change due to no thread safety
Definition at line 36 of file implementations.hpp.
|
static |
Definition at line 43 of file formatting.hpp.
|
static |
Definition at line 44 of file formatting.hpp.
const std::string placeholder = "{}" |
The placeholder of formatter.
Definition at line 47 of file formatting.hpp.
|
static |
Precision wrapper helper that allows to set output precision with the brackets operator (e.g. precision6 => "2.71828")
Definition at line 222 of file wrappers.hpp.
|
static |
Width wrapper helper that allows to set output width with the brackets operator (e.g. width[3]('c') => " c").
Definition at line 216 of file wrappers.hpp.
|
static |
Definition at line 42 of file formatting.hpp.