mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-25 22:27:53 -05:00
Replace FileAPI with c++ streams and std::filesystem
This commit is contained in:
@ -2,28 +2,28 @@
|
||||
|
||||
const std::string AbstractZoneDefWriter::META_DATA_KEY_GAME = "game";
|
||||
|
||||
AbstractZoneDefWriter::AbstractZoneDefWriter(Zone* zone, FileAPI::IFile* file)
|
||||
AbstractZoneDefWriter::AbstractZoneDefWriter(Zone* zone, std::ostream& stream)
|
||||
: m_zone(zone),
|
||||
m_stream(stream)
|
||||
{
|
||||
m_zone = zone;
|
||||
m_file = file;
|
||||
}
|
||||
|
||||
void AbstractZoneDefWriter::EmptyLine() const
|
||||
{
|
||||
m_file->Printf("\n");
|
||||
m_stream << "\n";
|
||||
}
|
||||
|
||||
void AbstractZoneDefWriter::WriteComment(const std::string& comment) const
|
||||
{
|
||||
m_file->Printf("// %s\n", comment.c_str());
|
||||
m_stream << "// " << comment << "\n";
|
||||
}
|
||||
|
||||
void AbstractZoneDefWriter::WriteMetaData(const std::string& metaDataKey, const std::string& metaDataValue) const
|
||||
{
|
||||
m_file->Printf(">%s,%s\n", metaDataKey.c_str(), metaDataValue.c_str());
|
||||
m_stream << ">" << metaDataKey << "," << metaDataValue << "\n";
|
||||
}
|
||||
|
||||
void AbstractZoneDefWriter::WriteEntry(const std::string& entryKey, const std::string& entryValue) const
|
||||
{
|
||||
m_file->Printf("%s,%s\n", entryKey.c_str(), entryValue.c_str());
|
||||
}
|
||||
m_stream << entryKey << "," << entryValue << "\n";
|
||||
}
|
||||
|
@ -1,12 +1,14 @@
|
||||
#pragma once
|
||||
#include "Utils/FileAPI.h"
|
||||
|
||||
#include <ostream>
|
||||
|
||||
#include "Zone/Zone.h"
|
||||
|
||||
class AbstractZoneDefWriter
|
||||
{
|
||||
protected:
|
||||
Zone* m_zone;
|
||||
FileAPI::IFile* m_file;
|
||||
std::ostream& m_stream;
|
||||
|
||||
static const std::string META_DATA_KEY_GAME;
|
||||
|
||||
@ -15,7 +17,7 @@ protected:
|
||||
void WriteMetaData(const std::string& metaDataKey, const std::string& metaDataValue) const;
|
||||
void WriteEntry(const std::string& entryKey, const std::string& entryValue) const;
|
||||
|
||||
AbstractZoneDefWriter(Zone* zone, FileAPI::IFile* file);
|
||||
AbstractZoneDefWriter(Zone* zone, std::ostream& stream);
|
||||
|
||||
public:
|
||||
virtual void WriteZoneDef() = 0;
|
||||
@ -25,5 +27,5 @@ class IZoneDefWriter
|
||||
{
|
||||
public:
|
||||
virtual bool CanHandleZone(Zone* zone) const = 0;
|
||||
virtual void WriteZoneDef(Zone* zone, FileAPI::IFile* file) const = 0;
|
||||
virtual void WriteZoneDef(Zone* zone, std::ostream& stream) const = 0;
|
||||
};
|
Reference in New Issue
Block a user