Commit b5162f91 authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: use DynamicList instead of LIFO for managing tags in vtk::formatter

parent ca5d9123
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -24,12 +24,6 @@ License
#include "foamVtkFormatter.H"
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::vtk::formatter::~formatter()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
std::size_t Foam::vtk::formatter::encodedLength(std::size_t n) const
......@@ -95,7 +89,7 @@ Foam::vtk::formatter::openTag(const word& tagName)
indent();
os_ << '<' << tagName;
xmlTags_.push(tagName);
xmlTags_.append(tagName);
inTag_ = true;
return *this;
......@@ -115,7 +109,7 @@ Foam::vtk::formatter::closeTag(const bool isEmpty)
if (isEmpty)
{
// eg, <tag ... />
xmlTags_.pop();
xmlTags_.remove();
os_ << " /";
}
os_ << '>' << nl;
......@@ -129,7 +123,7 @@ Foam::vtk::formatter::closeTag(const bool isEmpty)
Foam::vtk::formatter&
Foam::vtk::formatter::endTag(const word& tagName)
{
const word curr = xmlTags_.pop();
const word curr(xmlTags_.remove());
indent();
if (inTag_)
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -43,7 +43,7 @@ SourceFiles
#include "label.H"
#include "word.H"
#include "UList.H"
#include "LIFOStack.H"
#include "DynamicList.H"
#include "foamVtkCore.H"
#include "foamVtkPTraits.H"
......@@ -69,8 +69,8 @@ class formatter
//- The output stream for the formatter
std::ostream& os_;
//- Stack of current XML tags
LIFOStack<word> xmlTags_;
//- LIFO stack of current XML tags
DynamicList<word> xmlTags_;
//- Tag open/closed/ended state
mutable bool inTag_;
......@@ -104,12 +104,12 @@ public:
//- Destructor
virtual ~formatter();
virtual ~formatter() = default;
// Member Functions
// Access
// Access
//- Access to the underlying output stream
inline std::ostream& os();
......@@ -142,7 +142,7 @@ public:
// Member Functions
// Output
// Output
//- Indent according to the currently nested XML tags
void indent();
......@@ -317,7 +317,6 @@ public:
const uint64_t v,
const char quote = '\''
);
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment