[GME-commit] GMESRC/GME/Mga MgaFCO.cpp,1.36,1.37 MgaFilter.cpp,1.10,1.11 MgaFolder.cpp,1.33,1.34 MgaProject.cpp,1.67,1.68 MgaProject.h,1.31,1.32 MgaTerritory.cpp,1.2,1.3 MgaTerritory.h,1.2,1.3

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Fri Jul 21 20:11:42 CDT 2006


Update of /project/gme-repository/GMESRC/GME/Mga
In directory escher:/tmp/cvs-serv9507

Modified Files:
	MgaFCO.cpp MgaFilter.cpp MgaFolder.cpp MgaProject.cpp 
	MgaProject.h MgaTerritory.cpp MgaTerritory.h 
Log Message:
Namespace related changes.
Modified Files:
 	MgaFCO.cpp MgaFilter.cpp MgaFolder.cpp MgaProject.cpp 
 	MgaProject.h MgaTerritory.cpp MgaTerritory.h 


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: MgaTerritory.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaTerritory.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MgaTerritory.h	13 Oct 2004 15:17:55 -0000	1.2
--- MgaTerritory.h	21 Jul 2006 19:11:40 -0000	1.3
***************
*** 74,77 ****
--- 74,79 ----
  	STDMETHOD(OpenFCOs)(IMgaFCOs *oldptr, IMgaFCOs **newptr);
  	STDMETHOD(CloseObj)(IMgaObject *obj);
+ 	STDMETHOD(SetNamespace)( BSTR pNmsp);
+ 	STDMETHOD(GetNamespace)( BSTR * pNmsp);
  	CMgaProject *mgaproject;
  	bool notified;
***************
*** 80,83 ****
--- 82,86 ----
  	CComPtr<IMgaEventSink> handler, rwhandler;
  	int refcnt;
+ 	CComBSTR m_bstrCurrNamespace;
  };
  

