| Xavax C++ Library | Class Index FAQ Overview |
| Method Summary | |
const char*
|
name() const
Returns the member name. |
size_t
|
offset() const
Returns the member offset. |
size_t
|
size() const
Returns the member size. |
Type
|
type() const
Returns the basic type of the member. |
const TypeDescriptor*
|
typeDescriptor() const
Return the type descriptor for this member. |
const char*
|
typeName() const
Returns the basic type name of the member. |
| Macro Summary | |
CxArrayMemberDefine a member descriptor for an array member. |
|
CxFunctionMemberDefine a member descriptor for a function member. |
|
CxPointerMemberDefine a member descriptor for a pointer member. |
|
CxSimpleMemberDefine a member descriptor for a simple member. |
|
| Related Classes | |
| Class, Type, TypeDescriptor, TypeQualifier. | |
| Method Detail |
const char* name() const
size_t offset() const
size_t size() const
Type type() const
Type).
For example, if a member is defined as "char *cp[]",
then the value tn::Char would be specified in the descriptor
since the basic type of cp is char.
const TypeDescriptor*typeDescriptor() const
const char* typeName() const
| Macro Detail |
CxArrayMember(T, type, member)
T - the name of the type or class
that contains the member.type - the basic type of the member.member - the member name.{ tn::##type, tq::Array, sizeof(T::member), CxOffsetOf(T,member), _STR(member), 0 }CxFunctionMember(T, type, member)
T - the name of the type or class
that contains the member.type - the basic type of the member.member - the member name.{ tn::##type, tq::Function, sizeof(T::member), CxOffsetOf(T,member), _STR(member), 0 }CxPointerMember(T, type, member)
T - the name of the type or class
that contains the member.type - the basic type of the member.member - the member name.{ tn::##type, tq::Pointer, sizeof(T::member), CxOffsetOf(T,member), _STR(member), 0 }CxSimpleMember(T, type, member)
T - the name of the type or class
that contains the member.type - the basic type of the member.member - the member name.{ tn::##type, tq::None, sizeof(T::member), CxOffsetOf(T,member), _STR(member), 0 }
| Example Code |
#include Object_h
//
// An example class with one simple member and
// two pointer members.
//
class Exception : public Object {
public:
Exception(const char* filename, int line, const char* reason)
: _filename(filename), _line(line), _reason(reason) {}
// ...other methods...
private:
int _line;
const char* _filename;
const char* _reason;
CxStandardMethods(Exception);
}
//
// Metadata for the Exception class consisting of an
// array of member descriptors and a class record.
//
const MemberDescriptor Exception::_members[] = {
CxSimpleMember(Exception,Int,_line),
CxPointerMember(Exception,Char,_filename),
CxPointerMember(Exception,Char,_reason)
};
CxDefineClass(Exception, Object, 0);
Copyright © 2003 Xavax Inc. -- All Rights Reserved