24 #include <util/TextBuilder.h> 27 #include "NamespaceHelper.h" 33 template<
typename TFirst,
typename TSecond>
34 inline TextBuilder & operator<<(TextBuilder & tb, const std::pair<TFirst, TSecond> & obj) {
35 return tb << obj.first <<
':' << obj.second;
39 template<
class Container>
46 JoinWrapper(
const Container & ctnr,
const char * delim =
"\n")
50 if(delimiter ==
nullptr)
51 throw std::invalid_argument(
"JoinWrapper::ctor, delimiter can not be NULL");
54 : container(other.container), delimiter(other.delimiter){}
61 template<
class Container>
69 template<
class Container>
71 TextBuilder & operator<<(TextBuilder & tb, const JoinWrapper<Container> & wrapper)
73 const char *
const delimiter = wrapper.delimiter;
74 typename Container::const_iterator it = wrapper.container.begin(), e = wrapper.container.end();
80 tb << delimiter << *it ;
86 TextBuilder &
operator<<(TextBuilder & tb,
const HANDLER_NAMESPACE::OrderBookInternal& book)
88 tb << book.toFormattedString();
94 ONIXS_HANDLER_NAMESPACE_BEGIN
96 using Util::TextBuilder;
99 template<
typename TObj>
103 template<
typename TObj>
109 template<
typename TObj>
113 return stream << (tb << obj).toString();
116 template<
typename TObj>
120 return stream << (tb << obj).toString();
123 ONIXS_HANDLER_NAMESPACE_END
JoinWrapper(const Container &ctnr, const char *delim="\n")
const char *const delimiter
JoinWrapper(const JoinWrapper &other)
TextBuilder & operator<<(TextBuilder &tb, const std::pair< TFirst, TSecond > &obj)
JoinWrapper< Container > join(const Container &container, const char *delimiter)
std::ostream & TextBuilderToStdStream(std::ostream &stream, const TObj *obj)
const Container & container