Lumiera
0.pre.03
»edit your freedom«
|
Go to the source code of this file.
Collection of small helpers and convenience shortcuts for diagnostics & formatting.
Definition in file format-util.hpp.
#include "lib/meta/trait.hpp"
#include "lib/format-obj.hpp"
#include "lib/itertools.hpp"
#include "lib/symbol.hpp"
#include "lib/util.hpp"
#include <string>
#include <vector>
#include <sstream>
#include <utility>
#include <typeinfo>
Classes | |
struct | _RangeIter< CON, TOGGLE > |
struct | _RangeIter< IT, lib::meta::enable_if< can_IterForEach< IT > > > |
struct | SeqContainer< CON, ELMS > |
struct | SeqContainer< vector< X >, ELMS... > |
Functions | |
template<class CON , typename... ELMS> | |
CON | collectStr (ELMS const &...elms) |
convert a sequence of elements to string More... | |
template<class CON > | |
void | do_stringify (CON &) |
template<class CON , typename X , typename... ELMS> | |
void | do_stringify (CON &container, X const &elm, ELMS const &...args) |
template<class CON > | |
string | join (CON &&coll, string const &delim=", ") |
enumerate a collection's contents, separated by delimiter. More... | |
template<class X > | |
string | join (std::initializer_list< X > const &&ili, string const &delim=", ") |
template<typename... ARGS> | |
string | joinArgList (ARGS const &...args) |
shortcut: List in parentheses, separated by comma, using temporary vector | |
template<typename... ARGS> | |
string | joinDash (ARGS const &...args) |
shortcut: join directly with dashes | |
template<typename... ARGS> | |
string | joinDot (ARGS const &...args) |
shortcut: join directly with dots | |
template<typename... ELMS> | |
vector< string > | stringify (ELMS const &...elms) |
standard setup: convert to string into a vector | |
template<class IT > | |
auto | stringify (IT &&src) |
convert to string as transforming step in a pipeline More... | |
Namespaces |
|
inline |
convert a sequence of elements to string
elms | sequence of arbitrary elements |
CON | the container type to collect the results |
Definition at line 111 of file format-util.hpp.
References util::collectStr().
Referenced by util::collectStr().
|
inline |
convert to string as transforming step in a pipeline
src | a "Lumiera Forward Iterator" with arbitrary result type |
Definition at line 133 of file format-util.hpp.
References util::stringify(), and lib::transformIterator().
|
inline |
enumerate a collection's contents, separated by delimiter.
coll | something that is standard- or Lumiera-iterable |
ostringstream
; additionally, we use our failsafe string conversion, which in turn invokes custom string conversion, or lexical_cast as appropriate. boost::join
library function could be used, which works on arbitrary sequences, which incurs some additional weight (both in terms of header include and debug code size). And failures on template substitution tend to be hard to understand, since this generic sequence concept is just so danm absolutely generic (In fact that was the reason why I gave up and just rolled our own join
utility) Definition at line 193 of file format-util.hpp.
Referenced by FormatHelper_test::checkStringJoin().