ReflectionInternal.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. // THIS CORNFILE IS GENERATED. DO NOT EDIT! 🌽
  2. #ifndef __REFLECTION_INTERNALH
  3. #define __REFLECTION_INTERNALH
  4. #include <string>
  5. #include <vector>
  6. enum class ReflectTypeID {
  7. EnumReflectTypeID = 0,
  8. ClassReflectField = 1,
  9. ClassReflectEnumValue = 2,
  10. ClassReflectType = 3,
  11. EnumReflectTypeKind = 4,
  12. VectorOfClassReflectField = 5,
  13. VectorOfClassReflectEnumValue = 6,
  14. Int32 = 7,
  15. Int64 = 8,
  16. Uint32 = 9,
  17. Uint8 = 10,
  18. Int = 11,
  19. UnsignedChar = 12,
  20. Float = 13,
  21. String = 14,
  22. Uint64 = 15,
  23. Char = 16,
  24. Double = 17,
  25. Bool = 18,
  26. VectorOfUint8 = 19,
  27. EnumCpuFamily = 20,
  28. EnumOs = 21,
  29. EnumAuthenticationType = 22,
  30. ClassSystemInfo = 23,
  31. ClassLoginCredentials = 24,
  32. ClassClientResponseEncrypted = 25,
  33. OptionalOfString = 26,
  34. OptionalOfVectorOfUint8 = 27,
  35. EnumProduct = 28,
  36. EnumPlatform = 29,
  37. EnumCryptosuite = 30,
  38. ClassLoginCryptoDiffieHellmanChallenge = 31,
  39. ClassLoginCryptoChallengeUnion = 32,
  40. ClassLoginCryptoDiffieHellmanHello = 33,
  41. ClassLoginCryptoHelloUnion = 34,
  42. ClassBuildInfo = 35,
  43. ClassFeatureSet = 36,
  44. ClassAPChallenge = 37,
  45. ClassAPResponseMessage = 38,
  46. ClassLoginCryptoDiffieHellmanResponse = 39,
  47. ClassLoginCryptoResponseUnion = 40,
  48. ClassCryptoResponseUnion = 41,
  49. ClassPoWResponseUnion = 42,
  50. ClassClientResponsePlaintext = 43,
  51. ClassClientHello = 44,
  52. OptionalOfClassLoginCryptoDiffieHellmanChallenge = 45,
  53. OptionalOfClassLoginCryptoDiffieHellmanHello = 46,
  54. OptionalOfBool = 47,
  55. OptionalOfClassAPChallenge = 48,
  56. OptionalOfClassLoginCryptoDiffieHellmanResponse = 49,
  57. VectorOfEnumCryptosuite = 50,
  58. OptionalOfClassFeatureSet = 51,
  59. ClassHeader = 52,
  60. EnumAudioFormat = 53,
  61. ClassAudioFile = 54,
  62. ClassRestriction = 55,
  63. ClassImage = 56,
  64. ClassImageGroup = 57,
  65. ClassAlbum = 58,
  66. ClassArtist = 59,
  67. ClassTrack = 60,
  68. ClassEpisode = 61,
  69. OptionalOfEnumAudioFormat = 62,
  70. VectorOfClassImage = 63,
  71. OptionalOfClassImageGroup = 64,
  72. OptionalOfClassAlbum = 65,
  73. VectorOfClassArtist = 66,
  74. OptionalOfInt32 = 67,
  75. VectorOfClassRestriction = 68,
  76. VectorOfClassAudioFile = 69,
  77. VectorOfClassTrack = 70,
  78. EnumMessageType = 71,
  79. EnumPlayStatus = 72,
  80. EnumCapabilityType = 73,
  81. ClassTrackRef = 74,
  82. ClassState = 75,
  83. ClassCapability = 76,
  84. ClassDeviceState = 77,
  85. ClassFrame = 78,
  86. OptionalOfUint32 = 79,
  87. OptionalOfEnumPlayStatus = 80,
  88. OptionalOfUint64 = 81,
  89. VectorOfClassTrackRef = 82,
  90. OptionalOfEnumCapabilityType = 83,
  91. VectorOfInt64 = 84,
  92. VectorOfString = 85,
  93. OptionalOfInt64 = 86,
  94. VectorOfClassCapability = 87,
  95. OptionalOfEnumMessageType = 88,
  96. OptionalOfClassDeviceState = 89,
  97. OptionalOfClassState = 90,
  98. };
  99. enum class ReflectTypeKind {
  100. Primitive = 0,
  101. Enum = 1,
  102. Class = 2,
  103. Vector = 3,
  104. Optional = 4,
  105. };
  106. class ReflectField {
  107. public:
  108. ReflectTypeID typeID;
  109. std::string name;
  110. size_t offset;
  111. uint32_t protobufTag;
  112. static constexpr ReflectTypeID _TYPE_ID = ReflectTypeID::ClassReflectField;
  113. ReflectField() {};
  114. ReflectField(ReflectTypeID typeID, std::string name, size_t offset, uint32_t protobufTag) {
  115. this->typeID = typeID;
  116. this->name = name;
  117. this->offset = offset;
  118. this->protobufTag = protobufTag;
  119. }
  120. };
  121. class ReflectEnumValue {
  122. public:
  123. std::string name;
  124. int value;
  125. static constexpr ReflectTypeID _TYPE_ID = ReflectTypeID::ClassReflectEnumValue;
  126. ReflectEnumValue(){};
  127. ReflectEnumValue( std::string name, int value) {
  128. this->name = name;
  129. this->value = value;
  130. }
  131. };
  132. class ReflectType {
  133. public:
  134. ReflectTypeID typeID;
  135. std::string name;
  136. ReflectTypeKind kind;
  137. size_t size;
  138. ReflectTypeID innerType;
  139. std::vector<ReflectField> fields;
  140. std::vector<ReflectEnumValue> enumValues;
  141. static constexpr ReflectTypeID _TYPE_ID = ReflectTypeID::ClassReflectType;
  142. void (*_Construct)(void *mem);
  143. void (*_Destruct)(void *obj);
  144. VectorOperations vectorOps;
  145. OptionalOperations optionalOps;
  146. static ReflectType ofPrimitive(ReflectTypeID id, std::string name, size_t size) {
  147. ReflectType t;
  148. t.kind = ReflectTypeKind::Primitive;
  149. t.typeID = id;
  150. t.name = name;
  151. t.size = size;
  152. return t;
  153. }
  154. static ReflectType ofEnum(ReflectTypeID id, std::string name, std::vector<ReflectEnumValue> enumValues, size_t size) {
  155. ReflectType t;
  156. t.kind = ReflectTypeKind::Enum;
  157. t.typeID = id;
  158. t.name = name;
  159. t.size = size;
  160. t.enumValues = enumValues;
  161. return t;
  162. }
  163. static ReflectType ofVector(ReflectTypeID id, ReflectTypeID innerType, size_t size,
  164. VectorOperations vectorOps,
  165. void (*_Construct)(void *mem), void (*_Destruct)(void *obj)) {
  166. ReflectType t;
  167. t.kind = ReflectTypeKind::Vector;
  168. t.typeID = id;
  169. t.innerType = innerType;
  170. t.size = size;
  171. t._Construct = _Construct;
  172. t._Destruct = _Destruct;
  173. t.vectorOps = vectorOps;
  174. return t;
  175. }
  176. static ReflectType ofOptional(ReflectTypeID id, ReflectTypeID innerType, size_t size,
  177. OptionalOperations optionalOps,
  178. void (*_Construct)(void *mem), void (*_Destruct)(void *obj)) {
  179. ReflectType t;
  180. t.kind = ReflectTypeKind::Optional;
  181. t.typeID = id;
  182. t.innerType = innerType;
  183. t.size = size;
  184. t._Construct = _Construct;
  185. t._Destruct = _Destruct;
  186. t.optionalOps = optionalOps;
  187. return t;
  188. }
  189. static ReflectType ofClass(ReflectTypeID id, std::string name, std::vector<ReflectField> fields, size_t size, void (*_Construct)(void *mem), void (*_Destruct)(void *obj)) {
  190. ReflectType t;
  191. t.kind = ReflectTypeKind::Class;
  192. t.name = name;
  193. t.typeID = id;
  194. t.size = size;
  195. t.fields = std::move(fields);
  196. t._Construct = _Construct;
  197. t._Destruct = _Destruct;
  198. return t;
  199. }
  200. };
  201. #endif