2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-09-05 08:17:25 +00:00

Add stream proxy for declaring pack values

This commit is contained in:
Jan
2021-02-14 10:27:18 +01:00
parent efa39a8ac3
commit 3f08be0564
6 changed files with 188 additions and 1 deletions

View File

@@ -8,11 +8,13 @@
#include "Parsing/Impl/CommentRemovingStreamProxy.h"
#include "Parsing/Impl/DefinesStreamProxy.h"
#include "Parsing/Impl/IncludingStreamProxy.h"
#include "Parsing/Impl/PackDefinitionStreamProxy.h"
#include "Parsing/Impl/ParserFilesystemStream.h"
HeaderFileReader::HeaderFileReader(const ZoneCodeGeneratorArguments* args, std::string filename)
: m_args(args),
m_filename(std::move(filename)),
m_pack_value_supplier(nullptr),
m_stream(nullptr)
{
}
@@ -35,13 +37,16 @@ void HeaderFileReader::SetupStreamProxies()
{
auto commentProxy = std::make_unique<CommentRemovingStreamProxy>(m_stream);
auto includeProxy = std::make_unique<IncludingStreamProxy>(commentProxy.get());
auto definesProxy = std::make_unique<DefinesStreamProxy>(includeProxy.get());
auto packProxy = std::make_unique<PackDefinitionStreamProxy>(includeProxy.get());
auto definesProxy = std::make_unique<DefinesStreamProxy>(packProxy.get());
definesProxy->AddDefine(ZONE_CODE_GENERATOR_DEFINE_NAME, ZONE_CODE_GENERATOR_DEFINE_VALUE);
m_pack_value_supplier = packProxy.get();
m_stream = definesProxy.get();
m_open_streams.emplace_back(std::move(commentProxy));
m_open_streams.emplace_back(std::move(includeProxy));
m_open_streams.emplace_back(std::move(packProxy));
m_open_streams.emplace_back(std::move(definesProxy));
}

View File

@@ -3,6 +3,7 @@
#include <string>
#include "ZoneCodeGeneratorArguments.h"
#include "Parsing/IPackValueSupplier.h"
#include "Parsing/IParserLineStream.h"
#include "Persistence/IDataRepository.h"
@@ -15,6 +16,7 @@ class HeaderFileReader
std::string m_filename;
std::vector<std::unique_ptr<IParserLineStream>> m_open_streams;
IPackValueSupplier* m_pack_value_supplier;
IParserLineStream* m_stream;
bool OpenBaseStream();