RakNetStructsAndClasses.i 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. //----------------------------Additional Class/Struct Defines-----------------------
  2. //These is here because it is a nested class and swig doesn't handle nested/structs/classes, this presents the interface for this struct. If the struct changes in the code so must this
  3. //These are DataStructures::Table
  4. /// Stores the name and type of the column
  5. /// \internal
  6. struct ColumnDescriptor
  7. {
  8. ColumnDescriptor();
  9. ~ColumnDescriptor();
  10. ColumnDescriptor(const char cn[_TABLE_MAX_COLUMN_NAME_LENGTH],DataStructures::Table::ColumnType ct);
  11. char columnName[_TABLE_MAX_COLUMN_NAME_LENGTH];
  12. DataStructures::Table::ColumnType columnType;
  13. };
  14. struct Cell
  15. {
  16. Cell();
  17. ~Cell();
  18. Cell(double numericValue, char *charValue, void *ptr, DataStructures::Table::ColumnType type);
  19. void SetByType(double numericValue, char *charValue, void *ptr, DataStructures::Table::ColumnType type);
  20. void Clear(void);
  21. /// Numeric
  22. void Set(int input);
  23. void Set(unsigned int input);
  24. void Set(double input);
  25. /// String
  26. void Set(const char *input);
  27. /// Binary
  28. void Set(const char *input, int inputLength);
  29. /// Pointer
  30. void SetPtr(void* p);
  31. /// Numeric
  32. void Get(int *output);
  33. void Get(double *output);
  34. /// String
  35. void Get(char *output);
  36. /// Binary
  37. void Get(char *output, int *outputLength);
  38. RakNet::RakString ToString(DataStructures::Table::ColumnType columnType);
  39. // assignment operator and copy constructor
  40. Cell& operator = ( const Cell& input );
  41. Cell( const Cell & input);
  42. DataStructures::Table::ColumnType EstimateColumnType(void) const;
  43. bool isEmpty;
  44. double i;
  45. char *c;
  46. void *ptr;
  47. };
  48. /// Stores the list of cells for this row, and a special flag used for internal sorting
  49. struct Row
  50. {
  51. // list of cells
  52. DataStructures::List<Cell*> cells;
  53. /// Numeric
  54. void UpdateCell(unsigned columnIndex, double value);
  55. /// String
  56. void UpdateCell(unsigned columnIndex, const char *str);
  57. /// Binary
  58. void UpdateCell(unsigned columnIndex, int byteLength, const char *data);
  59. };
  60. // Compare the cell value for a row at columnName to the cellValue using operation.
  61. struct FilterQuery
  62. {
  63. FilterQuery();
  64. ~FilterQuery();
  65. FilterQuery(unsigned column, Cell *cell, DataStructures::Table::FilterQueryType op);
  66. // If columnName is specified, columnIndex will be looked up using it.
  67. char columnName[_TABLE_MAX_COLUMN_NAME_LENGTH];
  68. unsigned columnIndex;
  69. Cell *cellValue;
  70. DataStructures::Table::FilterQueryType operation;
  71. };
  72. // Sort on increasing or decreasing order for a particular column
  73. struct SortQuery
  74. {
  75. /// The index of the table column we are sorting on
  76. unsigned columnIndex;
  77. /// See SortQueryType
  78. DataStructures::Table::SortQueryType operation;
  79. };
  80. //FileListTransferCBInterFace
  81. struct OnFileStruct
  82. {
  83. /// \brief The index into the set of files, from 0 to numberOfFilesInThisSet
  84. unsigned fileIndex;
  85. /// \brief The name of the file
  86. char fileName[512];
  87. /// \brief The data pointed to by the file
  88. char *fileData;
  89. /// \brief The actual length of this file.
  90. BitSize_t byteLengthOfThisFile;
  91. /// \brief How many bytes of this file has been downloaded
  92. BitSize_t bytesDownloadedForThisFile;
  93. /// \brief Files are transmitted in sets, where more than one set of files can be transmitted at the same time.
  94. /// \details This is the identifier for the set, which is returned by FileListTransfer::SetupReceive
  95. unsigned short setID;
  96. /// \brief The number of files that are in this set.
  97. unsigned numberOfFilesInThisSet;
  98. /// \brief The total length of the transmitted files for this set, after being uncompressed
  99. unsigned byteLengthOfThisSet;
  100. /// \brief The total length, in bytes, downloaded for this set.
  101. unsigned bytesDownloadedForThisSet;
  102. /// \brief User data passed to one of the functions in the FileList class.
  103. /// \details However, on error, this is instead changed to one of the enumerations in the PatchContext structure.
  104. FileListNodeContext context;
  105. /// \brief Who sent this file
  106. SystemAddress senderSystemAddress;
  107. /// \brief Who sent this file. Not valid when using TCP, only RakPeer (UDP)
  108. RakNetGUID senderGuid;
  109. };
  110. struct FileProgressStruct
  111. {
  112. /// \param[out] onFileStruct General information about this file, such as the filename and the first \a partLength bytes. You do NOT need to save this data yourself. The complete file will arrive normally.
  113. OnFileStruct *onFileStruct;
  114. /// \param[out] partCount The zero based index into partTotal. The percentage complete done of this file is 100 * (partCount+1)/partTotal
  115. unsigned int partCount;
  116. /// \param[out] partTotal The total number of parts this file was split into. Each part will be roughly the MTU size, minus the UDP header and RakNet headers
  117. unsigned int partTotal;
  118. /// \param[out] dataChunkLength How many bytes long firstDataChunk and iriDataChunk are
  119. unsigned int dataChunkLength;
  120. /// \param[out] firstDataChunk The first \a partLength of the final file. If you store identifying information about the file in the first \a partLength bytes, you can read them while the download is taking place. If this hasn't arrived yet, firstDataChunk will be 0
  121. char *firstDataChunk;
  122. /// \param[out] iriDataChunk If the remote system is sending this file using IncrementalReadInterface, then this is the chunk we just downloaded. It will not exist in memory after this callback. You should either store this to disk, or in memory. If it is 0, then the file is smaller than one chunk, and will be held in memory automatically
  123. char *iriDataChunk;
  124. /// \param[out] iriWriteOffset Offset in bytes from the start of the file for the data pointed to by iriDataChunk
  125. unsigned int iriWriteOffset;
  126. /// \param[out] Who sent this file
  127. SystemAddress senderSystemAddress;
  128. /// \param[out] Who sent this file. Not valid when using TCP, only RakPeer (UDP)
  129. RakNetGUID senderGuid;
  130. /// \param[in] allocateIrIDataChunkAutomatically If true, then RakNet will hold iriDataChunk for you and return it in OnFile. Defaults to true
  131. bool allocateIrIDataChunkAutomatically;
  132. };
  133. struct DownloadCompleteStruct
  134. {
  135. /// \brief Files are transmitted in sets, where more than one set of files can be transmitted at the same time.
  136. /// \details This is the identifier for the set, which is returned by FileListTransfer::SetupReceive
  137. unsigned short setID;
  138. /// \brief The number of files that are in this set.
  139. unsigned numberOfFilesInThisSet;
  140. /// \brief The total length of the transmitted files for this set, after being uncompressed
  141. unsigned byteLengthOfThisSet;
  142. /// \brief Who sent this file
  143. SystemAddress senderSystemAddress;
  144. /// \brief Who sent this file. Not valid when using TCP, only RakPeer (UDP)
  145. RakNetGUID senderGuid;
  146. };
粤ICP备19079148号