GME
13
|
00001 00002 #ifndef MGA_MGAMETAPROJECT_H 00003 #define MGA_MGAMETAPROJECT_H 00004 00005 #include <hash_map> 00006 #include "CommonVersionInfo.h" 00007 00008 class CMgaMetaBase; 00009 00010 // --------------------------- CMgaMetaProject 00011 00012 class ATL_NO_VTABLE CMgaMetaProject : 00013 public CComObjectRootEx<CComSingleThreadModel>, 00014 public CComCoClass<CMgaMetaProject, &__uuidof(MgaMetaProject)>, 00015 public IDispatchImpl<IMgaMetaProject, &__uuidof(IMgaMetaProject), &__uuidof(__MGAMetaLib)>, 00016 public ISupportErrorInfoImpl<&__uuidof(IMgaMetaProject)> 00017 { 00018 public: 00019 CMgaMetaProject(); 00020 ~CMgaMetaProject(); 00021 00022 IUnknown *GetUnknown() const { return (IMgaMetaProject*)this; } 00023 00024 DECLARE_REGISTRY_RESOURCEID(IDR_MGAMETAPROJECT) 00025 00026 BEGIN_COM_MAP(CMgaMetaProject) 00027 COM_INTERFACE_ENTRY(IMgaMetaProject) 00028 COM_INTERFACE_ENTRY2(IDispatch, IMgaMetaProject) 00029 COM_INTERFACE_ENTRY(ISupportErrorInfo) 00030 END_COM_MAP() 00031 00032 // ------- Methods 00033 00034 public: 00035 STDMETHOD(Open)(BSTR connection); 00036 STDMETHOD(Close)(); 00037 STDMETHOD(Create)(BSTR connection); 00038 00039 STDMETHOD(BeginTransaction)(); 00040 STDMETHOD(CommitTransaction)(); 00041 STDMETHOD(AbortTransaction)(); 00042 00043 STDMETHOD(get_GUID)(VARIANT *p); 00044 STDMETHOD(put_GUID)(VARIANT p); 00045 STDMETHOD(get_Name)(BSTR *p); 00046 STDMETHOD(put_Name)(BSTR p); 00047 STDMETHOD(get_DisplayedName)(BSTR *p); 00048 STDMETHOD(put_DisplayedName)(BSTR p); 00049 STDMETHOD(get_Version)(BSTR *p); 00050 STDMETHOD(put_Version)(BSTR p); 00051 STDMETHOD(get_Author)(BSTR *p); 00052 STDMETHOD(put_Author)(BSTR p); 00053 STDMETHOD(get_Comment)(BSTR *p); 00054 STDMETHOD(put_Comment)(BSTR p); 00055 STDMETHOD(get_CreatedAt)(BSTR *p); 00056 STDMETHOD(put_CreatedAt)(BSTR p); 00057 STDMETHOD(get_ModifiedAt)(BSTR *p); 00058 STDMETHOD(put_ModifiedAt)(BSTR p); 00059 00060 STDMETHOD(get_RootFolder)(IMgaMetaFolder **p) 00061 { return ::QueryInterface(rootobject, p); } 00062 00063 STDMETHOD(get_FindObject)(metaref_type metaref, IMgaMetaBase **p); 00064 STDMETHOD(DoFindObjectDisp)(metaref_type metaref, IMgaMetaBase **p) { return get_FindObject( metaref, p); } 00065 00066 STDMETHOD(SetNmspc)(BSTR p); 00067 STDMETHOD(GetNmspc)(BSTR *p); 00068 00069 // ------- metaobj_lookup 00070 00071 public: 00072 typedef stdext::hash_map< metaref_type 00073 , CComPtr<IMgaMetaBase> 00074 , metaid_hashfunc 00075 > metaobj_lookup_type; 00076 typedef metaobj_lookup_type::iterator metaobj_lookup_iterator; 00077 00078 metaobj_lookup_type metaobj_lookup; 00079 metaref_type max_metaref; 00080 00081 std::vector<CComPtr<ICoreObject> > core_object_cleanup; 00082 00083 public: 00084 void RegisterMetaBase(metaref_type metaref, IMgaMetaBase *obj); 00085 void UnregisterMetaBase(metaref_type metaref, IMgaMetaBase *obj) NOTHROW; 00086 00087 // ------- properties 00088 00089 public: 00090 CComObjPtr<ICoreProject> coreproject; 00091 CComObjPtr<ICoreTerritory> coreterritory; 00092 CCoreObjectPtr rootobject; 00093 00094 CComBSTR m_namespace; 00095 00096 // ------- Edit 00097 00098 public: 00099 void CreateMetaBase(metaid_type metaid, CCoreObjectPtr &obj); 00100 void CreateMetaObj(metaid_type metaid, CCoreObjectPtr &obj); 00101 00102 // ------- CheckPath 00103 00104 public: 00105 void CreatePathItems(bstr_const_iterator i, bstr_const_iterator e, pathitems_type &pathitems); 00106 void CreateJointPaths(BSTR paths, jointpaths_type &jointpaths); 00107 private: 00108 void _ThrowExceptionIfNotOpen(); 00109 }; 00110 00111 #endif//MGA_MGAMETAPROJECT_H