|
@@ -24,17 +24,17 @@ package haxe;
|
|
|
|
|
|
extern class EnumTools {
|
|
|
/**
|
|
|
- Returns the name of enum [e], including its path.
|
|
|
+ Returns the name of enum `e`, including its path.
|
|
|
|
|
|
- If [e] is inside a package, the package structure is returned dot-
|
|
|
+ If `e` is inside a package, the package structure is returned dot-
|
|
|
separated, with another dot separating the enum name:
|
|
|
pack1.pack2.(...).packN.EnumName
|
|
|
- If [e] is a sub-type of a haxe module, that module is not part of the
|
|
|
+ If `e` is a sub-type of a haxe module, that module is not part of the
|
|
|
package structure.
|
|
|
|
|
|
- If [e] has no package, the enum name is returned.
|
|
|
+ If `e` has no package, the enum name is returned.
|
|
|
|
|
|
- If [e] is null, the result is unspecified.
|
|
|
+ If `e` is null, the result is unspecified.
|
|
|
|
|
|
The enum name does not include any type parameters.
|
|
|
**/
|
|
@@ -43,11 +43,11 @@ extern class EnumTools {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- Creates an instance of enum [e] by calling its constructor [constr] with
|
|
|
- arguments [params].
|
|
|
+ Creates an instance of enum `e` by calling its constructor `constr` with
|
|
|
+ arguments `params`.
|
|
|
|
|
|
- If [e] or [constr] is null, or if enum [e] has no constructor named
|
|
|
- [constr], or if the number of elements in [params] does not match the
|
|
|
+ If `e` or `constr` is null, or if enum `e` has no constructor named
|
|
|
+ `constr`, or if the number of elements in `params` does not match the
|
|
|
expected number of constructor arguments, or if any argument has an
|
|
|
invalid type, the result is unspecified.
|
|
|
**/
|
|
@@ -56,14 +56,14 @@ extern class EnumTools {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- Creates an instance of enum [e] by calling its constructor number
|
|
|
- [index] with arguments [params].
|
|
|
+ Creates an instance of enum `e` by calling its constructor number
|
|
|
+ `index` with arguments `params`.
|
|
|
|
|
|
The constructor indices are preserved from haxe syntax, so the first
|
|
|
declared is index 0, the next index 1 etc.
|
|
|
|
|
|
- If [e] or [constr] is null, or if enum [e] has no constructor named
|
|
|
- [constr], or if the number of elements in [params] does not match the
|
|
|
+ If `e` or `constr` is null, or if enum `e` has no constructor named
|
|
|
+ `constr`, or if the number of elements in `params` does not match the
|
|
|
expected number of constructor arguments, or if any argument has an
|
|
|
invalid type, the result is unspecified.
|
|
|
**/
|
|
@@ -72,29 +72,29 @@ extern class EnumTools {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- Returns a list of all constructors of enum [e] that require no
|
|
|
+ Returns a list of all constructors of enum `e` that require no
|
|
|
arguments.
|
|
|
|
|
|
- This may return the empty Array [] if all constructors of [e] require
|
|
|
+ This may return the empty Array [] if all constructors of `e` require
|
|
|
arguments.
|
|
|
|
|
|
- Otherwise an instance of [e] constructed through each of its non-
|
|
|
+ Otherwise an instance of `e` constructed through each of its non-
|
|
|
argument constructors is returned, in the order of the constructor
|
|
|
declaration.
|
|
|
|
|
|
- If [e] is null, the result is unspecified.
|
|
|
+ If `e` is null, the result is unspecified.
|
|
|
**/
|
|
|
static public inline function createAll<T>(e:Enum<T>):Array<T> {
|
|
|
return Type.allEnums(e);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- Returns a list of the names of all constructors of enum [e].
|
|
|
+ Returns a list of the names of all constructors of enum `e`.
|
|
|
|
|
|
The order of the constructor names in the returned Array is preserved
|
|
|
from the original syntax.
|
|
|
|
|
|
- If [c] is null, the result is unspecified.
|
|
|
+ If `c` is null, the result is unspecified.
|
|
|
**/
|
|
|
static public inline function getConstructors<T>(e:Enum<T>):Array<String> {
|
|
|
return Type.getEnumConstructs(e);
|
|
@@ -104,49 +104,49 @@ extern class EnumTools {
|
|
|
extern class EnumValueTools {
|
|
|
|
|
|
/**
|
|
|
- Recursively compares two enum instances [a] and [b] by value.
|
|
|
+ Recursively compares two enum instances `a` and `b` by value.
|
|
|
|
|
|
- Unlike [a] == [b], this function performs a deep equality check on the
|
|
|
+ Unlike `a == b`, this function performs a deep equality check on the
|
|
|
arguments of the constructors, if exists.
|
|
|
|
|
|
- If [a] or [b] are null, the result is unspecified.
|
|
|
+ If `a` or `b` are null, the result is unspecified.
|
|
|
**/
|
|
|
static public inline function equals<T:EnumValue>(a:T, b:T):Bool {
|
|
|
return Type.enumEq(a, b);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- Returns the constructor name of enum instance [e].
|
|
|
+ Returns the constructor name of enum instance `e`.
|
|
|
|
|
|
The result String does not contain any constructor arguments.
|
|
|
|
|
|
- If [e] is null, the result is unspecified.
|
|
|
+ If `e` is null, the result is unspecified.
|
|
|
**/
|
|
|
static public inline function getName(e:EnumValue):String {
|
|
|
return Type.enumConstructor(e);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- Returns a list of the constructor arguments of enum instance [e].
|
|
|
+ Returns a list of the constructor arguments of enum instance `e`.
|
|
|
|
|
|
- If [e] has no arguments, the result is [].
|
|
|
+ If `e` has no arguments, the result is [].
|
|
|
|
|
|
- Otherwise the result are the values that were used as arguments to [e],
|
|
|
+ Otherwise the result are the values that were used as arguments to `e`,
|
|
|
in the order of their declaration.
|
|
|
|
|
|
- If [e] is null, the result is unspecified.
|
|
|
+ If `e` is null, the result is unspecified.
|
|
|
**/
|
|
|
static public inline function getParameters(e:EnumValue):Array<Dynamic> {
|
|
|
return Type.enumParameters(e);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- Returns the index of enum instance [e].
|
|
|
+ Returns the index of enum instance `e`.
|
|
|
|
|
|
- This corresponds to the original syntactic position of [e]. The index of
|
|
|
+ This corresponds to the original syntactic position of `e`. The index of
|
|
|
the first declared constructor is 0, the next one is 1 etc.
|
|
|
|
|
|
- If [e] is null, the result is unspecified.
|
|
|
+ If `e` is null, the result is unspecified.
|
|
|
**/
|
|
|
static public inline function getIndex(e:EnumValue):Int {
|
|
|
return Type.enumIndex(e);
|