From e8baf65134cd42c07f53a7020c4ca4a5568acdc3 Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 5 Sep 2022 23:33:14 +0200 Subject: [PATCH] Adjust templater output --- src/RawTemplater/Templating/Templater.cpp | 4 +++- src/RawTemplater/Templating/Templater.h | 2 +- src/RawTemplater/Templating/TemplatingStreamProxy.cpp | 10 ++-------- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/RawTemplater/Templating/Templater.cpp b/src/RawTemplater/Templating/Templater.cpp index 0f926ced..bd0c23cc 100644 --- a/src/RawTemplater/Templating/Templater.cpp +++ b/src/RawTemplater/Templating/Templater.cpp @@ -218,6 +218,8 @@ namespace templating m_output_stream << cachedData; } + std::cout << "Templated file \"" << m_output_file << "\"\n"; + m_first_line = true; m_write_output_to_file = false; m_output_cache.clear(); @@ -325,7 +327,7 @@ Templater::Templater(std::istream& stream, std::string fileName) { } -bool Templater::TemplateToDirectory(const std::string& outputDirectory) +bool Templater::TemplateToDirectory(const std::string& outputDirectory) const { TemplaterControlImpl control(m_stream, m_file_name, outputDirectory); diff --git a/src/RawTemplater/Templating/Templater.h b/src/RawTemplater/Templating/Templater.h index 24a13acd..ce7b3279 100644 --- a/src/RawTemplater/Templating/Templater.h +++ b/src/RawTemplater/Templating/Templater.h @@ -10,7 +10,7 @@ namespace templating public: Templater(std::istream& stream, std::string fileName); - bool TemplateToDirectory(const std::string& outputDirectory); + bool TemplateToDirectory(const std::string& outputDirectory) const; private: std::istream& m_stream; diff --git a/src/RawTemplater/Templating/TemplatingStreamProxy.cpp b/src/RawTemplater/Templating/TemplatingStreamProxy.cpp index 110b727b..8d1b5b55 100644 --- a/src/RawTemplater/Templating/TemplatingStreamProxy.cpp +++ b/src/RawTemplater/Templating/TemplatingStreamProxy.cpp @@ -42,8 +42,7 @@ bool TemplatingStreamProxy::MatchSwitchDirective(const ParserLine& line, const u throw ParsingException(CreatePos(line, currentPosition), "Invalid switch directive."); auto name = line.m_line.substr(nameStartPosition, currentPosition - nameStartPosition); - - std::cout << "Switch: \"" << name << "\"\n"; + m_templater_control->AddSwitch(std::move(name)); return true; } @@ -100,10 +99,6 @@ bool TemplatingStreamProxy::MatchOptionsDirective(const ParserLine& line, const firstArg = false; } - std::cout << "Options: \"" << name << "\" with values:\n"; - for (const auto& option : options) - std::cout << " Value: " << option << "\n"; - m_templater_control->AddOptions(std::move(name), std::move(options)); return true; } @@ -145,8 +140,7 @@ bool TemplatingStreamProxy::MatchFilenameDirective(const ParserLine& line, const if (value.m_type != SimpleExpressionValue::Type::STRING) throw ParsingException(CreatePos(line, currentPosition), "pragma filename expression must evaluate to string"); - - std::cout << "Filename: \"" << *value.m_string_value << "\"\n"; + m_templater_control->SetFileName(*value.m_string_value); return true; }