protobuf.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715
  1. // THIS CORNFILE IS GENERATED. DO NOT EDIT! 🌽
  2. #ifndef _PROTOBUFH
  3. #define _PROTOBUFH
  4. #include <utility>
  5. #include <vector>
  6. #include <type_traits>
  7. #include <string>
  8. #include <optional>
  9. class AnyRef;
  10. struct VectorOperations {
  11. void (*push_back)(AnyRef &vec, AnyRef &val);
  12. AnyRef (*at)(AnyRef &vec, size_t index);
  13. size_t (*size)(AnyRef &vec);
  14. void (*emplace_back)(AnyRef &vec);
  15. void (*clear)(AnyRef &vec);
  16. void (*reserve)(AnyRef &vec, size_t n);
  17. };
  18. class AnyRef;
  19. struct OptionalOperations {
  20. AnyRef (*get)(AnyRef &opt);
  21. bool (*has_value)(AnyRef &opt);
  22. void (*set)(AnyRef &opt, AnyRef &val);
  23. void (*reset)(AnyRef &opt);
  24. void (*emplaceEmpty)(AnyRef &opt);
  25. };
  26. #include "ReflectionInternal.h"
  27. #include "authentication.h"
  28. #include "keyexchange.h"
  29. #include "metadata.h"
  30. #include "spirc.h"
  31. #include "mercury.h"
  32. template<class T>
  33. void __reflectConstruct(void *mem) {
  34. new(mem) T;
  35. }
  36. template<class T>
  37. void __reflectDestruct(void *obj) {
  38. ((T*) obj)->~T();
  39. }
  40. class ReflectField;
  41. class ReflectEnumValue;
  42. class ReflectType;
  43. class SystemInfo;
  44. class LoginCredentials;
  45. class ClientResponseEncrypted;
  46. class LoginCryptoDiffieHellmanChallenge;
  47. class LoginCryptoChallengeUnion;
  48. class LoginCryptoDiffieHellmanHello;
  49. class LoginCryptoHelloUnion;
  50. class BuildInfo;
  51. class FeatureSet;
  52. class APChallenge;
  53. class APResponseMessage;
  54. class LoginCryptoDiffieHellmanResponse;
  55. class LoginCryptoResponseUnion;
  56. class CryptoResponseUnion;
  57. class PoWResponseUnion;
  58. class ClientResponsePlaintext;
  59. class ClientHello;
  60. class Header;
  61. class AudioFile;
  62. class Restriction;
  63. class Image;
  64. class ImageGroup;
  65. class Album;
  66. class Artist;
  67. class Track;
  68. class Episode;
  69. class TrackRef;
  70. class State;
  71. class Capability;
  72. class DeviceState;
  73. class Frame;
  74. class AnyRef {
  75. public:
  76. ReflectTypeID typeID;
  77. AnyRef() {};
  78. AnyRef(ReflectTypeID typeID, void *obj) {
  79. this->typeID = typeID;
  80. this->value.voidptr = obj;
  81. }
  82. template<typename T>
  83. T *as() {
  84. // if(T::_TYPE_ID != this->typeID) {
  85. // throw "invalid as call";
  86. // }
  87. return (T*) this->value.voidptr;
  88. }
  89. template<typename T>
  90. bool is() {
  91. if constexpr(std::is_same<T, ReflectTypeID>::value) {
  92. return ReflectTypeID::EnumReflectTypeID == this->typeID;
  93. } else
  94. if constexpr(std::is_same<T, ReflectTypeKind>::value) {
  95. return ReflectTypeID::EnumReflectTypeKind == this->typeID;
  96. } else
  97. if constexpr(std::is_same<T, std::vector<ReflectField>>::value) {
  98. return ReflectTypeID::VectorOfClassReflectField == this->typeID;
  99. } else
  100. if constexpr(std::is_same<T, std::vector<ReflectEnumValue>>::value) {
  101. return ReflectTypeID::VectorOfClassReflectEnumValue == this->typeID;
  102. } else
  103. if constexpr(std::is_same<T, int32_t>::value) {
  104. return ReflectTypeID::Int32 == this->typeID;
  105. } else
  106. if constexpr(std::is_same<T, int64_t>::value) {
  107. return ReflectTypeID::Int64 == this->typeID;
  108. } else
  109. if constexpr(std::is_same<T, uint32_t>::value) {
  110. return ReflectTypeID::Uint32 == this->typeID;
  111. } else
  112. if constexpr(std::is_same<T, uint8_t>::value) {
  113. return ReflectTypeID::Uint8 == this->typeID;
  114. } else
  115. if constexpr(std::is_same<T, int>::value) {
  116. return ReflectTypeID::Int == this->typeID;
  117. } else
  118. if constexpr(std::is_same<T, unsigned char>::value) {
  119. return ReflectTypeID::UnsignedChar == this->typeID;
  120. } else
  121. if constexpr(std::is_same<T, float>::value) {
  122. return ReflectTypeID::Float == this->typeID;
  123. } else
  124. if constexpr(std::is_same<T, std::string>::value) {
  125. return ReflectTypeID::String == this->typeID;
  126. } else
  127. if constexpr(std::is_same<T, uint64_t>::value) {
  128. return ReflectTypeID::Uint64 == this->typeID;
  129. } else
  130. if constexpr(std::is_same<T, char>::value) {
  131. return ReflectTypeID::Char == this->typeID;
  132. } else
  133. if constexpr(std::is_same<T, double>::value) {
  134. return ReflectTypeID::Double == this->typeID;
  135. } else
  136. if constexpr(std::is_same<T, bool>::value) {
  137. return ReflectTypeID::Bool == this->typeID;
  138. } else
  139. if constexpr(std::is_same<T, std::vector<uint8_t>>::value) {
  140. return ReflectTypeID::VectorOfUint8 == this->typeID;
  141. } else
  142. if constexpr(std::is_same<T, CpuFamily>::value) {
  143. return ReflectTypeID::EnumCpuFamily == this->typeID;
  144. } else
  145. if constexpr(std::is_same<T, Os>::value) {
  146. return ReflectTypeID::EnumOs == this->typeID;
  147. } else
  148. if constexpr(std::is_same<T, AuthenticationType>::value) {
  149. return ReflectTypeID::EnumAuthenticationType == this->typeID;
  150. } else
  151. if constexpr(std::is_same<T, std::optional<std::string>>::value) {
  152. return ReflectTypeID::OptionalOfString == this->typeID;
  153. } else
  154. if constexpr(std::is_same<T, std::optional<std::vector<uint8_t>>>::value) {
  155. return ReflectTypeID::OptionalOfVectorOfUint8 == this->typeID;
  156. } else
  157. if constexpr(std::is_same<T, Product>::value) {
  158. return ReflectTypeID::EnumProduct == this->typeID;
  159. } else
  160. if constexpr(std::is_same<T, Platform>::value) {
  161. return ReflectTypeID::EnumPlatform == this->typeID;
  162. } else
  163. if constexpr(std::is_same<T, Cryptosuite>::value) {
  164. return ReflectTypeID::EnumCryptosuite == this->typeID;
  165. } else
  166. if constexpr(std::is_same<T, std::optional<LoginCryptoDiffieHellmanChallenge>>::value) {
  167. return ReflectTypeID::OptionalOfClassLoginCryptoDiffieHellmanChallenge == this->typeID;
  168. } else
  169. if constexpr(std::is_same<T, std::optional<LoginCryptoDiffieHellmanHello>>::value) {
  170. return ReflectTypeID::OptionalOfClassLoginCryptoDiffieHellmanHello == this->typeID;
  171. } else
  172. if constexpr(std::is_same<T, std::optional<bool>>::value) {
  173. return ReflectTypeID::OptionalOfBool == this->typeID;
  174. } else
  175. if constexpr(std::is_same<T, std::optional<APChallenge>>::value) {
  176. return ReflectTypeID::OptionalOfClassAPChallenge == this->typeID;
  177. } else
  178. if constexpr(std::is_same<T, std::optional<LoginCryptoDiffieHellmanResponse>>::value) {
  179. return ReflectTypeID::OptionalOfClassLoginCryptoDiffieHellmanResponse == this->typeID;
  180. } else
  181. if constexpr(std::is_same<T, std::vector<Cryptosuite>>::value) {
  182. return ReflectTypeID::VectorOfEnumCryptosuite == this->typeID;
  183. } else
  184. if constexpr(std::is_same<T, std::optional<FeatureSet>>::value) {
  185. return ReflectTypeID::OptionalOfClassFeatureSet == this->typeID;
  186. } else
  187. if constexpr(std::is_same<T, AudioFormat>::value) {
  188. return ReflectTypeID::EnumAudioFormat == this->typeID;
  189. } else
  190. if constexpr(std::is_same<T, std::optional<AudioFormat>>::value) {
  191. return ReflectTypeID::OptionalOfEnumAudioFormat == this->typeID;
  192. } else
  193. if constexpr(std::is_same<T, std::vector<Image>>::value) {
  194. return ReflectTypeID::VectorOfClassImage == this->typeID;
  195. } else
  196. if constexpr(std::is_same<T, std::optional<ImageGroup>>::value) {
  197. return ReflectTypeID::OptionalOfClassImageGroup == this->typeID;
  198. } else
  199. if constexpr(std::is_same<T, std::optional<Album>>::value) {
  200. return ReflectTypeID::OptionalOfClassAlbum == this->typeID;
  201. } else
  202. if constexpr(std::is_same<T, std::vector<Artist>>::value) {
  203. return ReflectTypeID::VectorOfClassArtist == this->typeID;
  204. } else
  205. if constexpr(std::is_same<T, std::optional<int32_t>>::value) {
  206. return ReflectTypeID::OptionalOfInt32 == this->typeID;
  207. } else
  208. if constexpr(std::is_same<T, std::vector<Restriction>>::value) {
  209. return ReflectTypeID::VectorOfClassRestriction == this->typeID;
  210. } else
  211. if constexpr(std::is_same<T, std::vector<AudioFile>>::value) {
  212. return ReflectTypeID::VectorOfClassAudioFile == this->typeID;
  213. } else
  214. if constexpr(std::is_same<T, std::vector<Track>>::value) {
  215. return ReflectTypeID::VectorOfClassTrack == this->typeID;
  216. } else
  217. if constexpr(std::is_same<T, MessageType>::value) {
  218. return ReflectTypeID::EnumMessageType == this->typeID;
  219. } else
  220. if constexpr(std::is_same<T, PlayStatus>::value) {
  221. return ReflectTypeID::EnumPlayStatus == this->typeID;
  222. } else
  223. if constexpr(std::is_same<T, CapabilityType>::value) {
  224. return ReflectTypeID::EnumCapabilityType == this->typeID;
  225. } else
  226. if constexpr(std::is_same<T, std::optional<uint32_t>>::value) {
  227. return ReflectTypeID::OptionalOfUint32 == this->typeID;
  228. } else
  229. if constexpr(std::is_same<T, std::optional<PlayStatus>>::value) {
  230. return ReflectTypeID::OptionalOfEnumPlayStatus == this->typeID;
  231. } else
  232. if constexpr(std::is_same<T, std::optional<uint64_t>>::value) {
  233. return ReflectTypeID::OptionalOfUint64 == this->typeID;
  234. } else
  235. if constexpr(std::is_same<T, std::vector<TrackRef>>::value) {
  236. return ReflectTypeID::VectorOfClassTrackRef == this->typeID;
  237. } else
  238. if constexpr(std::is_same<T, std::optional<CapabilityType>>::value) {
  239. return ReflectTypeID::OptionalOfEnumCapabilityType == this->typeID;
  240. } else
  241. if constexpr(std::is_same<T, std::vector<int64_t>>::value) {
  242. return ReflectTypeID::VectorOfInt64 == this->typeID;
  243. } else
  244. if constexpr(std::is_same<T, std::vector<std::string>>::value) {
  245. return ReflectTypeID::VectorOfString == this->typeID;
  246. } else
  247. if constexpr(std::is_same<T, std::optional<int64_t>>::value) {
  248. return ReflectTypeID::OptionalOfInt64 == this->typeID;
  249. } else
  250. if constexpr(std::is_same<T, std::vector<Capability>>::value) {
  251. return ReflectTypeID::VectorOfClassCapability == this->typeID;
  252. } else
  253. if constexpr(std::is_same<T, std::optional<MessageType>>::value) {
  254. return ReflectTypeID::OptionalOfEnumMessageType == this->typeID;
  255. } else
  256. if constexpr(std::is_same<T, std::optional<DeviceState>>::value) {
  257. return ReflectTypeID::OptionalOfClassDeviceState == this->typeID;
  258. } else
  259. if constexpr(std::is_same<T, std::optional<State>>::value) {
  260. return ReflectTypeID::OptionalOfClassState == this->typeID;
  261. } else
  262. {
  263. return T::_TYPE_ID == this->typeID;
  264. }
  265. }
  266. ReflectType *reflectType();
  267. AnyRef getField(int i);
  268. template <typename T>
  269. static AnyRef of(T *obj)
  270. {
  271. ReflectTypeID typeID;
  272. if constexpr(std::is_same<T, ReflectTypeID>::value) {
  273. typeID = ReflectTypeID::EnumReflectTypeID;
  274. } else
  275. if constexpr(std::is_same<T, ReflectTypeKind>::value) {
  276. typeID = ReflectTypeID::EnumReflectTypeKind;
  277. } else
  278. if constexpr(std::is_same<T, std::vector<ReflectField>>::value) {
  279. typeID = ReflectTypeID::VectorOfClassReflectField;
  280. } else
  281. if constexpr(std::is_same<T, std::vector<ReflectEnumValue>>::value) {
  282. typeID = ReflectTypeID::VectorOfClassReflectEnumValue;
  283. } else
  284. if constexpr(std::is_same<T, int32_t>::value) {
  285. typeID = ReflectTypeID::Int32;
  286. } else
  287. if constexpr(std::is_same<T, int64_t>::value) {
  288. typeID = ReflectTypeID::Int64;
  289. } else
  290. if constexpr(std::is_same<T, uint32_t>::value) {
  291. typeID = ReflectTypeID::Uint32;
  292. } else
  293. if constexpr(std::is_same<T, uint8_t>::value) {
  294. typeID = ReflectTypeID::Uint8;
  295. } else
  296. if constexpr(std::is_same<T, int>::value) {
  297. typeID = ReflectTypeID::Int;
  298. } else
  299. if constexpr(std::is_same<T, unsigned char>::value) {
  300. typeID = ReflectTypeID::UnsignedChar;
  301. } else
  302. if constexpr(std::is_same<T, float>::value) {
  303. typeID = ReflectTypeID::Float;
  304. } else
  305. if constexpr(std::is_same<T, std::string>::value) {
  306. typeID = ReflectTypeID::String;
  307. } else
  308. if constexpr(std::is_same<T, uint64_t>::value) {
  309. typeID = ReflectTypeID::Uint64;
  310. } else
  311. if constexpr(std::is_same<T, char>::value) {
  312. typeID = ReflectTypeID::Char;
  313. } else
  314. if constexpr(std::is_same<T, double>::value) {
  315. typeID = ReflectTypeID::Double;
  316. } else
  317. if constexpr(std::is_same<T, bool>::value) {
  318. typeID = ReflectTypeID::Bool;
  319. } else
  320. if constexpr(std::is_same<T, std::vector<uint8_t>>::value) {
  321. typeID = ReflectTypeID::VectorOfUint8;
  322. } else
  323. if constexpr(std::is_same<T, CpuFamily>::value) {
  324. typeID = ReflectTypeID::EnumCpuFamily;
  325. } else
  326. if constexpr(std::is_same<T, Os>::value) {
  327. typeID = ReflectTypeID::EnumOs;
  328. } else
  329. if constexpr(std::is_same<T, AuthenticationType>::value) {
  330. typeID = ReflectTypeID::EnumAuthenticationType;
  331. } else
  332. if constexpr(std::is_same<T, std::optional<std::string>>::value) {
  333. typeID = ReflectTypeID::OptionalOfString;
  334. } else
  335. if constexpr(std::is_same<T, std::optional<std::vector<uint8_t>>>::value) {
  336. typeID = ReflectTypeID::OptionalOfVectorOfUint8;
  337. } else
  338. if constexpr(std::is_same<T, Product>::value) {
  339. typeID = ReflectTypeID::EnumProduct;
  340. } else
  341. if constexpr(std::is_same<T, Platform>::value) {
  342. typeID = ReflectTypeID::EnumPlatform;
  343. } else
  344. if constexpr(std::is_same<T, Cryptosuite>::value) {
  345. typeID = ReflectTypeID::EnumCryptosuite;
  346. } else
  347. if constexpr(std::is_same<T, std::optional<LoginCryptoDiffieHellmanChallenge>>::value) {
  348. typeID = ReflectTypeID::OptionalOfClassLoginCryptoDiffieHellmanChallenge;
  349. } else
  350. if constexpr(std::is_same<T, std::optional<LoginCryptoDiffieHellmanHello>>::value) {
  351. typeID = ReflectTypeID::OptionalOfClassLoginCryptoDiffieHellmanHello;
  352. } else
  353. if constexpr(std::is_same<T, std::optional<bool>>::value) {
  354. typeID = ReflectTypeID::OptionalOfBool;
  355. } else
  356. if constexpr(std::is_same<T, std::optional<APChallenge>>::value) {
  357. typeID = ReflectTypeID::OptionalOfClassAPChallenge;
  358. } else
  359. if constexpr(std::is_same<T, std::optional<LoginCryptoDiffieHellmanResponse>>::value) {
  360. typeID = ReflectTypeID::OptionalOfClassLoginCryptoDiffieHellmanResponse;
  361. } else
  362. if constexpr(std::is_same<T, std::vector<Cryptosuite>>::value) {
  363. typeID = ReflectTypeID::VectorOfEnumCryptosuite;
  364. } else
  365. if constexpr(std::is_same<T, std::optional<FeatureSet>>::value) {
  366. typeID = ReflectTypeID::OptionalOfClassFeatureSet;
  367. } else
  368. if constexpr(std::is_same<T, AudioFormat>::value) {
  369. typeID = ReflectTypeID::EnumAudioFormat;
  370. } else
  371. if constexpr(std::is_same<T, std::optional<AudioFormat>>::value) {
  372. typeID = ReflectTypeID::OptionalOfEnumAudioFormat;
  373. } else
  374. if constexpr(std::is_same<T, std::vector<Image>>::value) {
  375. typeID = ReflectTypeID::VectorOfClassImage;
  376. } else
  377. if constexpr(std::is_same<T, std::optional<ImageGroup>>::value) {
  378. typeID = ReflectTypeID::OptionalOfClassImageGroup;
  379. } else
  380. if constexpr(std::is_same<T, std::optional<Album>>::value) {
  381. typeID = ReflectTypeID::OptionalOfClassAlbum;
  382. } else
  383. if constexpr(std::is_same<T, std::vector<Artist>>::value) {
  384. typeID = ReflectTypeID::VectorOfClassArtist;
  385. } else
  386. if constexpr(std::is_same<T, std::optional<int32_t>>::value) {
  387. typeID = ReflectTypeID::OptionalOfInt32;
  388. } else
  389. if constexpr(std::is_same<T, std::vector<Restriction>>::value) {
  390. typeID = ReflectTypeID::VectorOfClassRestriction;
  391. } else
  392. if constexpr(std::is_same<T, std::vector<AudioFile>>::value) {
  393. typeID = ReflectTypeID::VectorOfClassAudioFile;
  394. } else
  395. if constexpr(std::is_same<T, std::vector<Track>>::value) {
  396. typeID = ReflectTypeID::VectorOfClassTrack;
  397. } else
  398. if constexpr(std::is_same<T, MessageType>::value) {
  399. typeID = ReflectTypeID::EnumMessageType;
  400. } else
  401. if constexpr(std::is_same<T, PlayStatus>::value) {
  402. typeID = ReflectTypeID::EnumPlayStatus;
  403. } else
  404. if constexpr(std::is_same<T, CapabilityType>::value) {
  405. typeID = ReflectTypeID::EnumCapabilityType;
  406. } else
  407. if constexpr(std::is_same<T, std::optional<uint32_t>>::value) {
  408. typeID = ReflectTypeID::OptionalOfUint32;
  409. } else
  410. if constexpr(std::is_same<T, std::optional<PlayStatus>>::value) {
  411. typeID = ReflectTypeID::OptionalOfEnumPlayStatus;
  412. } else
  413. if constexpr(std::is_same<T, std::optional<uint64_t>>::value) {
  414. typeID = ReflectTypeID::OptionalOfUint64;
  415. } else
  416. if constexpr(std::is_same<T, std::vector<TrackRef>>::value) {
  417. typeID = ReflectTypeID::VectorOfClassTrackRef;
  418. } else
  419. if constexpr(std::is_same<T, std::optional<CapabilityType>>::value) {
  420. typeID = ReflectTypeID::OptionalOfEnumCapabilityType;
  421. } else
  422. if constexpr(std::is_same<T, std::vector<int64_t>>::value) {
  423. typeID = ReflectTypeID::VectorOfInt64;
  424. } else
  425. if constexpr(std::is_same<T, std::vector<std::string>>::value) {
  426. typeID = ReflectTypeID::VectorOfString;
  427. } else
  428. if constexpr(std::is_same<T, std::optional<int64_t>>::value) {
  429. typeID = ReflectTypeID::OptionalOfInt64;
  430. } else
  431. if constexpr(std::is_same<T, std::vector<Capability>>::value) {
  432. typeID = ReflectTypeID::VectorOfClassCapability;
  433. } else
  434. if constexpr(std::is_same<T, std::optional<MessageType>>::value) {
  435. typeID = ReflectTypeID::OptionalOfEnumMessageType;
  436. } else
  437. if constexpr(std::is_same<T, std::optional<DeviceState>>::value) {
  438. typeID = ReflectTypeID::OptionalOfClassDeviceState;
  439. } else
  440. if constexpr(std::is_same<T, std::optional<State>>::value) {
  441. typeID = ReflectTypeID::OptionalOfClassState;
  442. } else
  443. {
  444. typeID = T::_TYPE_ID;
  445. }
  446. AnyRef a;
  447. a.typeID = typeID;
  448. a.value.voidptr = (void*) obj;
  449. return a;
  450. }
  451. union ReflectedTypes {
  452. void *voidptr;
  453. ReflectTypeID *u_EnumReflectTypeID;
  454. ReflectField *u_ClassReflectField;
  455. ReflectEnumValue *u_ClassReflectEnumValue;
  456. ReflectType *u_ClassReflectType;
  457. ReflectTypeKind *u_EnumReflectTypeKind;
  458. std::vector<ReflectField> *u_VectorOfClassReflectField;
  459. std::vector<ReflectEnumValue> *u_VectorOfClassReflectEnumValue;
  460. int32_t *u_Int32;
  461. int64_t *u_Int64;
  462. uint32_t *u_Uint32;
  463. uint8_t *u_Uint8;
  464. int *u_Int;
  465. unsigned char *u_UnsignedChar;
  466. float *u_Float;
  467. std::string *u_String;
  468. uint64_t *u_Uint64;
  469. char *u_Char;
  470. double *u_Double;
  471. bool *u_Bool;
  472. std::vector<uint8_t> *u_VectorOfUint8;
  473. CpuFamily *u_EnumCpuFamily;
  474. Os *u_EnumOs;
  475. AuthenticationType *u_EnumAuthenticationType;
  476. SystemInfo *u_ClassSystemInfo;
  477. LoginCredentials *u_ClassLoginCredentials;
  478. ClientResponseEncrypted *u_ClassClientResponseEncrypted;
  479. std::optional<std::string> *u_OptionalOfString;
  480. std::optional<std::vector<uint8_t>> *u_OptionalOfVectorOfUint8;
  481. Product *u_EnumProduct;
  482. Platform *u_EnumPlatform;
  483. Cryptosuite *u_EnumCryptosuite;
  484. LoginCryptoDiffieHellmanChallenge *u_ClassLoginCryptoDiffieHellmanChallenge;
  485. LoginCryptoChallengeUnion *u_ClassLoginCryptoChallengeUnion;
  486. LoginCryptoDiffieHellmanHello *u_ClassLoginCryptoDiffieHellmanHello;
  487. LoginCryptoHelloUnion *u_ClassLoginCryptoHelloUnion;
  488. BuildInfo *u_ClassBuildInfo;
  489. FeatureSet *u_ClassFeatureSet;
  490. APChallenge *u_ClassAPChallenge;
  491. APResponseMessage *u_ClassAPResponseMessage;
  492. LoginCryptoDiffieHellmanResponse *u_ClassLoginCryptoDiffieHellmanResponse;
  493. LoginCryptoResponseUnion *u_ClassLoginCryptoResponseUnion;
  494. CryptoResponseUnion *u_ClassCryptoResponseUnion;
  495. PoWResponseUnion *u_ClassPoWResponseUnion;
  496. ClientResponsePlaintext *u_ClassClientResponsePlaintext;
  497. ClientHello *u_ClassClientHello;
  498. std::optional<LoginCryptoDiffieHellmanChallenge> *u_OptionalOfClassLoginCryptoDiffieHellmanChallenge;
  499. std::optional<LoginCryptoDiffieHellmanHello> *u_OptionalOfClassLoginCryptoDiffieHellmanHello;
  500. std::optional<bool> *u_OptionalOfBool;
  501. std::optional<APChallenge> *u_OptionalOfClassAPChallenge;
  502. std::optional<LoginCryptoDiffieHellmanResponse> *u_OptionalOfClassLoginCryptoDiffieHellmanResponse;
  503. std::vector<Cryptosuite> *u_VectorOfEnumCryptosuite;
  504. std::optional<FeatureSet> *u_OptionalOfClassFeatureSet;
  505. Header *u_ClassHeader;
  506. AudioFormat *u_EnumAudioFormat;
  507. AudioFile *u_ClassAudioFile;
  508. Restriction *u_ClassRestriction;
  509. Image *u_ClassImage;
  510. ImageGroup *u_ClassImageGroup;
  511. Album *u_ClassAlbum;
  512. Artist *u_ClassArtist;
  513. Track *u_ClassTrack;
  514. Episode *u_ClassEpisode;
  515. std::optional<AudioFormat> *u_OptionalOfEnumAudioFormat;
  516. std::vector<Image> *u_VectorOfClassImage;
  517. std::optional<ImageGroup> *u_OptionalOfClassImageGroup;
  518. std::optional<Album> *u_OptionalOfClassAlbum;
  519. std::vector<Artist> *u_VectorOfClassArtist;
  520. std::optional<int32_t> *u_OptionalOfInt32;
  521. std::vector<Restriction> *u_VectorOfClassRestriction;
  522. std::vector<AudioFile> *u_VectorOfClassAudioFile;
  523. std::vector<Track> *u_VectorOfClassTrack;
  524. MessageType *u_EnumMessageType;
  525. PlayStatus *u_EnumPlayStatus;
  526. CapabilityType *u_EnumCapabilityType;
  527. TrackRef *u_ClassTrackRef;
  528. State *u_ClassState;
  529. Capability *u_ClassCapability;
  530. DeviceState *u_ClassDeviceState;
  531. Frame *u_ClassFrame;
  532. std::optional<uint32_t> *u_OptionalOfUint32;
  533. std::optional<PlayStatus> *u_OptionalOfEnumPlayStatus;
  534. std::optional<uint64_t> *u_OptionalOfUint64;
  535. std::vector<TrackRef> *u_VectorOfClassTrackRef;
  536. std::optional<CapabilityType> *u_OptionalOfEnumCapabilityType;
  537. std::vector<int64_t> *u_VectorOfInt64;
  538. std::vector<std::string> *u_VectorOfString;
  539. std::optional<int64_t> *u_OptionalOfInt64;
  540. std::vector<Capability> *u_VectorOfClassCapability;
  541. std::optional<MessageType> *u_OptionalOfEnumMessageType;
  542. std::optional<DeviceState> *u_OptionalOfClassDeviceState;
  543. std::optional<State> *u_OptionalOfClassState;
  544. } value;
  545. private:
  546. };
  547. template<class T>
  548. class __VectorManipulator {
  549. public:
  550. static void push_back(AnyRef &vec, AnyRef &val) {
  551. auto theVector = reinterpret_cast<std::vector<T>*>(vec.value.voidptr);
  552. auto theValue = *reinterpret_cast<T*>(val.value.voidptr);
  553. theVector->push_back(theValue);
  554. };
  555. static AnyRef at(AnyRef &vec, size_t index) {
  556. auto theVector = reinterpret_cast<std::vector<T>*>(vec.value.voidptr);
  557. return AnyRef::of<T>(&(*theVector)[index]);
  558. };
  559. static size_t size(AnyRef &vec) {
  560. auto theVector = reinterpret_cast<std::vector<T>*>(vec.value.voidptr);
  561. return theVector->size();
  562. };
  563. static void emplace_back(AnyRef &vec) {
  564. auto theVector = reinterpret_cast<std::vector<T>*>(vec.value.voidptr);
  565. theVector->emplace_back();
  566. };
  567. static void clear(AnyRef &vec) {
  568. auto theVector = reinterpret_cast<std::vector<T>*>(vec.value.voidptr);
  569. theVector->clear();
  570. };
  571. static void reserve(AnyRef &vec, size_t n) {
  572. auto theVector = reinterpret_cast<std::vector<T>*>(vec.value.voidptr);
  573. theVector->reserve(n);
  574. };
  575. };
  576. template<class T>
  577. class __OptionalManipulator {
  578. public:
  579. static AnyRef get(AnyRef &opt) {
  580. auto theOptional = reinterpret_cast<std::optional<T>*>(opt.value.voidptr);
  581. return AnyRef::of<T>(&**theOptional);
  582. }
  583. static bool has_value(AnyRef &opt) {
  584. auto theOptional = reinterpret_cast<std::optional<T>*>(opt.value.voidptr);
  585. return theOptional->has_value();
  586. }
  587. static void set(AnyRef &opt, AnyRef &val) {
  588. auto theOptional = reinterpret_cast<std::optional<T>*>(opt.value.voidptr);
  589. auto theValue = reinterpret_cast<T*>(val.value.voidptr);
  590. *theOptional = *theValue;
  591. }
  592. static void reset(AnyRef &opt) {
  593. auto theOptional = reinterpret_cast<std::optional<T>*>(opt.value.voidptr);
  594. theOptional->reset();
  595. }
  596. static void emplaceEmpty(AnyRef &opt) {
  597. auto theOptional = reinterpret_cast<std::optional<T>*>(opt.value.voidptr);
  598. theOptional->emplace();
  599. }
  600. };
  601. extern ReflectType reflectTypeInfo[92];
  602. class UniqueAny: public AnyRef {
  603. public:
  604. UniqueAny() {
  605. this->value.voidptr = nullptr;
  606. };
  607. UniqueAny(ReflectTypeID typeID) {
  608. this->typeID = typeID;
  609. auto typeInfo = &reflectTypeInfo[static_cast<int>(typeID)];
  610. AnyRef a;
  611. this->value.voidptr = new unsigned char[typeInfo->size];
  612. typeInfo->_Construct(this->value.voidptr);
  613. };
  614. ~UniqueAny() {
  615. auto typeInfo = &reflectTypeInfo[static_cast<int>(typeID)];
  616. typeInfo->_Destruct(this->value.voidptr);
  617. delete reinterpret_cast<char *>(this->value.voidptr);
  618. };
  619. };
  620. class AnyVectorRef {
  621. public:
  622. AnyRef ref;
  623. AnyVectorRef(AnyRef r): ref(r) {}
  624. void push_back(AnyRef &v) {
  625. auto typeInfo = &reflectTypeInfo[static_cast<int>(this->ref.typeID)];
  626. typeInfo->vectorOps.push_back(ref, v);
  627. }
  628. size_t size() {
  629. auto typeInfo = &reflectTypeInfo[static_cast<int>(this->ref.typeID)];
  630. return typeInfo->vectorOps.size(ref);
  631. }
  632. void emplace_back() {
  633. auto typeInfo = &reflectTypeInfo[static_cast<int>(this->ref.typeID)];
  634. typeInfo->vectorOps.emplace_back(ref);
  635. }
  636. void clear() {
  637. auto typeInfo = &reflectTypeInfo[static_cast<int>(this->ref.typeID)];
  638. typeInfo->vectorOps.clear(ref);
  639. }
  640. void reserve(size_t n) {
  641. auto typeInfo = &reflectTypeInfo[static_cast<int>(this->ref.typeID)];
  642. typeInfo->vectorOps.reserve(ref, n);
  643. }
  644. AnyRef at(size_t index) {
  645. auto typeInfo = &reflectTypeInfo[static_cast<int>(this->ref.typeID)];
  646. return typeInfo->vectorOps.at(ref, index);
  647. }
  648. };
  649. class AnyOptionalRef {
  650. public:
  651. AnyRef ref;
  652. AnyOptionalRef(AnyRef r): ref(r) {}
  653. AnyRef get() {
  654. auto typeInfo = &reflectTypeInfo[static_cast<int>(this->ref.typeID)];
  655. return typeInfo->optionalOps.get(ref);
  656. }
  657. bool has_value() {
  658. auto typeInfo = &reflectTypeInfo[static_cast<int>(this->ref.typeID)];
  659. return typeInfo->optionalOps.has_value(ref);
  660. }
  661. void set(AnyRef &o) {
  662. auto typeInfo = &reflectTypeInfo[static_cast<int>(this->ref.typeID)];
  663. typeInfo->optionalOps.set(ref, o);
  664. }
  665. void reset() {
  666. auto typeInfo = &reflectTypeInfo[static_cast<int>(this->ref.typeID)];
  667. typeInfo->optionalOps.reset(ref);
  668. }
  669. void emplaceEmpty() {
  670. auto typeInfo = &reflectTypeInfo[static_cast<int>(this->ref.typeID)];
  671. typeInfo->optionalOps.emplaceEmpty(ref);
  672. }
  673. };
  674. #endif