Go to the documentation of this file.
41 if (token::compound::isCompound(tag))
43 os << tag << token::SPACE;
50 else if (
os.format() == IOstream::ASCII)
53 os << 0 << token::BEGIN_LIST << token::END_LIST;
70 os.writeKeyword(keyword);
73 os << token::END_STATEMENT <<
endl;
84 const UList<T>& list = *
this;
86 const label len = list.
size();
88 if (
os.format() == IOstream::BINARY && is_contiguous<T>::value)
97 os.write(list.cdata_bytes(), list.size_bytes());
100 else if (len > 1 && is_contiguous<T>::value && list.uniform())
103 os << len << token::BEGIN_BLOCK << list[0] << token::END_BLOCK;
107 (len <= 1 || !shortLen)
113 is_contiguous<T>::value
114 || Detail::ListPolicy::no_linebreak<T>::value
122 os << len << token::BEGIN_LIST;
125 for (label i=0; i < len; ++i)
127 if (i)
os << token::SPACE;
132 os << token::END_LIST;
139 os <<
nl << len <<
nl << token::BEGIN_LIST <<
nl;
142 for (label i=0; i < len; ++i)
148 os << token::END_LIST <<
nl;
162 const label len = list.
size();
168 is.
fatalCheck(
"UList<T>::readList(Istream&) : reading first token");
183 const label inputLen = elems.size();
189 <<
"incorrect length for UList. Read "
190 << inputLen <<
" expected " << len
194 for (label i = 0; i < len; ++i)
196 list[i] = std::move(elems[i]);
209 <<
"incorrect length for UList. Read "
210 << inputLen <<
" expected " << len
214 if (is.
format() == IOstream::BINARY && is_contiguous<T>::value)
220 Detail::readContiguous<T>
229 "UList<T>::readList(Istream&) : "
230 "reading binary block"
241 if (delimiter == token::BEGIN_LIST)
243 for (label i=0; i<len; ++i)
249 "UList<T>::readList(Istream&) : "
263 "UList<T>::readList(Istream&) : "
264 "reading the single entry"
267 for (label i=0; i<len; ++i)
286 if (sll.size() != len)
289 <<
"incorrect length for UList. Read "
290 << sll.size() <<
" expected " << len
295 for (label i = 0; i < len; ++i)
297 list[i] = std::move(sll.removeHead());
303 <<
"incorrect first token, expected <int> or '(', found "
const char * cdata_bytes() const noexcept
bool isLabel() const noexcept
A class for handling words, derived from Foam::string.
Ostream & writeList(Ostream &os, const label shortLen=0) const
char readBeginList(const char *funcName)
bool fatalCheck(const char *operation) const
streamFormat format() const noexcept
char readEndList(const char *funcName)
Ostream & endl(Ostream &os)
A token holds an item read from Istream.
char * data_bytes() noexcept
Template class for non-intrusive linked lists.
InfoProxy< token > info() const
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void transfer(List< T > &list)
bool isPunctuation() const noexcept
OBJstream os(runTime.globalPath()/outputName)
compound & transferCompoundToken()
void writeEntry(Ostream &os) const
errorManipArg< error, int > exit(error &err, const int errNo=1)
Istream & readList(Istream &is)
Non-intrusive singly-linked list.
To & dynamicCast(From &r)
A traits class, which is primarily used for primitives.
void putBack(const token &tok)
bool isCompound() const noexcept
#define FatalIOErrorInFunction(ios)
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
std::streamsize size_bytes() const noexcept
A template class to specify that a data type can be considered as being contiguous in memory.