mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 16:15:43 +00:00
Add sourceFile parameter to MultiInput ParserStream
This commit is contained in:
parent
ca1059b05c
commit
68610e49f3
@ -28,7 +28,7 @@ bool AssetLoaderMenuList::LoadFromRaw(const std::string& assetName, ISearchPath*
|
||||
if (!file.IsOpen())
|
||||
return false;
|
||||
|
||||
MenuFileReader reader(*file.m_stream, assetName, MenuFeatureLevel::IW4, [searchPath](const std::string& filename) -> std::unique_ptr<std::istream>
|
||||
MenuFileReader reader(*file.m_stream, assetName, MenuFeatureLevel::IW4, [searchPath](const std::string& filename, const std::string& sourceFile) -> std::unique_ptr<std::istream>
|
||||
{
|
||||
auto foundFileToInclude = searchPath->Open(filename);
|
||||
if (!foundFileToInclude.IsOpen() || !foundFileToInclude.m_stream)
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "Parsing/Impl/ParserSingleInputStream.h"
|
||||
#include "Parsing/Simple/SimpleLexer.h"
|
||||
|
||||
MenuFileReader::MenuFileReader(std::istream& stream, std::string fileName, MenuFeatureLevel featureLevel, include_callback_t includeCallback)
|
||||
MenuFileReader::MenuFileReader(std::istream& stream, std::string fileName, const MenuFeatureLevel featureLevel, include_callback_t includeCallback)
|
||||
: m_feature_level(featureLevel),
|
||||
m_file_name(std::move(fileName)),
|
||||
m_stream(nullptr)
|
||||
@ -18,7 +18,7 @@ MenuFileReader::MenuFileReader(std::istream& stream, std::string fileName, MenuF
|
||||
m_stream = m_open_streams.back().get();
|
||||
}
|
||||
|
||||
MenuFileReader::MenuFileReader(std::istream& stream, std::string fileName, MenuFeatureLevel featureLevel)
|
||||
MenuFileReader::MenuFileReader(std::istream& stream, std::string fileName, const MenuFeatureLevel featureLevel)
|
||||
: m_feature_level(featureLevel),
|
||||
m_file_name(std::move(fileName)),
|
||||
m_stream(nullptr)
|
||||
|
@ -12,7 +12,7 @@
|
||||
class MenuFileReader
|
||||
{
|
||||
public:
|
||||
using include_callback_t = std::function<std::unique_ptr<std::istream>(const std::string& filename)>;
|
||||
using include_callback_t = std::function<std::unique_ptr<std::istream>(const std::string& filename, const std::string& sourceFile)>;
|
||||
|
||||
private:
|
||||
const MenuFeatureLevel m_feature_level;
|
||||
|
@ -79,7 +79,7 @@ bool ParserMultiInputStream::IncludeFile(const std::string& filename)
|
||||
if (!m_include_callback)
|
||||
return false;
|
||||
|
||||
auto newFile = m_include_callback(filename);
|
||||
auto newFile = m_include_callback(filename, m_files.empty() ? "" : m_files.top().m_file_path);
|
||||
if (!newFile)
|
||||
return false;
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
class ParserMultiInputStream final : public IParserLineStream
|
||||
{
|
||||
public:
|
||||
using include_callback_t = std::function<std::unique_ptr<std::istream>(const std::string& filename)>;
|
||||
using include_callback_t = std::function<std::unique_ptr<std::istream>(const std::string& filename, const std::string& sourceFile)>;
|
||||
|
||||
private:
|
||||
class FileInfo
|
||||
|
Loading…
x
Reference in New Issue
Block a user