StdTypes.hx 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Copyright (c) 2005, The haXe Project Contributors
  3. * All rights reserved.
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are met:
  6. *
  7. * - Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * - Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. *
  13. * THIS SOFTWARE IS PROVIDED BY THE HAXE PROJECT CONTRIBUTORS "AS IS" AND ANY
  14. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  15. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  16. * DISCLAIMED. IN NO EVENT SHALL THE HAXE PROJECT CONTRIBUTORS BE LIABLE FOR
  17. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  18. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  19. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  20. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  21. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  22. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  23. * DAMAGE.
  24. */
  25. // standard haXe types
  26. /**
  27. The standard Void type. Only [null] values can be of the type [Void].
  28. **/
  29. extern enum Void { }
  30. /**
  31. The standard Float type, this is a double-precision IEEE 64bit float.
  32. **/
  33. extern class Float { }
  34. /**
  35. The standard Int type. Its precision depends on the platform.
  36. **/
  37. extern class Int extends Float { }
  38. #if (flash9 || flash9doc)
  39. /**
  40. The unsigned Int type is only defined for Flash9. It's currently
  41. handled the same as a normal Int.
  42. **/
  43. typedef UInt = Int
  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. extern enum Bool {
  56. true;
  57. false;
  58. }
  59. /**
  60. Dynamic is an internal compiler type which has special behavior.
  61. See the haXe language reference for more informations.
  62. **/
  63. extern class Dynamic<T> {
  64. }
  65. /**
  66. An Iterator is a structure that permits to list a given container
  67. values. It can be used by your own data structures. See the haXe
  68. documentation for more informations.
  69. **/
  70. typedef Iterator<T> = {
  71. function hasNext() : Bool;
  72. function next() : T;
  73. }
  74. /**
  75. An Iterable is a data structure which has an iterator() method.
  76. See [Lambda] for generic functions on iterable structures.
  77. **/
  78. typedef Iterable<T> = {
  79. function iterator() : Iterator<T>;
  80. }
  81. /**
  82. ArrayAccess is used to indicate a class that can be accessed using brackets.
  83. The type parameter represent the type of the elements stored.
  84. **/
  85. extern interface ArrayAccess<T> { }