11#include <unordered_set>
33 std::string_view resourceName);
81 std::string_view commandStr,
87 void generateLoadCommand(
90 std::string_view resourceName,
92 std::string& out_commandStr);
94 std::string borrowStringBuffer();
95 void returnStringBuffer(std::string&& buffer);
97 static void appendFullSdlType(
99 std::string& out_commandStr);
102 std::unordered_set<const SdlClass*> m_targetClasses;
103 std::unique_ptr<SdlDataPacketInterface> m_packetInterface;
104 Path m_sceneWorkingDirectory;
105 std::size_t m_numGeneratedCommands;
106 std::size_t m_numGenerationErrors;
107 std::vector<std::string> m_stringBuffers;
112 return m_sceneWorkingDirectory;
117 return m_numGeneratedCommands;
122 return m_numGenerationErrors;
125inline std::string SdlCommandGenerator::borrowStringBuffer()
127 if(m_stringBuffers.empty())
129 m_stringBuffers.push_back(std::string());
132 std::string buffer = std::move(m_stringBuffers.back());
133 m_stringBuffers.pop_back();
137inline void SdlCommandGenerator::returnStringBuffer(std::string&& buffer)
140 m_stringBuffers.push_back(std::move(buffer));
Interface for all SDL resource.
Definition ISdlResource.h:22
General path representation. Does not check whether the target actually exists (e....
Definition Path.h:21
Definition SdlCommandGenerator.h:22
bool hasTarget(const SdlClass *clazz) const
Definition SdlCommandGenerator.cpp:204
virtual bool beginCommand(const SdlClass *targetClass, SdlOutputContext *out_ctx)=0
Called when the generator starts producing a command.
virtual ~SdlCommandGenerator()
void setPacketInterface(std::unique_ptr< SdlDataPacketInterface > interface)
Definition SdlCommandGenerator.cpp:188
virtual void endCommand()=0
Called when the generator finishes producing a command. This is called last in the sequence of handle...
void generateResourceCommand(const ISdlResource *resource, std::string_view resourceName)
Definition SdlCommandGenerator.cpp:44
virtual void commandGenerated(std::string_view commandStr, const SdlOutputContext &ctx)=0
Called when one or more commands are generated.
const Path & getSceneWorkingDirectory() const
Definition SdlCommandGenerator.h:110
std::size_t numGeneratedCommands() const
Definition SdlCommandGenerator.h:115
void setSceneWorkingDirectory(const Path &directory)
Definition SdlCommandGenerator.cpp:193
std::size_t numGenerationErrors() const
Definition SdlCommandGenerator.h:120
void clearStats()
Definition SdlCommandGenerator.cpp:198
void generateVersionCommand(const SemanticVersion &version)
Definition SdlCommandGenerator.cpp:159
void generateCachedNamedDataPacketCommand(const SdlNamedOutputClauses &namedClauses)
Definition SdlCommandGenerator.cpp:108
virtual void saveResource(const ISdlResource *resource, const SdlOutputContext &ctx, SdlOutputClauses &clauses)=0
Save target resource into output clauses.
SdlDataPacketInterface & getPacketInterface()
Definition SdlCommandGenerator.cpp:38
SdlCommandGenerator(TSpanView< const SdlClass * > targetClasses)
Definition SdlCommandGenerator.cpp:20
Parsing & generating a group of SDL clauses.
Definition SdlDataPacketInterface.h:14
Definition SdlNamedOutputClauses.h:18
Definition SdlOutputClauses.h:14
Data that SDL output process can rely on.
Definition SdlOutputContext.h:19
Convenient software version handling routines. See https://semver.org/ for a detailed explaination of...
Definition SemanticVersion.h:16
The root for all renderer implementations.
Definition EEngineProject.h:6
std::span< const T, EXTENT > TSpanView
Same as TSpan, except that the objects are const-qualified. Note that for pointer types,...
Definition TSpan.h:19