Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #pragma once
00015
00019 #include <string>
00020 #include <fstream>
00021
00022 #include "MessageListParser.h"
00023
00024 namespace kNet
00025 {
00026
00028 class SerializationStructCompiler
00029 {
00030 public:
00031 void CompileStruct(const SerializedElementDesc &structure, const char *outfile);
00032 void CompileMessage(const SerializedMessageDesc &message, const char *outfile);
00033
00034 static std::string ParseToValidCSymbolName(const char *str);
00035
00036 private:
00037 void WriteFilePreamble(std::ofstream &out);
00038 void WriteStruct(const SerializedElementDesc &elem, int level, std::ofstream &out);
00039 void WriteMessage(const SerializedMessageDesc &message, std::ofstream &out);
00040
00041 void WriteMemberDefinition(const SerializedElementDesc &elem, int level, std::ofstream &out);
00042 void WriteStructMembers(const SerializedElementDesc &elem, int level, std::ofstream &out);
00043 void WriteNestedStructs(const SerializedElementDesc &elem, int level, std::ofstream &out);
00044 void WriteStructSizeMemberFunction(const SerializedElementDesc &elem, int level, std::ofstream &out);
00045 void WriteSerializeMemberFunction(const SerializedElementDesc &elem, int level, std::ofstream &out);
00046 void WriteDeserializeMemberFunction(const SerializedElementDesc &elem, int level, std::ofstream &out);
00047
00048 static std::string Indent(int level);
00049 };
00050
00051 }