GME  13
MgaMetaFCO.cpp
Go to the documentation of this file.
00001 
00002 #include "stdafx.h"
00003 #include "MgaMetaFCO.h"
00004 
00005 // --------------------------- CMgaMetaFCO
00006 
00007 HRESULT CMgaMetaFCO::get_AttributeByName(IMgaMetaFCO *me, BSTR name, IMgaMetaAttribute **p)
00008 {
00009         ASSERT( me != NULL );
00010         CHECK_OUT(p);
00011 
00012         COMTRY
00013         {
00014                 CCoreObjectPtr self(me);
00015 
00016                 coreobjects_type coreobjects;
00017                 self.GetCollectionValue(ATTRID_ATTRLINK_USEDIN_PTR, coreobjects);
00018 
00019                 coreobjects_iterator i = coreobjects.begin();
00020                 coreobjects_iterator e = coreobjects.end();
00021                 while( i != e )
00022                 {
00023                         CCoreObjectPtr obj;
00024                         (*i).GetPointerValue(ATTRID_ATTRLINK_ATTR_PTR, obj);
00025 
00026                         CComBstrObj n;
00027                         obj.GetStringValue(ATTRID_NAME, PutOut(n));
00028 
00029                         if( n == name )
00030                                 COMRETURN( ::QueryInterface(obj, p) );
00031 
00032                         ++i;
00033                 }
00034 
00035                 HR_THROW(E_NOTFOUND);
00036         } 
00037         COMCATCH(;)
00038 }
00039 
00040 HRESULT CMgaMetaFCO::get_AttributeByRef(IMgaMetaFCO *me, metaref_type mref, IMgaMetaAttribute **p)
00041 {
00042         ASSERT( me != NULL );
00043         CHECK_OUT(p);
00044 
00045         COMTRY 
00046         {
00047                 CCoreObjectPtr self(me);
00048 
00049                 coreobjects_type coreobjects;
00050                 self.GetCollectionValue(ATTRID_ATTRLINK_USEDIN_PTR, coreobjects);
00051 
00052                 coreobjects_iterator i = coreobjects.begin();
00053                 coreobjects_iterator e = coreobjects.end();
00054                 while( i != e )
00055                 {
00056                         CCoreObjectPtr obj;
00057                         (*i).GetPointerValue(ATTRID_ATTRLINK_ATTR_PTR, obj);
00058 
00059                         if( obj.GetLongValue(ATTRID_METAREF) == mref )
00060                         {
00061                                 COMTHROW( ::QueryInterface(obj, p) );
00062                                 return S_OK;
00063                         }
00064 
00065                         ++i;
00066                 }
00067 
00068                 HR_THROW(E_NOTFOUND);
00069         }
00070         COMCATCH(;)
00071 }
00072 
00073 HRESULT CMgaMetaFCO::get_DefinedAttributeByName(IMgaMetaFCO *me, BSTR name,
00074         VARIANT_BOOL inscope, IMgaMetaAttribute **p)
00075 {
00076         ASSERT( me != NULL );
00077         CHECK_OUT(p);
00078 
00079         COMTRY
00080         {
00081                 CCoreObjectPtr self(me);
00082 
00083                 coreobjects_type coreobjects;
00084                 self.GetCollectionValue(ATTRID_DEFATTR_PTR, coreobjects);
00085 
00086                 coreobjects_iterator i = coreobjects.begin();
00087                 coreobjects_iterator e = coreobjects.end();
00088                 while( i != e )
00089                 {
00090                         CComBstrObj n;
00091                         (*i).GetStringValue(ATTRID_NAME, PutOut(n));
00092                         
00093                         if( n == name )
00094                         {
00095                                 COMTHROW( ::QueryInterface(*i, p) );
00096                                 return S_OK;
00097                         }
00098 
00099                         ++i;
00100                 }
00101 
00102                 if( inscope == VARIANT_FALSE )
00103                         COMRETURN(E_NOTFOUND);
00104 
00105                 CComObjPtr<IMgaMetaBase> parent;
00106                 COMTHROW( me->get_DefinedIn(PutOut(parent)) );
00107                 ASSERT( parent != NULL );
00108 
00109                 CComObjPtr<IMgaMetaFolder> folder;
00110                 if( SUCCEEDED(parent.QueryInterface(folder)) )
00111                         COMRETURN( folder->get_DefinedAttributeByName(name, inscope, p) );
00112 
00113                 CComObjPtr<IMgaMetaFCO> fco;
00114                 COMTHROW( parent.QueryInterface(fco) );
00115                 COMRETURN( fco->get_DefinedAttributeByName(name, inscope, p) );
00116         }
00117         COMCATCH(;)
00118 }
00119 
00120 void CMgaMetaFCO::Traverse(CMgaMetaProject *metaproject, CCoreObjectPtr &me)
00121 {
00122         ASSERT( metaproject != NULL );
00123         ASSERT( me != NULL );
00124 
00125         CMgaMetaBase::Traverse(metaproject, me);
00126 
00127         TraverseCollection(metaproject, me, ATTRID_DEFATTR_PTR);
00128         TraverseCollection(metaproject, me, ATTRID_ATTRLINK_USEDIN_PTR);
00129 }
00130 
00131 HRESULT CMgaMetaFCO::get_AliasingEnabled(IMgaMetaFCO *me, VARIANT_BOOL *p)
00132 {
00133         ASSERT( me != NULL );
00134         if( p == NULL ) COMRETURN(E_POINTER);
00135         COMTRY
00136         {
00137                 CCoreObjectPtr self(me);
00138                 *p = 0; //self.GetBoolValue(ATTRID_ALIASENABLED);
00139 
00140         }
00141         COMCATCH(;)
00142 }
00143 
00144 HRESULT CMgaMetaFCO::put_AliasingEnabled(IMgaMetaFCO *me, VARIANT_BOOL p)
00145 {
00146         ASSERT( me != NULL );
00147         COMTRY
00148         {
00149                 CCoreObjectPtr self(me);
00150 //              self.PutBoolValue(ATTRID_ALIASENABLED,p);
00151 
00152         }
00153         COMCATCH(;)
00154 }