mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-26 22:57:52 -05:00
Add AbstractTextDumper to implement stream holding and indendation
This commit is contained in:
@ -32,32 +32,13 @@ MapFileDumper::PhysicsCylinder::PhysicsCylinder(const Vec3 middlePoint, const fl
|
||||
}
|
||||
|
||||
MapFileDumper::MapFileDumper(std::ostream& stream)
|
||||
: m_stream(stream),
|
||||
: AbstractTextDumper(stream),
|
||||
m_flags{},
|
||||
m_indent(0u),
|
||||
m_entity_index(0u),
|
||||
m_brush_index(0u)
|
||||
{
|
||||
}
|
||||
|
||||
void MapFileDumper::Indent() const
|
||||
{
|
||||
for (auto i = 0u; i < m_indent; i++)
|
||||
m_stream << " ";
|
||||
}
|
||||
|
||||
void MapFileDumper::IncIndent()
|
||||
{
|
||||
++m_indent;
|
||||
}
|
||||
|
||||
void MapFileDumper::DecIndent()
|
||||
{
|
||||
assert(m_indent > 0);
|
||||
if (m_indent > 0)
|
||||
m_indent--;
|
||||
}
|
||||
|
||||
void MapFileDumper::Init() const
|
||||
{
|
||||
m_stream << "iwmap 4\n";
|
||||
|
@ -2,7 +2,9 @@
|
||||
|
||||
#include <ostream>
|
||||
|
||||
class MapFileDumper
|
||||
#include "Dumping/AbstractTextDumper.h"
|
||||
|
||||
class MapFileDumper : AbstractTextDumper
|
||||
{
|
||||
public:
|
||||
union Vec3
|
||||
@ -13,6 +15,7 @@ public:
|
||||
float m_y;
|
||||
float m_z;
|
||||
};
|
||||
|
||||
float v[3];
|
||||
|
||||
Vec3(float x, float y, float z);
|
||||
@ -39,21 +42,15 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
std::ostream& m_stream;
|
||||
|
||||
struct
|
||||
{
|
||||
bool m_in_entity : 1;
|
||||
bool m_in_brush : 1;
|
||||
} m_flags;
|
||||
size_t m_indent;
|
||||
|
||||
size_t m_entity_index;
|
||||
size_t m_brush_index;
|
||||
|
||||
void Indent() const;
|
||||
void IncIndent();
|
||||
void DecIndent();
|
||||
|
||||
public:
|
||||
explicit MapFileDumper(std::ostream& stream);
|
||||
|
||||
|
Reference in New Issue
Block a user