00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __DAE_META_ELEMENT_ATTRIBUTE_H__
00010 #define __DAE_META_ELEMENT_ATTRIBUTE_H__
00011
00012 #include <dae/daeTypes.h>
00013 #include <dae/daeMetaAttribute.h>
00014 #include <dae/daeMetaCMPolicy.h>
00015
00016 class daeMetaElement;
00017 class daeElement;
00018 class daeDocument;
00019
00023 class daeMetaElementAttribute : public daeMetaAttribute, public daeMetaCMPolicy
00024 {
00025 public:
00027 daeMetaElement* _elementType;
00028
00029 public:
00039 daeMetaElementAttribute( daeMetaElement *container, daeMetaCMPolicy *parent = NULL, daeUInt ordinal = 0, daeInt minO = 1, daeInt maxO = 1);
00043 virtual ~daeMetaElementAttribute();
00044
00045 public:
00046
00047 virtual daeElement *placeElement(daeElement* parent, daeElement* child, daeUInt &ordinal, daeInt offset = 0, daeElement* before = NULL, daeElement *after = NULL);
00048 virtual daeBool removeElement(daeElement* parent, daeElement* child);
00049
00050 daeMetaElement *findChild( daeString elementName );
00051
00052 virtual void getChildren( daeElement* parent, daeElementRefArray &array );
00053
00054 public:
00059 void setElementType(daeMetaElement *elementType) {
00060 _elementType = elementType; }
00061
00066 daeMetaElement* getElementType() { return _elementType; }
00067
00073 virtual void setDocument(daeElement *parent, daeDocument* c );
00074 inline void setCollection(daeElement *parent, daeDocument* c ) {
00075 setDocument( parent, c );
00076 }
00077
00084 virtual daeInt getCount(daeElement* e);
00085
00093 virtual daeMemoryRef get(daeElement* e, daeInt index);
00094
00101 virtual void set(daeElement* element, daeString s);
00107 virtual void copy(daeElement* toElement, daeElement* fromElement);
00108
00113 virtual daeBool isArrayAttribute() { return false; }
00114 };
00115 typedef daeSmartRef<daeMetaElementAttribute> daeMetaElementAttributeRef;
00116 typedef daeTArray<daeMetaElementAttributeRef> daeMetaElementAttributeArray;
00117
00118
00123 class daeMetaElementArrayAttribute : public daeMetaElementAttribute
00124 {
00125 public:
00135 daeMetaElementArrayAttribute(daeMetaElement *container, daeMetaCMPolicy *parent = NULL, daeUInt ordinal = 0, daeInt minO = 1, daeInt maxO = 1);
00136 ~daeMetaElementArrayAttribute();
00137 public:
00138 virtual daeElement *placeElement(daeElement* parent, daeElement* child, daeUInt &ordinal, daeInt offset = 0, daeElement* before = NULL, daeElement *after = NULL);
00139 virtual daeBool removeElement(daeElement* parent, daeElement* child);
00140
00141 void getChildren( daeElement* parent, daeElementRefArray &array );
00142
00147 virtual void setDocument(daeElement *parent, daeDocument* c );
00148 inline void setCollection(daeElement *parent, daeDocument* c ) {
00149 setDocument( parent, c );
00150 }
00151
00158 virtual daeInt getCount(daeElement* e);
00166 virtual daeMemoryRef get(daeElement* e, daeInt index);
00172 virtual void copy(daeElement* toElement, daeElement* fromElement);
00173
00178 virtual daeBool isArrayAttribute() { return true; }
00179 };
00180 typedef daeSmartRef<daeMetaElementArrayAttribute> daeMetaElementArrayAttributeRef;
00181 typedef daeTArray<daeMetaElementArrayAttributeRef> daeMetaElementArrayAttributeArray;
00182
00183 #endif
00184