UrhoString.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // UrhoString.cs
  6. //
  7. // Copyright 2015 Xamarin Inc. All rights reserved.
  8. using System;
  9. using System.Runtime.InteropServices;
  10. using System.Collections.Generic;
  11. using Urho.Urho2D;
  12. using Urho.Gui;
  13. using Urho.Resources;
  14. using Urho.IO;
  15. using Urho.Navigation;
  16. using Urho.Network;
  17. namespace Urho
  18. {
  19. /// <summary>
  20. /// %String class.
  21. /// </summary>
  22. public unsafe partial class UrhoString
  23. {
  24. unsafe partial void OnUrhoStringCreated ();
  25. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  26. internal static extern IntPtr UrhoString_String ();
  27. [Preserve]
  28. public UrhoString ()
  29. {
  30. Runtime.Validate (typeof(UrhoString));
  31. handle = UrhoString_String ();
  32. OnUrhoStringCreated ();
  33. }
  34. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  35. internal static extern IntPtr UrhoString_String0 (string str);
  36. [Preserve]
  37. public UrhoString (string str)
  38. {
  39. Runtime.Validate (typeof(UrhoString));
  40. handle = UrhoString_String0 (str);
  41. OnUrhoStringCreated ();
  42. }
  43. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  44. internal static extern IntPtr UrhoString_String1 (int value);
  45. [Preserve]
  46. public UrhoString (int value)
  47. {
  48. Runtime.Validate (typeof(UrhoString));
  49. handle = UrhoString_String1 (value);
  50. OnUrhoStringCreated ();
  51. }
  52. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  53. internal static extern IntPtr UrhoString_String2 (short value);
  54. [Preserve]
  55. public UrhoString (short value)
  56. {
  57. Runtime.Validate (typeof(UrhoString));
  58. handle = UrhoString_String2 (value);
  59. OnUrhoStringCreated ();
  60. }
  61. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  62. internal static extern IntPtr UrhoString_String3 (System.nint value);
  63. [Preserve]
  64. public UrhoString (System.nint value)
  65. {
  66. Runtime.Validate (typeof(UrhoString));
  67. handle = UrhoString_String3 (value);
  68. OnUrhoStringCreated ();
  69. }
  70. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  71. internal static extern IntPtr UrhoString_String4 (long value);
  72. [Preserve]
  73. public UrhoString (long value)
  74. {
  75. Runtime.Validate (typeof(UrhoString));
  76. handle = UrhoString_String4 (value);
  77. OnUrhoStringCreated ();
  78. }
  79. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  80. internal static extern IntPtr UrhoString_String5 (uint value);
  81. [Preserve]
  82. public UrhoString (uint value)
  83. {
  84. Runtime.Validate (typeof(UrhoString));
  85. handle = UrhoString_String5 (value);
  86. OnUrhoStringCreated ();
  87. }
  88. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  89. internal static extern IntPtr UrhoString_String6 (ushort value);
  90. [Preserve]
  91. public UrhoString (ushort value)
  92. {
  93. Runtime.Validate (typeof(UrhoString));
  94. handle = UrhoString_String6 (value);
  95. OnUrhoStringCreated ();
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern IntPtr UrhoString_String7 (System.nuint value);
  99. [Preserve]
  100. public UrhoString (System.nuint value)
  101. {
  102. Runtime.Validate (typeof(UrhoString));
  103. handle = UrhoString_String7 (value);
  104. OnUrhoStringCreated ();
  105. }
  106. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  107. internal static extern IntPtr UrhoString_String8 (ulong value);
  108. [Preserve]
  109. public UrhoString (ulong value)
  110. {
  111. Runtime.Validate (typeof(UrhoString));
  112. handle = UrhoString_String8 (value);
  113. OnUrhoStringCreated ();
  114. }
  115. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  116. internal static extern IntPtr UrhoString_String9 (float value);
  117. [Preserve]
  118. public UrhoString (float value)
  119. {
  120. Runtime.Validate (typeof(UrhoString));
  121. handle = UrhoString_String9 (value);
  122. OnUrhoStringCreated ();
  123. }
  124. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  125. internal static extern IntPtr UrhoString_String10 (double value);
  126. [Preserve]
  127. public UrhoString (double value)
  128. {
  129. Runtime.Validate (typeof(UrhoString));
  130. handle = UrhoString_String10 (value);
  131. OnUrhoStringCreated ();
  132. }
  133. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  134. internal static extern IntPtr UrhoString_String11 (bool value);
  135. [Preserve]
  136. public UrhoString (bool value)
  137. {
  138. Runtime.Validate (typeof(UrhoString));
  139. handle = UrhoString_String11 (value);
  140. OnUrhoStringCreated ();
  141. }
  142. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  143. internal static extern void UrhoString_Replace (IntPtr handle, string replaceThis, string replaceWith, bool caseSensitive);
  144. /// <summary>
  145. /// Replace all occurrences of a string.
  146. /// </summary>
  147. public void Replace (string replaceThis, string replaceWith, bool caseSensitive = true)
  148. {
  149. Runtime.ValidateObject (this);
  150. UrhoString_Replace (handle, replaceThis, replaceWith, caseSensitive);
  151. }
  152. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  153. internal static extern void UrhoString_Replace12 (IntPtr handle, uint pos, uint length, string replaceWith);
  154. /// <summary>
  155. /// Replace a substring.
  156. /// </summary>
  157. public void Replace (uint pos, uint length, string replaceWith)
  158. {
  159. Runtime.ValidateObject (this);
  160. UrhoString_Replace12 (handle, pos, length, replaceWith);
  161. }
  162. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  163. internal static extern IntPtr UrhoString_Replaced (IntPtr handle, string replaceThis, string replaceWith, bool caseSensitive);
  164. /// <summary>
  165. /// Return a string with all occurrences of a string replaced.
  166. /// </summary>
  167. public string Replaced (string replaceThis, string replaceWith, bool caseSensitive = true)
  168. {
  169. Runtime.ValidateObject (this);
  170. return Marshal.PtrToStringAnsi (UrhoString_Replaced (handle, replaceThis, replaceWith, caseSensitive));
  171. }
  172. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  173. internal static extern void UrhoString_Insert (IntPtr handle, uint pos, string str);
  174. /// <summary>
  175. /// Insert a string.
  176. /// </summary>
  177. public void Insert (uint pos, string str)
  178. {
  179. Runtime.ValidateObject (this);
  180. UrhoString_Insert (handle, pos, str);
  181. }
  182. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  183. internal static extern void UrhoString_Erase (IntPtr handle, uint pos, uint length);
  184. /// <summary>
  185. /// Erase a substring.
  186. /// </summary>
  187. public void Erase (uint pos, uint length = 1)
  188. {
  189. Runtime.ValidateObject (this);
  190. UrhoString_Erase (handle, pos, length);
  191. }
  192. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  193. internal static extern void UrhoString_Resize (IntPtr handle, uint newLength);
  194. /// <summary>
  195. /// Resize the string.
  196. /// </summary>
  197. public void Resize (uint newLength)
  198. {
  199. Runtime.ValidateObject (this);
  200. UrhoString_Resize (handle, newLength);
  201. }
  202. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  203. internal static extern void UrhoString_Reserve (IntPtr handle, uint newCapacity);
  204. /// <summary>
  205. /// Set new capacity.
  206. /// </summary>
  207. public void Reserve (uint newCapacity)
  208. {
  209. Runtime.ValidateObject (this);
  210. UrhoString_Reserve (handle, newCapacity);
  211. }
  212. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  213. internal static extern void UrhoString_Compact (IntPtr handle);
  214. /// <summary>
  215. /// Reallocate so that no extra memory is used.
  216. /// </summary>
  217. public void Compact ()
  218. {
  219. Runtime.ValidateObject (this);
  220. UrhoString_Compact (handle);
  221. }
  222. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  223. internal static extern void UrhoString_Clear (IntPtr handle);
  224. /// <summary>
  225. /// Clear the string.
  226. /// </summary>
  227. public void Clear ()
  228. {
  229. Runtime.ValidateObject (this);
  230. UrhoString_Clear (handle);
  231. }
  232. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  233. internal static extern IntPtr UrhoString_Substring (IntPtr handle, uint pos);
  234. /// <summary>
  235. /// Return a substring from position to end.
  236. /// </summary>
  237. public string Substring (uint pos)
  238. {
  239. Runtime.ValidateObject (this);
  240. return Marshal.PtrToStringAnsi (UrhoString_Substring (handle, pos));
  241. }
  242. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  243. internal static extern IntPtr UrhoString_Substring13 (IntPtr handle, uint pos, uint length);
  244. /// <summary>
  245. /// Return a substring with length from position.
  246. /// </summary>
  247. public string Substring (uint pos, uint length)
  248. {
  249. Runtime.ValidateObject (this);
  250. return Marshal.PtrToStringAnsi (UrhoString_Substring13 (handle, pos, length));
  251. }
  252. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  253. internal static extern IntPtr UrhoString_Trimmed (IntPtr handle);
  254. /// <summary>
  255. /// Return string with whitespace trimmed from the beginning and the end.
  256. /// </summary>
  257. public string Trimmed ()
  258. {
  259. Runtime.ValidateObject (this);
  260. return Marshal.PtrToStringAnsi (UrhoString_Trimmed (handle));
  261. }
  262. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  263. internal static extern IntPtr UrhoString_ToUpper (IntPtr handle);
  264. /// <summary>
  265. /// Return string in uppercase.
  266. /// </summary>
  267. public string ToUpper ()
  268. {
  269. Runtime.ValidateObject (this);
  270. return Marshal.PtrToStringAnsi (UrhoString_ToUpper (handle));
  271. }
  272. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  273. internal static extern IntPtr UrhoString_ToLower (IntPtr handle);
  274. /// <summary>
  275. /// Return string in lowercase.
  276. /// </summary>
  277. public string ToLower ()
  278. {
  279. Runtime.ValidateObject (this);
  280. return Marshal.PtrToStringAnsi (UrhoString_ToLower (handle));
  281. }
  282. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  283. internal static extern uint UrhoString_Find (IntPtr handle, string str, uint startPos, bool caseSensitive);
  284. /// <summary>
  285. /// Return index to the first occurrence of a string, or NPOS if not found.
  286. /// </summary>
  287. public uint Find (string str, uint startPos = 0, bool caseSensitive = true)
  288. {
  289. Runtime.ValidateObject (this);
  290. return UrhoString_Find (handle, str, startPos, caseSensitive);
  291. }
  292. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  293. internal static extern uint UrhoString_FindLast (IntPtr handle, string str, uint startPos, bool caseSensitive);
  294. /// <summary>
  295. /// Return index to the last occurrence of a string, or NPOS if not found.
  296. /// </summary>
  297. public uint FindLast (string str, uint startPos, bool caseSensitive = true)
  298. {
  299. Runtime.ValidateObject (this);
  300. return UrhoString_FindLast (handle, str, startPos, caseSensitive);
  301. }
  302. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  303. internal static extern bool UrhoString_StartsWith (IntPtr handle, string str, bool caseSensitive);
  304. /// <summary>
  305. /// Return whether starts with a string.
  306. /// </summary>
  307. public bool StartsWith (string str, bool caseSensitive = true)
  308. {
  309. Runtime.ValidateObject (this);
  310. return UrhoString_StartsWith (handle, str, caseSensitive);
  311. }
  312. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  313. internal static extern bool UrhoString_EndsWith (IntPtr handle, string str, bool caseSensitive);
  314. /// <summary>
  315. /// Return whether ends with a string.
  316. /// </summary>
  317. public bool EndsWith (string str, bool caseSensitive = true)
  318. {
  319. Runtime.ValidateObject (this);
  320. return UrhoString_EndsWith (handle, str, caseSensitive);
  321. }
  322. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  323. internal static extern uint UrhoString_Length (IntPtr handle);
  324. /// <summary>
  325. /// Return length.
  326. /// </summary>
  327. public uint Length ()
  328. {
  329. Runtime.ValidateObject (this);
  330. return UrhoString_Length (handle);
  331. }
  332. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  333. internal static extern uint UrhoString_Capacity (IntPtr handle);
  334. /// <summary>
  335. /// Return buffer capacity.
  336. /// </summary>
  337. public uint Capacity ()
  338. {
  339. Runtime.ValidateObject (this);
  340. return UrhoString_Capacity (handle);
  341. }
  342. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  343. internal static extern bool UrhoString_Empty (IntPtr handle);
  344. /// <summary>
  345. /// Return whether the string is empty.
  346. /// </summary>
  347. public bool Empty ()
  348. {
  349. Runtime.ValidateObject (this);
  350. return UrhoString_Empty (handle);
  351. }
  352. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  353. internal static extern int UrhoString_Compare (IntPtr handle, string str, bool caseSensitive);
  354. /// <summary>
  355. /// Return comparison result with a string.
  356. /// </summary>
  357. public int Compare (string str, bool caseSensitive = true)
  358. {
  359. Runtime.ValidateObject (this);
  360. return UrhoString_Compare (handle, str, caseSensitive);
  361. }
  362. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  363. internal static extern bool UrhoString_Contains (IntPtr handle, string str, bool caseSensitive);
  364. /// <summary>
  365. /// Return whether contains a specific occurrence of a string.
  366. /// </summary>
  367. public bool Contains (string str, bool caseSensitive = true)
  368. {
  369. Runtime.ValidateObject (this);
  370. return UrhoString_Contains (handle, str, caseSensitive);
  371. }
  372. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  373. internal static extern uint UrhoString_LengthUTF8 (IntPtr handle);
  374. /// <summary>
  375. /// Calculate number of characters in UTF8 content.
  376. /// </summary>
  377. public uint LengthUTF8 ()
  378. {
  379. Runtime.ValidateObject (this);
  380. return UrhoString_LengthUTF8 (handle);
  381. }
  382. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  383. internal static extern uint UrhoString_ByteOffsetUTF8 (IntPtr handle, uint index);
  384. /// <summary>
  385. /// Return byte offset to char in UTF8 content.
  386. /// </summary>
  387. public uint ByteOffsetUTF8 (uint index)
  388. {
  389. Runtime.ValidateObject (this);
  390. return UrhoString_ByteOffsetUTF8 (handle, index);
  391. }
  392. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  393. internal static extern uint UrhoString_AtUTF8 (IntPtr handle, uint index);
  394. /// <summary>
  395. /// Return Unicode character at index from UTF8 content.
  396. /// </summary>
  397. public uint AtUTF8 (uint index)
  398. {
  399. Runtime.ValidateObject (this);
  400. return UrhoString_AtUTF8 (handle, index);
  401. }
  402. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  403. internal static extern void UrhoString_ReplaceUTF8 (IntPtr handle, uint index, uint unicodeChar);
  404. /// <summary>
  405. /// Replace Unicode character at index from UTF8 content.
  406. /// </summary>
  407. public void ReplaceUTF8 (uint index, uint unicodeChar)
  408. {
  409. Runtime.ValidateObject (this);
  410. UrhoString_ReplaceUTF8 (handle, index, unicodeChar);
  411. }
  412. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  413. internal static extern IntPtr UrhoString_SubstringUTF8 (IntPtr handle, uint pos);
  414. /// <summary>
  415. /// Return a UTF8 substring from position to end.
  416. /// </summary>
  417. public string SubstringUTF8 (uint pos)
  418. {
  419. Runtime.ValidateObject (this);
  420. return Marshal.PtrToStringAnsi (UrhoString_SubstringUTF8 (handle, pos));
  421. }
  422. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  423. internal static extern IntPtr UrhoString_SubstringUTF814 (IntPtr handle, uint pos, uint length);
  424. /// <summary>
  425. /// Return a UTF8 substring with length from position.
  426. /// </summary>
  427. public string SubstringUTF8 (uint pos, uint length)
  428. {
  429. Runtime.ValidateObject (this);
  430. return Marshal.PtrToStringAnsi (UrhoString_SubstringUTF814 (handle, pos, length));
  431. }
  432. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  433. internal static extern uint UrhoString_ToHash (IntPtr handle);
  434. /// <summary>
  435. /// Return hash value for HashSet
  436. /// &
  437. /// HashMap.
  438. /// </summary>
  439. public uint ToHash ()
  440. {
  441. Runtime.ValidateObject (this);
  442. return UrhoString_ToHash (handle);
  443. }
  444. }
  445. }