Index: MgaTerritory.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaTerritory.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MgaTerritory.cpp	9 Apr 2002 22:23:00 -0000	1.2
--- MgaTerritory.cpp	21 Jul 2006 19:11:40 -0000	1.3
***************
*** 135,138 ****
--- 135,157 ----
  
  
+ STDMETHODIMP CMgaTerritory::SetNamespace( BSTR pNmsp)
+ {
+ 	COMTRY {
+ 		m_bstrCurrNamespace = pNmsp;
+ 		mgaproject->SetNmspaceInMeta(); // set into the metaproject if open
+ 	} COMCATCH(;)
+ }
+ 
+ STDMETHODIMP CMgaTerritory::GetNamespace( BSTR * pNmsp)
+ {
+ 	COMTRY {
+ 		if( m_bstrCurrNamespace.Length() > 0) // namespace set
+ 		{
+ 			CComBSTR res;
+ 			res.AppendBSTR( m_bstrCurrNamespace);
+ 			*pNmsp = res.Detach();
+ 		}
+ 	} COMCATCH(;)
+ }
  
  STDMETHODIMP CMgaAddOn::CheckProject(IMgaProject *project) {

Index: MgaFolder.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaFolder.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** MgaFolder.cpp	19 May 2006 18:35:31 -0000	1.33
--- MgaFolder.cpp	21 Jul 2006 19:11:40 -0000	1.34
***************
*** 802,809 ****
--- 802,811 ----
  
  
+ //should be namespace aware
  HRESULT FCO::GetChildrenOfKind(BSTR kindname, IMgaFCOs ** pVal) {
  	COMTRY {
  		CheckRead();
  		metaref_type tgood = 0;
+ 		CComBSTR kindname_m = mgaproject->prefixWNmspc( kindname);
  
  		CoreObjs children = self[ATTRID_FCOPARENT+ATTRID_COLLECTION];
***************
*** 818,822 ****
  				  CComBSTR str;
  				  meta->get_Name(&str);
! 				  if( str == kindname) tgood = t;	
  			  }	
  			  if(t == tgood)  {
--- 820,824 ----
  				  CComBSTR str;
  				  meta->get_Name(&str);
! 				  if( str == kindname || str == kindname_m) tgood = t;	
  			  }	
  			  if(t == tgood)  {

Index: MgaFilter.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaFilter.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** MgaFilter.cpp	19 May 2005 19:43:41 -0000	1.10
--- MgaFilter.cpp	21 Jul 2006 19:11:40 -0000	1.11
***************
*** 60,64 ****
  			unsigned int code;
  			if(swscanf(p,L"#%u", &code) == 1) kindnums.insert(code);
! 			else kindnames.insert(CComBSTR(p));
  		}	
  		newkind = false;
--- 60,68 ----
  			unsigned int code;
  			if(swscanf(p,L"#%u", &code) == 1) kindnums.insert(code);
! 			//else kindnames.insert(CComBSTR(p));// NAMESPACE logic inserted here:
! 			else {
! 				kindnames.insert( CComBSTR(p));
! 				kindnames.insert( mgaproject->prefixWNmspc( CComBSTR(p)));
! 			}
  		}	
  		newkind = false;

Index: MgaFCO.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaFCO.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** MgaFCO.cpp	19 May 2006 18:35:30 -0000	1.36
--- MgaFCO.cpp	21 Jul 2006 19:11:40 -0000	1.37
***************
*** 200,203 ****
--- 200,204 ----
  			metaref_type role = self[ATTRID_ROLEMETA];
  			if(role) {
+ 				mgaproject->SetNmspaceInMeta();
  				*pVal = CComQIPtr<IMgaMetaRole>(mgaproject->FindMetaRef(role)).Detach();
  				if(!(*pVal)) COMTHROW(E_MGA_META_INCOMPATIBILITY);
***************
*** 212,215 ****
--- 213,217 ----
  		CHECK_OUTPTRPAR(pVal);
  		COMTRY {
+ 			mgaproject->SetNmspaceInMeta();
  			*pVal = CComQIPtr<IMgaMetaFCO>(mgaproject->FindMetaRef(self[ATTRID_META])).Detach();
  		} COMCATCH(e.hr = E_MGA_META_INCOMPATIBILITY;)
***************
*** 225,228 ****
--- 227,231 ----
  		CheckDeletedRead();
  		CHECK_OUTPTRPAR(pVal);
+ 		mgaproject->SetNmspaceInMeta();
  		*pVal = mgaproject->FindMetaRef(self[ATTRID_META]).Detach();
  	} COMCATCH(;)

Index: MgaProject.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaProject.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** MgaProject.h	22 May 2006 17:11:07 -0000	1.31
--- MgaProject.h	21 Jul 2006 19:11:40 -0000	1.32
***************
*** 164,167 ****
--- 164,170 ----
  	void FixupGUID(bool write = true);
  	void UpdateMGAVersion(CoreObj& p_dataroot);
+ 	void SetNmspaceInMeta();
+ 	CComBSTR getNmspc();
+ 	CComBSTR prefixWNmspc( CComBSTR pKindname);
  
  	void StartAutoAddOns();												// start if enabled

Index: MgaProject.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaProject.cpp,v
retrieving revision 1.67
retrieving revision 1.68
diff -C2 -d -r1.67 -r1.68
*** MgaProject.cpp	22 May 2006 17:11:07 -0000	1.67
--- MgaProject.cpp	21 Jul 2006 19:11:40 -0000	1.68
***************
*** 65,68 ****
--- 65,69 ----
  	COMTRY {
  		COMTHROW(metapr != 0 ? S_OK : E_MGA_PROJECT_NOT_OPEN);
+ 		SetNmspaceInMeta();
  		COMTHROW(metapr->get_FindObject(id, pVal));
  	}
***************
*** 74,77 ****
--- 75,79 ----
  		CComPtr<IMgaMetaBase> hh;
  		COMTHROW(metapr != 0 ? S_OK : E_MGA_PROJECT_NOT_OPEN);
+ 		SetNmspaceInMeta();
  		COMTHROW(metapr->get_FindObject(l, &hh));
  //		HRESULT hr = metapr->get_FindObject(l, &hh);
***************
*** 645,648 ****
--- 647,651 ----
  	COMTRY {
  		if(metapr == 0) COMTHROW( E_MGA_PROJECT_NOT_OPEN );
+ 		SetNmspaceInMeta();
  		*pVal = metapr; (*pVal)->AddRef();
  	} COMCATCH(;);
***************
*** 1630,1633 ****
--- 1633,1682 ----
  }
  
+ void CMgaProject::SetNmspaceInMeta()
+ {
+ 	try {
+ 		ASSERT( metapr);
+ 		if( metapr)
+ 		{
+ 			COMTHROW( metapr->SetNmspc( getNmspc()));
+ 		}
+ 	}
+ 	catch( hresult_exception& ) {
+ 		ASSERT(0);
+ 	}
+ }
+ 
+ 
+ CComBSTR CMgaProject::getNmspc()
+ {
+ 	CComBSTR bstr_nm;
+ 	try {
+ 		CComPtr<IMgaTerritory> terr;
+ 		COMTHROW( get_ActiveTerritory( &terr));
+ 		if( terr)
+ 		{
+ 			COMTHROW( terr->GetNamespace( &bstr_nm));
+ 		}
+ 	}
+ 	catch( hresult_exception& ) {
+ 		bstr_nm.Empty();
+ 	}
+ 	return bstr_nm;
+ }
+ 
+ CComBSTR CMgaProject::prefixWNmspc( CComBSTR pKindname)
+ {
+ 	CComBSTR kindname_m;
+ 	CComBSTR nm = getNmspc();
+ 	if( nm.Length() > 0)// or if not found('::')
+ 	{
+ 		kindname_m.AppendBSTR( nm);
+ 		kindname_m.Append( "::");
+ 	}
+ 
+ 	kindname_m.AppendBSTR( pKindname);
+ 
+ 	return kindname_m;
+ }
  
  STDMETHODIMP CMgaProject::CheckCollection(IMgaFCOs *coll) {



More information about the GME-commit mailing list