mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-19 03:07:58 -05:00
Add base for StructuredDataDefDumper
This commit is contained in:
@ -0,0 +1,43 @@
|
||||
#include "StructuredDataDefDumper.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
StructuredDataDefDumper::StructuredDataDefDumper(std::ostream& stream)
|
||||
: AbstractTextDumper(stream),
|
||||
m_flags{}
|
||||
{
|
||||
}
|
||||
|
||||
void StructuredDataDefDumper::BeginVersion(const int version)
|
||||
{
|
||||
assert(!m_flags.m_in_version);
|
||||
if (m_flags.m_in_version)
|
||||
return;
|
||||
|
||||
if (m_flags.m_empty_line_before_version)
|
||||
m_stream << "\n";
|
||||
else
|
||||
m_flags.m_empty_line_before_version = true;
|
||||
|
||||
Indent();
|
||||
m_stream << "version " << version << "\n";
|
||||
|
||||
Indent();
|
||||
m_stream << "{\n";
|
||||
|
||||
IncIndent();
|
||||
|
||||
m_flags.m_in_version = true;
|
||||
}
|
||||
|
||||
void StructuredDataDefDumper::EndVersion()
|
||||
{
|
||||
assert(m_flags.m_in_version);
|
||||
if (!m_flags.m_in_version)
|
||||
return;
|
||||
|
||||
DecIndent();
|
||||
Indent();
|
||||
m_stream << "}\n";
|
||||
m_flags.m_in_version = false;
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractTextDumper.h"
|
||||
|
||||
class StructuredDataDefDumper : AbstractTextDumper
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool m_in_version : 1;
|
||||
bool m_empty_line_before_version : 1;
|
||||
} m_flags;
|
||||
|
||||
public:
|
||||
explicit StructuredDataDefDumper(std::ostream& stream);
|
||||
|
||||
void BeginVersion(int version);
|
||||
void EndVersion();
|
||||
};
|
Reference in New Issue
Block a user