Table.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. /* ----------------------------------------------------------------------------
  2. * This file was automatically generated by SWIG (http://www.swig.org).
  3. * Version 2.0.1
  4. *
  5. * Do not make changes to this file unless you know what you are doing--modify
  6. * the SWIG interface file instead.
  7. * ----------------------------------------------------------------------------- */
  8. namespace RakNet {
  9. using System;
  10. using System.Runtime.InteropServices;
  11. public class Table : IDisposable {
  12. private HandleRef swigCPtr;
  13. protected bool swigCMemOwn;
  14. internal Table(IntPtr cPtr, bool cMemoryOwn) {
  15. swigCMemOwn = cMemoryOwn;
  16. swigCPtr = new HandleRef(this, cPtr);
  17. }
  18. internal static HandleRef getCPtr(Table obj) {
  19. return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  20. }
  21. ~Table() {
  22. Dispose();
  23. }
  24. public virtual void Dispose() {
  25. lock(this) {
  26. if (swigCPtr.Handle != IntPtr.Zero) {
  27. if (swigCMemOwn) {
  28. swigCMemOwn = false;
  29. RakNetPINVOKE.delete_Table(swigCPtr);
  30. }
  31. swigCPtr = new HandleRef(null, IntPtr.Zero);
  32. }
  33. GC.SuppressFinalize(this);
  34. }
  35. }
  36. public RakNetPageRow GetListHead() {
  37. return GetListHeadHelper();
  38. }
  39. public void SortTable(SortQuery [] sortQueries, uint numSortQueries, out Row[] arg2)
  40. {
  41. RakNetListSortQuery sortQueriesList =null;
  42. if (sortQueries!=null)
  43. {
  44. sortQueriesList = new RakNetListSortQuery();
  45. int listLen = sortQueries.Length;
  46. for (int i = 0; i < listLen; i++)
  47. {
  48. sortQueriesList.Insert(sortQueries[i], "", 1);
  49. }
  50. }
  51. int rowCount= (int)GetRowCount();
  52. Row[] rowArray= new Row[rowCount];
  53. RakNetListTableRow passVal = new RakNetListTableRow();
  54. SortTableHelper(sortQueriesList,numSortQueries,passVal);
  55. for (int i=0; i<rowCount;i++)
  56. {
  57. rowArray[i]=passVal[i];
  58. }
  59. arg2=rowArray;
  60. }
  61. public void GetCellValueByIndex(uint rowIndex, uint columnIndex, out byte[] outByteArray, out int outputLength)
  62. {
  63. int returnInt=0;
  64. Row row = GetRowByIndex(rowIndex,ref returnInt);
  65. int arrayLen=0;
  66. if (row!=null)
  67. {
  68. arrayLen=(int)row.cells[(int)columnIndex].i;
  69. }
  70. byte[] inOutByteArray = new byte[arrayLen];
  71. GetCellValueByIndexHelper(rowIndex,columnIndex,inOutByteArray,out outputLength);
  72. outByteArray=inOutByteArray;
  73. }
  74. public void GetCellValueByIndex(uint rowIndex, uint columnIndex,out string output)
  75. {
  76. int returnInt=0;
  77. Row row = GetRowByIndex(rowIndex,ref returnInt);
  78. int arrayLen=0;
  79. if (row!=null)
  80. {
  81. arrayLen=(int)row.cells[(int)columnIndex].i;
  82. }
  83. String tmp = new String('c', arrayLen);
  84. output=GetCellValueByIndexHelper( rowIndex, columnIndex, tmp);
  85. }
  86. public void QueryTable(uint[] columnIndicesSubset, uint numColumnSubset, FilterQuery[] inclusionFilters, uint numInclusionFilters, uint[] rowIds, uint numRowIDs, Table result)
  87. {
  88. RakNetListFilterQuery inclusionFiltersList =null;
  89. if (inclusionFiltersList!=null)
  90. {
  91. inclusionFiltersList = new RakNetListFilterQuery();
  92. int listLen = inclusionFilters.Length;
  93. for (int i = 0; i < listLen; i++)
  94. {
  95. inclusionFiltersList.Insert(inclusionFilters[i], "", 1);
  96. }
  97. }
  98. QueryTableHelper(columnIndicesSubset, numColumnSubset, inclusionFiltersList, numInclusionFilters, rowIds, numRowIDs, result);
  99. }
  100. public uint ColumnIndex(string columnName) {
  101. return ColumnIndexHelper(columnName);
  102. }
  103. public Table() : this(RakNetPINVOKE.new_Table(), true) {
  104. }
  105. public uint AddColumn(string columnName, Table.ColumnType columnType) {
  106. uint ret = RakNetPINVOKE.Table_AddColumn(swigCPtr, columnName, (int)columnType);
  107. return ret;
  108. }
  109. public void RemoveColumn(uint columnIndex) {
  110. RakNetPINVOKE.Table_RemoveColumn(swigCPtr, columnIndex);
  111. }
  112. public string ColumnName(uint index) {
  113. string ret = RakNetPINVOKE.Table_ColumnName(swigCPtr, index);
  114. return ret;
  115. }
  116. public Table.ColumnType GetColumnType(uint index) {
  117. Table.ColumnType ret = (Table.ColumnType)RakNetPINVOKE.Table_GetColumnType(swigCPtr, index);
  118. return ret;
  119. }
  120. public uint GetColumnCount() {
  121. uint ret = RakNetPINVOKE.Table_GetColumnCount(swigCPtr);
  122. return ret;
  123. }
  124. public uint GetRowCount() {
  125. uint ret = RakNetPINVOKE.Table_GetRowCount(swigCPtr);
  126. return ret;
  127. }
  128. public Row AddRow(uint rowId) {
  129. IntPtr cPtr = RakNetPINVOKE.Table_AddRow__SWIG_0(swigCPtr, rowId);
  130. Row ret = (cPtr == IntPtr.Zero) ? null : new Row(cPtr, false);
  131. return ret;
  132. }
  133. public Row AddRow(uint rowId, RakNetListCell initialCellValues) {
  134. IntPtr cPtr = RakNetPINVOKE.Table_AddRow__SWIG_1(swigCPtr, rowId, RakNetListCell.getCPtr(initialCellValues));
  135. Row ret = (cPtr == IntPtr.Zero) ? null : new Row(cPtr, false);
  136. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  137. return ret;
  138. }
  139. public Row AddRow(uint rowId, RakNetListCellPointer initialCellValues, bool copyCells) {
  140. IntPtr cPtr = RakNetPINVOKE.Table_AddRow__SWIG_2(swigCPtr, rowId, RakNetListCellPointer.getCPtr(initialCellValues), copyCells);
  141. Row ret = (cPtr == IntPtr.Zero) ? null : new Row(cPtr, false);
  142. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  143. return ret;
  144. }
  145. public Row AddRow(uint rowId, RakNetListCellPointer initialCellValues) {
  146. IntPtr cPtr = RakNetPINVOKE.Table_AddRow__SWIG_3(swigCPtr, rowId, RakNetListCellPointer.getCPtr(initialCellValues));
  147. Row ret = (cPtr == IntPtr.Zero) ? null : new Row(cPtr, false);
  148. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  149. return ret;
  150. }
  151. public bool RemoveRow(uint rowId) {
  152. bool ret = RakNetPINVOKE.Table_RemoveRow(swigCPtr, rowId);
  153. return ret;
  154. }
  155. public void RemoveRows(Table tableContainingRowIDs) {
  156. RakNetPINVOKE.Table_RemoveRows(swigCPtr, Table.getCPtr(tableContainingRowIDs));
  157. }
  158. public bool UpdateCell(uint rowId, uint columnIndex, int value) {
  159. bool ret = RakNetPINVOKE.Table_UpdateCell__SWIG_0(swigCPtr, rowId, columnIndex, value);
  160. return ret;
  161. }
  162. public bool UpdateCell(uint rowId, uint columnIndex, string str) {
  163. bool ret = RakNetPINVOKE.Table_UpdateCell__SWIG_1(swigCPtr, rowId, columnIndex, str);
  164. return ret;
  165. }
  166. public bool UpdateCellByIndex(uint rowIndex, uint columnIndex, int value) {
  167. bool ret = RakNetPINVOKE.Table_UpdateCellByIndex__SWIG_0(swigCPtr, rowIndex, columnIndex, value);
  168. return ret;
  169. }
  170. public bool UpdateCellByIndex(uint rowIndex, uint columnIndex, string str) {
  171. bool ret = RakNetPINVOKE.Table_UpdateCellByIndex__SWIG_1(swigCPtr, rowIndex, columnIndex, str);
  172. return ret;
  173. }
  174. public void GetCellValueByIndex(uint rowIndex, uint columnIndex, out int output) {
  175. RakNetPINVOKE.Table_GetCellValueByIndex(swigCPtr, rowIndex, columnIndex, out output);
  176. }
  177. public Row GetRowByID(uint rowId) {
  178. IntPtr cPtr = RakNetPINVOKE.Table_GetRowByID(swigCPtr, rowId);
  179. Row ret = (cPtr == IntPtr.Zero) ? null : new Row(cPtr, false);
  180. return ret;
  181. }
  182. public Row GetRowByIndex(uint rowIndex, ref int key) {
  183. IntPtr cPtr = RakNetPINVOKE.Table_GetRowByIndex(swigCPtr, rowIndex, ref key);
  184. Row ret = (cPtr == IntPtr.Zero) ? null : new Row(cPtr, false);
  185. return ret;
  186. }
  187. public void Clear() {
  188. RakNetPINVOKE.Table_Clear(swigCPtr);
  189. }
  190. public RakNetListColumnDescriptor GetColumns() {
  191. RakNetListColumnDescriptor ret = new RakNetListColumnDescriptor(RakNetPINVOKE.Table_GetColumns(swigCPtr), false);
  192. return ret;
  193. }
  194. public RakNetBPlusTreeRow GetRows() {
  195. RakNetBPlusTreeRow ret = new RakNetBPlusTreeRow(RakNetPINVOKE.Table_GetRows(swigCPtr), false);
  196. return ret;
  197. }
  198. public uint GetAvailableRowId() {
  199. uint ret = RakNetPINVOKE.Table_GetAvailableRowId(swigCPtr);
  200. return ret;
  201. }
  202. public Table CopyData(Table input) {
  203. Table ret = new Table(RakNetPINVOKE.Table_CopyData(swigCPtr, Table.getCPtr(input)), false);
  204. if (RakNetPINVOKE.SWIGPendingException.Pending) throw RakNetPINVOKE.SWIGPendingException.Retrieve();
  205. return ret;
  206. }
  207. private RakNetPageRow GetListHeadHelper() {
  208. IntPtr cPtr = RakNetPINVOKE.Table_GetListHeadHelper(swigCPtr);
  209. RakNetPageRow ret = (cPtr == IntPtr.Zero) ? null : new RakNetPageRow(cPtr, false);
  210. return ret;
  211. }
  212. private void SortTableHelper(RakNetListSortQuery sortQueries, uint numSortQueries, RakNetListTableRow arg2) {
  213. RakNetPINVOKE.Table_SortTableHelper(swigCPtr, RakNetListSortQuery.getCPtr(sortQueries), numSortQueries, RakNetListTableRow.getCPtr(arg2));
  214. }
  215. private void GetCellValueByIndexHelper(uint rowIndex, uint columnIndex, byte[] inOutByteArray, out int outputLength) {
  216. RakNetPINVOKE.Table_GetCellValueByIndexHelper__SWIG_0(swigCPtr, rowIndex, columnIndex, inOutByteArray, out outputLength);
  217. }
  218. private string GetCellValueByIndexHelper(uint rowIndex, uint columnIndex, string output) {
  219. string ret = RakNetPINVOKE.Table_GetCellValueByIndexHelper__SWIG_1(swigCPtr, rowIndex, columnIndex, output);
  220. return ret;
  221. }
  222. public void PrintColumnHeaders(byte[] inOutByteArray, int byteArrayLength, char columnDelineator) {
  223. RakNetPINVOKE.Table_PrintColumnHeaders(swigCPtr, inOutByteArray, byteArrayLength, columnDelineator);
  224. }
  225. public void PrintRow(byte[] inOutByteArray, int byteArrayLength, char columnDelineator, bool printDelineatorForBinary, Row inputRow) {
  226. RakNetPINVOKE.Table_PrintRow(swigCPtr, inOutByteArray, byteArrayLength, columnDelineator, printDelineatorForBinary, Row.getCPtr(inputRow));
  227. }
  228. private void QueryTableHelper(uint[] columnIndicesSubset, uint numColumnSubset, RakNetListFilterQuery inclusionFilters, uint numInclusionFilters, uint[] rowIds, uint numRowIDs, Table result) {
  229. RakNetPINVOKE.Table_QueryTableHelper(swigCPtr, columnIndicesSubset, numColumnSubset, RakNetListFilterQuery.getCPtr(inclusionFilters), numInclusionFilters, rowIds, numRowIDs, Table.getCPtr(result));
  230. }
  231. public bool UpdateCell(uint rowId, uint columnIndex, int byteLength, byte[] inByteArray) {
  232. bool ret = RakNetPINVOKE.Table_UpdateCell__SWIG_2(swigCPtr, rowId, columnIndex, byteLength, inByteArray);
  233. return ret;
  234. }
  235. public bool UpdateCellByIndex(uint rowIndex, uint columnIndex, int byteLength, byte[] inByteArray) {
  236. bool ret = RakNetPINVOKE.Table_UpdateCellByIndex__SWIG_2(swigCPtr, rowIndex, columnIndex, byteLength, inByteArray);
  237. return ret;
  238. }
  239. private uint ColumnIndexHelper(string columnName) {
  240. uint ret = RakNetPINVOKE.Table_ColumnIndexHelper(swigCPtr, columnName);
  241. return ret;
  242. }
  243. public enum ColumnType {
  244. NUMERIC,
  245. STRING,
  246. BINARY,
  247. POINTER
  248. }
  249. public enum FilterQueryType {
  250. QF_EQUAL,
  251. QF_NOT_EQUAL,
  252. QF_GREATER_THAN,
  253. QF_GREATER_THAN_EQ,
  254. QF_LESS_THAN,
  255. QF_LESS_THAN_EQ,
  256. QF_IS_EMPTY,
  257. QF_NOT_EMPTY
  258. }
  259. public enum SortQueryType {
  260. QS_INCREASING_ORDER,
  261. QS_DECREASING_ORDER
  262. }
  263. }
  264. }
粤ICP备19079148号