mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-16 17:57:57 -05:00
Add AbstractTextDumper to implement stream holding and indendation
This commit is contained in:
28
src/ObjWriting/Dumping/AbstractTextDumper.cpp
Normal file
28
src/ObjWriting/Dumping/AbstractTextDumper.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include "AbstractTextDumper.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
AbstractTextDumper::AbstractTextDumper(std::ostream& stream)
|
||||
: m_stream(stream),
|
||||
m_indent(0u)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void AbstractTextDumper::Indent() const
|
||||
{
|
||||
for (auto i = 0u; i < m_indent; i++)
|
||||
m_stream << " ";
|
||||
}
|
||||
|
||||
void AbstractTextDumper::IncIndent()
|
||||
{
|
||||
++m_indent;
|
||||
}
|
||||
|
||||
void AbstractTextDumper::DecIndent()
|
||||
{
|
||||
assert(m_indent > 0);
|
||||
if (m_indent > 0)
|
||||
m_indent--;
|
||||
}
|
Reference in New Issue
Block a user