STYLE: minor improvement when writing list entry

This commit is contained in:
Mark Olesen
2016-07-01 09:55:51 +02:00
parent ce121c92dc
commit 9965c5006c
3 changed files with 10 additions and 15 deletions

View File

@ -138,12 +138,10 @@ Foam::Istream& Foam::operator>>(Foam::Istream& is, FixedList<T, Size>& L)
template<class T, unsigned Size>
void Foam::FixedList<T, Size>::writeEntry(Ostream& os) const
{
if
(
token::compound::isCompound("List<" + word(pTraits<T>::typeName) + '>')
)
const word tag = "List<" + word(pTraits<T>::typeName) + '>';
if (token::compound::isCompound(tag))
{
os << word("List<" + word(pTraits<T>::typeName) + '>') << " ";
os << tag << " ";
}
os << *this;

View File

@ -219,7 +219,7 @@ public:
//- Copy elements of the given UList
void deepCopy(const UList<T>&);
//- Write the UList as a dictionary entry
//- Write the UList with its compound type
void writeEntry(Ostream&) const;
//- Write the UList as a dictionary entry with keyword

View File

@ -34,16 +34,13 @@ License
template<class T>
void Foam::UList<T>::writeEntry(Ostream& os) const
{
if
(
size()
&& token::compound::isCompound
(
"List<" + word(pTraits<T>::typeName) + '>'
)
)
if (size())
{
os << word("List<" + word(pTraits<T>::typeName) + '>') << " ";
const word tag = "List<" + word(pTraits<T>::typeName) + '>';
if (token::compound::isCompound(tag))
{
os << tag << ' ';
}
}
os << *this;