string(Type.enumParameters(ob)) + ???)???);
case TObject:
trace(???Anonymous object???);
default:
trace(???Unsupported type???);
}
}
}
// traces (PosInfos information has been removed):
// Enum Color.RGB([255,200,0])
// Instance of Person
// Anonymous object
// Enum Color.White([])
// Unsupported type
Part III: Extending the Possibilities
470
Runtime Type Information ( RT TI )
The Reflect and Type classes can be formidable to manage instances and methods at run time using
name references, but there is a lot of information that you cannot obtain using those classes; how do you
obtain the arguments of a function and their types? How can you guess the structure of an object defined
using a typedef ? The answer to those questions is just an acronym: RTTI (Runtime Type Information).
The RTTI information is stored in one or more XML documents that can be parsed to use in code. The
XML document is the same one used by the haxedoc tool described in Chapter 6 to generate the code
documentations. Accessing this file at run time gives you a complete overview of all the classes and
types included in the compiled project.
Pages:
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872