#include <cstruct.h>
Inheritance diagram for cStructDescriptor::
Public Types | |
enum | { FT_BASIC, FT_SPECIAL, FT_STRUCT, FT_BASIC_ARRAY, FT_SPECIAL_ARRAY, FT_STRUCT_ARRAY, FT_INVALID } |
Field types. More... | |
Public Methods | |
Constructors, destructor, assignment. | |
cStructDescriptor (void *_p=NULL) | |
cStructDescriptor (const cStructDescriptor &cs) | |
virtual | ~cStructDescriptor () |
cStructDescriptor& | operator= (const cStructDescriptor &) |
Getting and setting client object. | |
void | setStruct (void *_p) |
void* | getStruct () const |
Querying and setting fields of the client object. | |
virtual int | getFieldCount ()=0 |
virtual const char* | getFieldName (int field)=0 |
virtual int | getFieldType (int field)=0 |
virtual const char* | getFieldTypeString (int field)=0 |
virtual const char* | getFieldEnumName (int field)=0 |
virtual int | getArraySize (int field)=0 |
virtual bool | getFieldAsString (int field, int i, char *buf, int bufsize)=0 |
virtual bool | setFieldAsString (int field, int i, const char *value)=0 |
virtual sFieldWrapper* | getFieldWrapper (int field, int i)=0 |
virtual const char* | getFieldStructName (int field)=0 |
virtual void* | getFieldStructPointer (int field, int i)=0 |
Static Public Methods | |
Getting descriptor for an object or a struct. | |
bool | hasDescriptor (const char *classname) |
cStructDescriptor* | createDescriptorFor (cObject *obj) |
cStructDescriptor* | createDescriptorFor (const char *classname, void *p) |
FIXME: explain client object, fieldwrapper, etc.
The copy constructor, dup() and the assignment operator are redefined to raise an error (throw cException), since they would be of no use in subclasses.
|
|
Constructor. The argument is the client object. |
|
Copy constructor. |
|
Destructor. |
|
Creates and returns a descriptor object for the struct passed as argument. The type of the descriptor object will be determined from the 1st argument, classname. The passed struct will be the client object for the descriptor object. |
|
Creates and returns a descriptor object for the object passed as argument. The type of the descriptor object will be determined from the className() of 'obj'. 'obj' will be the client object for the descriptor object. |
|
Must be redefined in subclasses to return the array size of a field in the client object. If the field is not an array, it should return 0. |
|
Must be redefined in subclasses to return the value of a basic field (of type FT_BASIC(_ARRAY)) in the client object as a string. Returns true if no error occurred, false otherwise. FIXME: what if called for non-basic fields? |
|
Must be redefined in subclasses to return the number of fields in the client object. |
|
Returns the enum name associated with the field. This makes only sense with integer-type fields (short, int, long, etc.). Returns NULL if there's no associated enum.
|
|
Must be redefined in subclasses to return the name of a field in the client object. The argument must be in the 0..getFieldCount()-1 range, inclusive. |
|
Must be redefined in subclasses to return the type name of an FT_STRUCT(_ARRAY) field in the client object. The return value may be used then as classname to create a descriptor object for this structure field. |
|
Must be redefined in subclasses to return the pointer of an FT_STRUCT(_ARRAY) field in the client object. The return value may be used then as client object pointer to create a descriptor object for this structure field. |
|
Must be redefined in subclasses to return the type of a field in the client object. The argument must be in the 0..getFieldCount()-1 range, inclusive. FIXME: type constants! |
|
Must be redefined in subclasses to return the type of a field in the client object as a string. The argument must be in the 0..getFieldCount()-1 range, inclusive. |
|
Must be redefined in subclasses to return a wrapper for an FT_SPECIAL(_ARRAY) field in the client object. There's no corresponding setFieldWrapper() method -- setting the field value should can take place via the wrapper object returned here. * Returns NULL if no associated wrapper is defined for this field. |
|
Returns client object. |
|
Returns true if the class 'classname' has an associated cStructDescriptor object. |
|
Assignment is not supported by this class: this method throws a cException when called. |
|
Must be redefined in subclasses to set the value of a basic field (of type FT_BASIC(_ARRAY)) in the client object as a string. Returns true if no error occurred, false otherwise. FIXME: what if called for non-basic fields? |
|
Sets client object. |