StdTypes.hx 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * Copyright (C)2005-2012 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. // standard haXe types
  23. /**
  24. The standard Void type. Only [null] values can be of the type [Void].
  25. **/
  26. abstract Void { }
  27. /**
  28. The standard Float type, this is a double-precision IEEE 64bit float.
  29. **/
  30. @:notNull @:runtimeValue abstract Float { }
  31. /**
  32. The standard Int type. Its precision depends on the platform.
  33. **/
  34. @:notNull @:runtimeValue abstract Int <= Float { }
  35. #if (flash9 || flash9doc || cs)
  36. /**
  37. The unsigned Int type is only defined for Flash9. It's currently
  38. handled the same as a normal Int.
  39. **/
  40. @:notNull @:runtimeValue abstract UInt => Int, <= Int { }
  41. #end
  42. #if (java || cs)
  43. @:notNull @:runtimeValue abstract Single => Float, <= Float {}
  44. #end
  45. /**
  46. [Null] can be useful in two cases. In order to document some methods
  47. that accepts or can return a [null] value, or for the Flash9 compiler and AS3
  48. generator to distinguish between base values that can be null and others that
  49. can't.
  50. **/
  51. typedef Null<T> = T
  52. /**
  53. The standard Boolean type is represented as an enum with two choices.
  54. **/
  55. @:notNull @:runtimeValue abstract Bool {
  56. }
  57. /**
  58. Dynamic is an internal compiler type which has special behavior.
  59. See the haXe language reference for more informations.
  60. **/
  61. @:runtimeValue abstract Dynamic<T> {
  62. }
  63. /**
  64. An Iterator is a structure that permits to list a given container
  65. values. It can be used by your own data structures. See the haXe
  66. documentation for more informations.
  67. **/
  68. typedef Iterator<T> = {
  69. function hasNext() : Bool;
  70. function next() : T;
  71. }
  72. /**
  73. An Iterable is a data structure which has an iterator() method.
  74. See [Lambda] for generic functions on iterable structures.
  75. **/
  76. typedef Iterable<T> = {
  77. function iterator() : Iterator<T>;
  78. }
  79. /**
  80. ArrayAccess is used to indicate a class that can be accessed using brackets.
  81. The type parameter represent the type of the elements stored.
  82. **/
  83. extern interface ArrayAccess<T> { }