11#include <schemasystem/schemasystem.h>
27 std::optional<std::string>
inner;
65 std::map<std::string, EnumInfo>
enums;
70 if (!type || !type->m_sTypeName.Get())
74 return type->m_sTypeName.Get();
85 switch (type->m_eTypeCategory)
98 out.atomic = std::string(
Name(type->m_eAtomicCategory));
120 .base = base && base->m_pszName ? base->m_pszName :
"",
121 .chain_offset =
chain ?
chain->m_nSingleInheritanceOffset : -1};
123 out.fields.reserve(
klass->m_nFieldCount);
127 if (!
field.m_pszName)
139 out.fields.push_back({.name =
field.m_pszName,
140 .offset =
field.m_nSingleInheritanceOffset,
159 out.items.push_back({.name =
item.m_pszName, .value =
item.m_nValue});
169 const auto index =
network.m_ClassInfos.Find(name);
173template <
class T,
class Hash>
182 std::vector<UtlTSHashHandle_t>
handles(
static_cast<size_t>(
count));
200 doc.classes.insert_or_assign(
klass->m_pszName,
230 return std::unexpected(
Error::Invalid(
"failed to serialize the schema document"));
Enumerator names without a hand-written switch.
static std::string WritePretty(const T &value)
Serialize value as prettified JSON.
static std::vector< T > HashElements(Hash &hash)
const SchemaClassFieldData_t * FindField(const CSchemaClassInfo *klass, std::string_view field)
static void MergeScope(SchemaDoc &doc, CSchemaSystemTypeScope *scope, const CNetworkSerializerCodeGenDatabase &network)
static EnumInfo DescribeEnum(const CSchemaEnumInfo *enumeration)
static TypeInfo DescribeType(CSchemaType *type)
static std::string TypeName(CSchemaType *type)
static ClassInfo DescribeClass(const CSchemaClassInfo *klass, const CNetworkSerializerClassInfo *network)
Status WriteDumpFile(CSchemaSystemTypeScope *global, CSchemaSystemTypeScope *server, const CNetworkSerializerCodeGenDatabase &network, std::string_view path, std::string_view gameBuild)
constexpr std::string_view ChainField
static const CNetworkSerializerClassInfo * NetworkClass(const CNetworkSerializerCodeGenDatabase &network, const char *name)
static std::string ReadFile(const std::filesystem::path &path)
std::expected< void, Error > Status
Status WriteAllText(std::string_view path, std::string_view text)
Write text to path (resolved via ResolvePath), creating its directory.
static Error Invalid(std::string detail)
std::vector< FieldInfo > fields
std::vector< EnumItem > items
std::map< std::string, ClassInfo > classes
std::map< std::string, EnumInfo > enums
std::optional< std::string > inner
std::optional< int32_t > extent
std::optional< std::string > atomic