Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
format-util.hpp File Reference

Collection of small helpers and convenience shortcuts for diagnostics & formatting. More...

Go to the source code of this file.

Description

Collection of small helpers and convenience shortcuts for diagnostics & formatting.

  • util::str() performs a failsafe to-String conversion, thereby preferring a built-in conversion operator, falling back to just a mangled type string.
  • util::join() generates an enumerating string from elements of an arbitrary sequence or iterable. Elements will be passed through our generic string conversion
See also
FormatHelper_test
frontend for boost::format, printf-style

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 <array>
#include <string>
#include <vector>
#include <sstream>
#include <utility>
#include <typeinfo>

Namespaces

namespace  util
 
namespace  util::anonymous_namespace{format-util.hpp}
 

Classes

struct  SeqContainer< CON, ELMS >
 
struct  SeqContainer< vector< X >, ELMS... >
 
struct  _RangeIter< CON, TOGGLE >
 
struct  _RangeIter< IT, lib::meta::enable_if< can_IterForEach< IT > > >
 
struct  StringConv< std::array< T, N > >
 convenient pretty-printer for std::array instances More...
 

Functions

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 , typename... ELMS>
CON collectStr (ELMS const &...elms)
 convert a sequence of elements to string
 
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
 
template<class COLL >
string join (COLL &&coll, string const &delim=", ")
 enumerate a collection's contents, separated by delimiter.
 
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<class COLL >
string toStringParen (COLL &&coll)
 one-argument variant that can be forward declared...
 
template<class COLL >
string toStringBracket (COLL &&coll)