mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: use DynamicList instead of LIFO for managing tags in vtk::formatter
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -24,12 +24,6 @@ License
|
|||||||
|
|
||||||
#include "foamVtkFormatter.H"
|
#include "foamVtkFormatter.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::vtk::formatter::~formatter()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
std::size_t Foam::vtk::formatter::encodedLength(std::size_t n) const
|
std::size_t Foam::vtk::formatter::encodedLength(std::size_t n) const
|
||||||
@ -95,7 +89,7 @@ Foam::vtk::formatter::openTag(const word& tagName)
|
|||||||
indent();
|
indent();
|
||||||
os_ << '<' << tagName;
|
os_ << '<' << tagName;
|
||||||
|
|
||||||
xmlTags_.push(tagName);
|
xmlTags_.append(tagName);
|
||||||
inTag_ = true;
|
inTag_ = true;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
@ -115,7 +109,7 @@ Foam::vtk::formatter::closeTag(const bool isEmpty)
|
|||||||
if (isEmpty)
|
if (isEmpty)
|
||||||
{
|
{
|
||||||
// eg, <tag ... />
|
// eg, <tag ... />
|
||||||
xmlTags_.pop();
|
xmlTags_.remove();
|
||||||
os_ << " /";
|
os_ << " /";
|
||||||
}
|
}
|
||||||
os_ << '>' << nl;
|
os_ << '>' << nl;
|
||||||
@ -129,7 +123,7 @@ Foam::vtk::formatter::closeTag(const bool isEmpty)
|
|||||||
Foam::vtk::formatter&
|
Foam::vtk::formatter&
|
||||||
Foam::vtk::formatter::endTag(const word& tagName)
|
Foam::vtk::formatter::endTag(const word& tagName)
|
||||||
{
|
{
|
||||||
const word curr = xmlTags_.pop();
|
const word curr(xmlTags_.remove());
|
||||||
indent();
|
indent();
|
||||||
|
|
||||||
if (inTag_)
|
if (inTag_)
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -43,7 +43,7 @@ SourceFiles
|
|||||||
#include "label.H"
|
#include "label.H"
|
||||||
#include "word.H"
|
#include "word.H"
|
||||||
#include "UList.H"
|
#include "UList.H"
|
||||||
#include "LIFOStack.H"
|
#include "DynamicList.H"
|
||||||
#include "foamVtkCore.H"
|
#include "foamVtkCore.H"
|
||||||
#include "foamVtkPTraits.H"
|
#include "foamVtkPTraits.H"
|
||||||
|
|
||||||
@ -69,8 +69,8 @@ class formatter
|
|||||||
//- The output stream for the formatter
|
//- The output stream for the formatter
|
||||||
std::ostream& os_;
|
std::ostream& os_;
|
||||||
|
|
||||||
//- Stack of current XML tags
|
//- LIFO stack of current XML tags
|
||||||
LIFOStack<word> xmlTags_;
|
DynamicList<word> xmlTags_;
|
||||||
|
|
||||||
//- Tag open/closed/ended state
|
//- Tag open/closed/ended state
|
||||||
mutable bool inTag_;
|
mutable bool inTag_;
|
||||||
@ -104,12 +104,12 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~formatter();
|
virtual ~formatter() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Access to the underlying output stream
|
//- Access to the underlying output stream
|
||||||
inline std::ostream& os();
|
inline std::ostream& os();
|
||||||
@ -142,7 +142,7 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Output
|
// Output
|
||||||
|
|
||||||
//- Indent according to the currently nested XML tags
|
//- Indent according to the currently nested XML tags
|
||||||
void indent();
|
void indent();
|
||||||
@ -317,7 +317,6 @@ public:
|
|||||||
const uint64_t v,
|
const uint64_t v,
|
||||||
const char quote = '\''
|
const char quote = '\''
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user