MCPcopy Create free account
hub / github.com/TranslucentTB/TranslucentTB / SaveToFile

Method SaveToFile

TranslucentTB/managers/configmanager.cpp:97–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97void ConfigManager::SaveToFile(FILE *f) const
98{
99 static constexpr std::string_view COMMENT = "// See https://TranslucentTB.github.io/config for more information\n";
100 static constexpr std::wstring_view SCHEMA = L"https://TranslucentTB.github.io/settings.schema.json";
101
102 char buffer[1024];
103 rj::FileWriteStream filestream(f, buffer, std::size(buffer));
104
105 using OutputStream = rj::EncodedOutputStream<rj::UTF8<>, rj::FileWriteStream>;
106 OutputStream out(filestream, true);
107
108 for (const char c : COMMENT)
109 {
110 out.Put(c);
111 }
112
113 rj::PrettyWriter<OutputStream, rj::UTF16LE<>> writer(out);
114 writer.SetIndent(' ', 2);
115
116 writer.StartObject();
117 rjh::Serialize(writer, SCHEMA, SCHEMA_KEY);
118 m_Config.Serialize(writer);
119 writer.EndObject();
120
121 writer.Flush();
122}
123
124bool ConfigManager::LoadFromFile(FILE *f)
125{

Callers

nothing calls this directly

Calls 2

SerializeFunction · 0.85
SerializeMethod · 0.45

Tested by

no test coverage detected