mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: improvements for token methods
- direct check of punctuation.
For example,
while (!tok.isPunctuation(token::BEGIN_LIST)) ..
instead of
while (!(tok.isPunctuation() && tok.pToken() == token::BEGIN_LIST)) ..
Using direct comparison (tok != token::BEGIN_LIST) can be fragile
when comparing int values:
int c = readChar(is);
while (tok != c) .. // Danger, uses LABEL comparison!
- direct check of word.
For example,
if (tok.isWord("uniform")) ..
instead of
if (tok.isWord() && tok.wordToken() == "uniform") ..
- make token lineNumber() a setter method
ENH: adjust internal compound method empty() -> moved()
- support named compound tokens
STYLE: setter method for stream indentation
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -134,7 +134,7 @@ Foam::cv2DControls::cv2DControls
|
||||
|
||||
void Foam::cv2DControls::write(Ostream& os) const
|
||||
{
|
||||
os.indentLevel() = 1;
|
||||
const auto oldLevel = os.indentLevel(1);
|
||||
os.precision(2);
|
||||
os.flags(ios_base::scientific);
|
||||
|
||||
@ -148,6 +148,8 @@ void Foam::cv2DControls::write(Ostream& os) const
|
||||
<< indent << "ppDist_ : " << ppDist_ << nl
|
||||
<< indent << "minEdgeLen2_ : " << minEdgeLen2_ << nl
|
||||
<< token::END_BLOCK << endl;
|
||||
|
||||
os.indentLevel(oldLevel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user