GME  13
MgaMetaPart.h
Go to the documentation of this file.
00001 
00002 #ifndef MGA_MGAMETAPART_H
00003 #define MGA_MGAMETAPART_H
00004 
00005 #ifndef MGA_MGAMETABASE_H
00006 #include "MgaMetaBase.h"
00007 #endif
00008 
00009 // --------------------------- CMgaMetaPart
00010 
00011 class ATL_NO_VTABLE CMgaMetaPart : 
00012         public CComObjectRootEx<CComSingleThreadModel>,
00013         public CComCoClass<CMgaMetaPart, &__uuidof(MgaMetaPart)>,
00014         public IDispatchImpl<IMgaMetaPart, &__uuidof(IMgaMetaPart), &__uuidof(__MGAMetaLib)>,
00015         public CMgaMetaBase
00016 {
00017 public:
00018         IUnknown *GetUnknown() const { return (IMgaMetaPart*)this; }
00019 
00020 DECLARE_REGISTRY_RESOURCEID(IDR_MGAMETAPART)
00021 DECLARE_ONLY_AGGREGATABLE(CMgaMetaPart)
00022 
00023 BEGIN_COM_MAP(CMgaMetaPart)
00024         COM_INTERFACE_ENTRY(IMgaMetaPart)
00025         COM_INTERFACE_ENTRY2(IMgaMetaBase, CMgaMetaBase)
00026         COM_INTERFACE_ENTRY2(IDispatch, IMgaMetaPart)
00027 END_COM_MAP()
00028 
00029 DECLARE_MGAMETAREGNODES()
00030 
00031 public:
00032         STDMETHOD(get_Role)(IMgaMetaRole **p)
00033         { return ComGetPointerValue(GetUnknown(), ATTRID_PARTROLE_PTR, p); }
00034 
00035         STDMETHOD(get_ParentAspect)(IMgaMetaAspect **p) 
00036         { return ComGetPointerValue(GetUnknown(), ATTRID_PARTASPECT_PTR, p); }
00037 
00038         STDMETHOD(get_IsPrimary)(VARIANT_BOOL *p);
00039         STDMETHOD(get_IsLinked)(VARIANT_BOOL *p);
00040 
00041         STDMETHOD(get_KindAspect)(BSTR *p)
00042         { return ComGetAttrValue(GetUnknown(), ATTRID_KINDASPECT, p); }
00043 
00044 // ------- Base
00045 
00046 public:
00047         STDMETHOD(get_MetaRef)(metaref_type *p)
00048         {
00049                 CHECK_OUT(p);
00050                 *p = metaref;
00051                 return S_OK;
00052         }
00053         STDMETHOD(put_MetaRef)(metaref_type p) 
00054         { HRESULT hr = PutMetaRef_(p); 
00055                 if(hr == S_OK) hr = ComPutAttrValue(GetUnknown(), ATTRID_METAREF, p); 
00056                 return hr; 
00057         } 
00058 
00059         STDMETHOD(get_MetaProject)(IMgaMetaProject **p) 
00060         {
00061                 CHECK_OUT(p);
00062                 CopyTo(metaproject, p);
00063                 return S_OK;
00064         }
00065 
00066         STDMETHOD(get_Name)(BSTR *p)
00067         { /*return E_NOTIMPL;*/
00068                 HRESULT hr;
00069                 CHECK_OUT(p);
00070                 CComPtr<IMgaMetaRole> pRole;
00071                 hr = ((IMgaMetaPart *) this)->get_Role(&pRole);
00072                 if (SUCCEEDED(hr)) {
00073                         hr = pRole->get_Name(p);
00074                 }
00075                 return hr;
00076         }
00077 
00078         STDMETHOD(put_Name)(BSTR p)
00079         { return E_NOTIMPL; }
00080 
00081         STDMETHOD(get_DisplayedName)(BSTR *p)
00082         { return E_NOTIMPL; }
00083 
00084         STDMETHOD(put_DisplayedName)(BSTR p)
00085         { return E_NOTIMPL; }
00086 
00087         STDMETHOD(get_ObjType)(objtype_enum *p)
00088         { return ComGetObjType(GetUnknown(), p); }
00089 
00090         STDMETHOD(get_Constraints)(IMgaMetaConstraints **p) 
00091         { return E_NOTIMPL; }
00092 
00093         STDMETHOD(CreateConstraint)(IMgaMetaConstraint **p) 
00094         { return E_NOTIMPL; }
00095 
00096         STDMETHOD(Delete)()
00097         { return ComDeleteObject(GetUnknown()); }
00098 
00099 // ------- Edit
00100 
00101 public:
00102         STDMETHOD(put_IsPrimary)(VARIANT_BOOL p);
00103         STDMETHOD(put_IsLinked)(VARIANT_BOOL p);
00104 
00105         STDMETHOD(put_KindAspect)(BSTR p)
00106         { return ComPutAttrValue(GetUnknown(), ATTRID_KINDASPECT, p); }
00107 
00108 // ------- Traverse
00109 
00110 public:
00111         static void Traverse(CMgaMetaProject *metaproject, CCoreObjectPtr &me);
00112 
00113 };
00114 
00115 #endif//MGA_MGAMETAPART_H