MCPcopy Create free account
hub / github.com/OpenSteam001/OpenSteamTool / emit

Method emit

tools/ipc_codegen/ipc_codegen.cpp:601–636  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

599 Emitter(std::ostream& out, const File& file) : out_(out), file_(file) {}
600
601 void emit(const std::string& inputName, const std::string& outputName) {
602 out_ << "// " << outputName << " - AUTO-GENERATED by tools/ipc_codegen.\n"
603 "// Source: " << inputName << "\n"
604 "// Do not edit by hand. Edit the .steamd source and rebuild.\n"
605 "#pragma once\n"
606 "#include \"Steam/Structs.h\"\n"
607 "#include <algorithm>\n"
608 "#include <cstddef>\n"
609 "#include <cstring>\n"
610 "#include <initializer_list>\n"
611 "#include <limits>\n"
612 "#include <optional>\n"
613 "#include <ostream>\n"
614 "#include <span>\n"
615 "#include <sstream>\n"
616 "#include <string>\n"
617 "#include <string_view>\n"
618 "#include <type_traits>\n\n";
619
620 for (const auto& decl : file_.enums) emitEnum(decl);
621
622 out_ << "namespace IPCMessages {\n\n";
623 emitHelpers();
624 emitLayouts();
625 emitIPCRequest();
626 emitProtocolCommandViews();
627 emitIPCInterfaceCall();
628 emitIPCResponse();
629 out_ << "template <class T>\n"
630 "std::span<const uint8> asBytes(const T& value) {\n"
631 " static_assert(std::is_trivially_copyable_v<T>);\n"
632 " return {reinterpret_cast<const uint8*>(&value), sizeof(T)};\n"
633 "}\n\n";
634 for (const auto& iface : file_.interfaces) emitInterface(iface);
635 out_ << "} // namespace IPCMessages\n";
636 }
637
638private:
639 void emitEnum(const EnumDecl& decl) {

Callers 1

generateFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected