ENH: add output methods for wordRes

This commit is contained in:
Mark Olesen
2018-01-10 14:09:56 +01:00
parent 2b0eaf2d38
commit eb7f6d2406
2 changed files with 40 additions and 4 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -85,7 +85,7 @@ public:
// Member Functions
// Access
// Access
//- The number of elements in the list
inline label size() const;
@ -94,7 +94,7 @@ public:
inline bool empty() const;
// Searching
// Searching
//- Return true if string matches any of the regular expressions
// Smart match as regular expression or as a string.
@ -117,9 +117,27 @@ public:
//- Return element of constant list
inline const wordRe& operator[](const label i) const;
// Writing
//- Write wordReList, with line-breaks in ASCII if the list length
//- exceeds shortListLen.
// Using '0' suppresses line-breaks entirely.
inline Ostream& writeList
(
Ostream& os,
const label shortListLen=0
) const;
};
// Global Functions
//- Write to Ostream, as per wordRes::writeList() with shortListLen=10
inline Ostream& operator<<(Ostream& os, const wordRes& wres);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -88,4 +88,22 @@ inline const Foam::wordRe& Foam::wordRes::operator[](const label i) const
}
inline Foam::Ostream& Foam::wordRes::writeList
(
Ostream& os,
const label shortListLen
) const
{
return list_.writeList(os, shortListLen);
}
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
inline Foam::Ostream& Foam::operator<<(Ostream& os, const wordRes& wres)
{
return wres.writeList(os, 10);
}
// ************************************************************************* //