35#ifndef Foam_FlatOutput_H
36#define Foam_FlatOutput_H
48template<
class Container,
class Delimiters>
class OutputAdaptor;
54template<
class Container,
class Delimiters>
70template<
char OpenChar,
char CloseChar,
char SepChar>
73 static constexpr char open = OpenChar;
74 static constexpr char close = CloseChar;
75 static constexpr char separator = SepChar;
80#define makeDecorator(Name, Open, Close, Sep) \
82 struct Name : public Decorators<Open, Close, Sep> {};
125template<
class Container,
class Delimiters>
131 const Container& values;
154 [[maybe_unused]]
bool started =
false;
156 if constexpr (Delimiters::open)
158 os << Delimiters::open;
160 for (
const auto& item : values)
162 if constexpr (Delimiters::separator)
164 if (started)
os << Delimiters::separator;
169 if constexpr (Delimiters::close)
171 os << Delimiters::close;
181 friend Ostream&
operator<<
187 return adaptor.write(
os);
204template<
class Container,
class Delimiters>
205inline FlatOutput::OutputAdaptor<Container, Delimiters>
208 const Container& obj,
212 return FlatOutput::OutputAdaptor<Container, Delimiters>(obj);
217template<
class Container>
#define makeDecorator(Name, Open, Close, Sep)
An output adaptor with a write method and an Ostream operator.
Ostream & write(Ostream &os) const
Write list using open, close and separator characters specified by Delimiters template,...
OutputAdaptor(const Container &obj) noexcept
Construct from const reference.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
OBJstream os(runTime.globalPath()/outputName)
Various output adaptors, principally to output a list of items on a single line.
messageStream Info
Information stream (stdout output on master, null elsewhere).
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
constexpr char nl
The newline '\n' character (0x0a).
Surround with '\0' and '\0' separate with ','.
Surround with '\0' and '\0' separate with ' '.
Surround with '{' and '}' separate with ','.
Surround with '{' and '}' separate with ' '.
List decorators with open, close and separator characters.
static constexpr char close
static constexpr char separator
static constexpr char open
Surround with '(' and ')' separate with ','.
Surround with '(' and ')' separate with ' '.
Surround with '<' and '>' separate with ','.
Surround with '<' and '>' separate with ' '.
Surround with '[' and ']' separate with ','.
Surround with '[' and ']' separate with ' '.