cs2-dumper/include/builder/cpp_file_builder.hpp

28 lines
908 B
C++
Raw Normal View History

2023-09-08 21:13:40 +08:00
#pragma once
namespace builder {
class CppFileBuilder : public IFileBuilder {
public:
2023-09-16 11:32:01 +08:00
std::string extension() noexcept override {
2023-09-08 21:13:40 +08:00
return "hpp";
}
void write_top_level(std::ofstream& output) noexcept override {
output << "#pragma once\n\n";
output << "#include <cstddef>\n\n";
}
2023-09-16 11:32:01 +08:00
void write_namespace(std::ofstream& output, const std::string& name) noexcept override {
output << "namespace " << name << " {\n";
2023-09-08 21:13:40 +08:00
}
2023-09-16 11:32:01 +08:00
void write_variable(std::ofstream& output, const std::string& name, const std::uintptr_t value) noexcept override {
output << " constexpr std::ptrdiff_t " << name << " = 0x" << std::hex << value << ";\n";
2023-09-08 21:13:40 +08:00
}
void write_closure(std::ofstream& output, const bool eof) noexcept override {
output << (!eof ? "}\n\n": "}");
}
};
}