The classes used in storing type information in the TypeAccess system
are all defined in the `ta/typea.h' header file. Basically, there
are a set of Space objects, which all derive from a basic form of
the List
object (defined in `ta/ta_list.h', which represent
type spaces, member spaces, method spaces, etc. These are just
containers of objects. The spaces are: TypeSpace, MemberSpace,
MethodSpace, EnumSpace, TokenSpace. Note that they contain
functions for finding, printing, and generally manipulating the objects
they contain.
There are corresponding TypeDef, MemberDef, MethodDef, and EnumDef objects which hold specific information about the corresponding aspect of type information. The TypeDef contains the following fields:
String name
String desc
uint size
int ptr
bool ref
bool internal
bool formal
TA_class
and
TA_template
which are are formal parents (par_formal
) of
types that users declare. These provide a way of determining some basic
features of the type. Formal type objects are declared and installed
automatically by the type scanning system.
bool pre_parsed
String_PArray inh_opts
##
instead of a #
).
String_PArray opts
String_PArray lists
#LIST_xxx
values declared for this type.
TypeSpace parents
class
types, and for internal
types
which are the combination of basic types, such as unsigned long
,
etc.
int_PArray par_off
parents
entries.
TypeSpace par_formal
TA_class
, etc.
TypeSpace par_cache
TA_taBase
shows up here
(because a lot of the TypeAccess code checks if something is derived
from the basic type-aware type taBase).
TypeSpace children
void** instance
GetInstance
function should be used to get the actual
instance pointer.
TokenSpace tokens
TAI_xxx
instance object is not
registered here). These are not kept if the type does not record tokens
(see the #NO_TOKENS
comment directive, section 6.3.1 Object Directives).
taivType* iv
taivEdit* ive
iv
pointer, except it is the object which is
used to generate the entire edit dialog for this object. It also
is the result of a bidding procedure.
taBase_Group* defaults
EnumSpace enum_vals
enum
declaration.
TypeSpace sub_types
typedef
, enum
, or
as part of a template instantiation within a class
object.
MemberSpace members
class
object.
MethodSpace methods
class
object.
TypeSpace templ_pars
template
itself, they are the formal parameters (i.e., T
),
but in the template instance they point to the actual types with which
the template was instantiated.
The most important functions on the TypeDef object are as follows:
bool HasOption(const char* op)
#
) is present on this type.
String OptionAfter(const char* op)
#MENU_ON_xxx
to obtain
the xxx part. If option is not present, an empty string is returned.
InheritsFrom(TypeDef* tp)
DerivesFrom(TypeDef* tp)
String GetValStr(void* base, void* par=NULL, MemberDef* memb_def=NULL)
base
is a pointer to
the start of a token of this type, and par
and member_def
can be passed if it is known that this token is in a parent class at a
particular member def. This and the following function are used widely,
including for saving and loading of objects, etc.
SetValStr(const char* val, void* base, void* par=NULL, MemberDef* memb_def=NULL)
GetValStr
).
CopyFromSameType(void* trg_base, void* src_base, MemberDef* memb_def=NULL)
Dump_Save(ostream& strm, void* base, void* par=NULL, int indent=0)
Dump_Load(istream& strm, void* base, void* par=NULL)
Dump_Save
command.
The other Def objects are fairly straightforward. Each includes a
name
and desc
field, and a list of opts
(comment
directives) and lists
. Also, each contains an iv
field
which represents the item in the GUI edit dialog, and is the result of a
bidding process (see the iv
field in the TypeDef object
above). They all have the HasOption
and OptionAfter
functions plus a number of other useful functions (see the
`ta/typea.h' for details).
MemberDef objects contain the following additional fields. Note that derived classes contain links (not copies) of the members and methods they inherit from their parent, except when the class has multiple parents, in which case copies are made for the derived class because the offset information will no longer be the same for the derived class.
TypeDef* type
ta_memb_ptr off
int base_off
bool is_static
static
. Thus, it can be
accessed without a this
pointer. The addr
field contains
its absolute address.
void* addr
bool fun_ptr
The MethodDef object contains the following additional variables:
TypeDef* type
bool is_static
static
.
ta_void_fun addr
static
method. Non-static methods do
not have their addresses recorded. Methods are called via the
stubp
function, if the -css
option was used during
scanning.
int fun_overld
int fun_argc
int fun_argd
fun_argd
to fun_argc
.
TypeSpace arg_types
String_PArray arg_names
css_fun_stub_ptr stubp
-css
argument is given to
`maketa'. The cssEl objects have conversion functions for most
types of arguments, so that the function is called by casting the
arguments into the types expected by the function. Pointers to class
objects are handled by cssTA
objects which have a pointer and a
corresponding TypeDef
pointer, so they know what kind of object
they point to, making conversion type-safe. These stubs return a cssEl
object. They also take a void*
for the this
object.
These stubs are used both by CSS and to call methods from the edit
dialogs from menus and buttons.