00001
00002
00003
00004 #ifndef NAMED_REF_H
00005 #define NAMED_REF_H
00006
00007
00008
00009
00010 #ifdef DO_IMPLEMENT_NAMEDREF
00011 #define DO_IMPLEMENTING // If app has not defined it already
00012 #endif
00013 #include "dynobj/DynObj.h"
00014
00015
00016 #define NAMEDREF_TYPE_ID 0xA99E9000
00017
00018
00019 class NamedRef;
00020
00021
00022 DO_DECL_TYPE_INFO(NamedRef,NAMEDREF_TYPE_ID);
00023
00024
00025
00026
00027
00028 #include "DoBaseI.h"
00029
00030 #include "DynObjPtr.hpp"
00031 #include "utils/StringBuffer.h"
00032
00033 template<class T>
00034 struct DynObjHolder;
00035
00036
00037
00038
00039
00040 class NamedRef : public NamedRefI {
00041 public:
00042 ~NamedRef();
00043
00044 virtual DynObjType* docall doGetType( const DynI **pself=0 ) const;
00045
00046 virtual DynI* docall GetByName( const char *name, int type_id=0 );
00047 virtual DynI* docall GetByIndex( int index, DynStr &ds, int type_id=0 );
00048 virtual bool docall Set( const char *name, DynI* pdi );
00049 virtual bool docall Remove( DynI* pdi );
00050
00051 protected:
00052
00053 ExpArrP<DynObjPtr<DynI>*> m_refs;
00054 StrBuf m_names;
00055 };
00056
00057
00058
00059
00060 #ifdef DO_IMPLEMENT_NAMEDREF
00061
00062
00063 DynObjTypeI2R<NamedRef,NamedRefI,false> g_do_vtype_NamedRef("NamedRef:NamedRefI",NAMEDREF_TYPE_ID,0,__FILE__);
00064 DynObjType* NamedRef::doGetType( const DynI **pself ) const {
00065 if(pself) *pself=(const DynI*)(const void*)this;
00066 return &g_do_vtype_NamedRef;
00067 }
00068 #endif //DO_IMPLEMENT_...
00069
00070
00071 #endif // NAMED_REF_H
00072
00073