diff options
author | rtk0c <[email protected]> | 2022-05-29 16:14:26 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-05-29 16:14:26 -0700 |
commit | 66b63ae887f553e1cac813546a6b827a9c85d80c (patch) | |
tree | c404dd9cc6a74853f8ea409cdeeb1419b04cef44 /buildtools/codegen/CodegenOutput.inl | |
parent | 1a6f1ea3b76c3ed4cad5aba5502af390ce50a2c0 (diff) |
Changeset: 43 Add tostring code gen for enums
Diffstat (limited to 'buildtools/codegen/CodegenOutput.inl')
-rw-r--r-- | buildtools/codegen/CodegenOutput.inl | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/buildtools/codegen/CodegenOutput.inl b/buildtools/codegen/CodegenOutput.inl index 6d59301..752682c 100644 --- a/buildtools/codegen/CodegenOutput.inl +++ b/buildtools/codegen/CodegenOutput.inl @@ -15,6 +15,14 @@ struct CodegenOutputThing { class CodegenOutput { private: std::vector<CodegenOutputThing> mOutThings; + std::vector<DeclStruct> mOutStructs; + std::vector<DeclEnum> mOutEnums; + std::vector<DeclFunction> mOutFunctions; + +public: + std::string optionOutPrefix; + // Whether to add prefixes mOutPrefix to all global names or not + bool optionAutoAddPrefix : 1 = false; public: void AddOutputThing(CodegenOutputThing thing) { @@ -22,10 +30,16 @@ public: } void MergeContents(CodegenOutput other) { - std::move(other.mOutThings.begin(), other.mOutThings.end(), this->mOutThings.begin()); + std::move(other.mOutThings.begin(), other.mOutThings.end(), std::back_inserter(this->mOutThings)); } void Write(FILE* file) { - // TODO +#define WRITE_LITERAL(str) fwrite(str, sizeof(char), sizeof(str) - 1, file) + for (auto& thing : mOutThings) { + WRITE_LITERAL("// Output thing\n"); + fwrite(thing.text.c_str(), sizeof(char), thing.text.size(), file); + WRITE_LITERAL("\n"); + } +#undef WRITE_LITERAL } }; |