[GME-commit] GMESRC/GME/Parser MgaDumper.cpp,1.28,1.29 MgaDumper.h,1.15,1.16 MgaParser.cpp,1.32,1.33 MgaParser.h,1.16,1.17 mga.dtd,1.12,1.13

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Fri May 19 19:45:37 CDT 2006


Update of /project/gme-repository/GMESRC/GME/Parser
In directory escher:/tmp/cvs-serv4262

Modified Files:
	MgaDumper.cpp MgaDumper.h MgaParser.cpp MgaParser.h mga.dtd 
Log Message:
Object Guids dumped, and parsed.
When a couple of fcos are parsed only, then we disregard previous guids, in order to prevent having the same guid after a copy&paste operation (through the XML clipboard). We maintain guids if the whole project is parsed.


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: MgaParser.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/MgaParser.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** MgaParser.cpp	13 Mar 2006 19:47:24 -0000	1.32
--- MgaParser.cpp	19 May 2006 18:45:35 -0000	1.33
***************
*** 15,18 ****
--- 15,19 ----
  {
  	CHECK_IN(here);
+ 	m_maintainGuids = false;
  
  	try
***************
*** 143,146 ****
--- 144,148 ----
  {
  	CHECK_IN(p);
+ 	m_maintainGuids = true; //will be set to false if p is NOT empty
  
  	try
***************
*** 164,168 ****
  		COMTHROW( project->BeginTransaction(territory, TRANSACTION_NON_NESTED) );
  
! 
  		
  		project_prefs = project_prefs_orig | MGAPREF_IGNORECONNCHECKS;
--- 166,180 ----
  		COMTHROW( project->BeginTransaction(territory, TRANSACTION_NON_NESTED) );
  
! 		CComObjPtr<IMgaFolder> rfld;
! 		COMTHROW( project->get_RootFolder( PutOut(rfld)));
! 		if( rfld) 
! 		{
! 			CComObjPtrVector<IMgaFolder> fols;
! 			CComObjPtrVector<IMgaFCO> chld;
! 			COMTHROW( rfld->get_ChildFCOs( PutOut( chld)));
! 			COMTHROW( rfld->get_ChildFolders( PutOut( fols)));
! 			
! 			m_maintainGuids = fols.empty() && chld.empty(); // maintain guids if and only if project is empty
! 		}
  		
  		project_prefs = project_prefs_orig | MGAPREF_IGNORECONNCHECKS;
***************
*** 515,518 ****
--- 527,531 ----
  void CMgaParser::RegisterLookup(const attributes_type &attributes, IMgaObject *object)
  {
+ 	bool perm_present = false; // currently the perm attribute appears only if the object is readonly
  	attributes_iterator i = attributes.begin();
  	attributes_iterator e = attributes.end();
***************
*** 522,530 ****
  		{
  			RegisterLookup((*i).second, object);
! 			break;
  		}
  
  		++i;
  	}
  }
  
--- 535,557 ----
  		{
  			RegisterLookup((*i).second, object);
! 			//break;
! 		}
! 		else if( m_maintainGuids && (*i).first == "guid")
! 		{
! 				// when fco was created already got a fresh GUID, but we need to maintain
! 				// the old guid, thus we overwrite the old value with the parsed one
! 			object->PutGuidDisp( CComBSTR( (*i).second.c_str()));
! 		}
! 		else if( (*i).first == "perm" )
! 		{
! 			// the plain presence of the attribute indicates 'ro' flag
! 			// no need to parse the value: (*i).second
! 			perm_present = true;
  		}
  
  		++i;
  	}
+ 	
+ 	readonly_stack.push_back( perm_present); // we insert a value anyway into the stack
  }
  
***************
*** 818,822 ****
  	COMTHROW(folder->put_ChildRelIDCounter(crid));
  
! 	RegisterReadOnlyStatus( attributes);
  	RegisterLookup(attributes, folder);
  }
--- 845,849 ----
  	COMTHROW(folder->put_ChildRelIDCounter(crid));
  
! 	//RegisterReadOnlyStatus( attributes);
  	RegisterLookup(attributes, folder);
  }
***************
*** 915,919 ****
  	COMTHROW(CComQIPtr<IMgaModel>(model)->put_ChildRelIDCounter(crid));
  
! 	RegisterReadOnlyStatus( attributes);
  	RegisterLookup(attributes, model);
  }
--- 942,946 ----
  	COMTHROW(CComQIPtr<IMgaModel>(model)->put_ChildRelIDCounter(crid));
  
! 	//RegisterReadOnlyStatus( attributes);
  	RegisterLookup(attributes, model);
  }
***************
*** 989,993 ****
  	GetCurrent().object = atom;
  
! 	RegisterReadOnlyStatus( attributes);
  	RegisterLookup(attributes, atom);
  }
--- 1016,1020 ----
  	GetCurrent().object = atom;
  
! 	//RegisterReadOnlyStatus( attributes);
  	RegisterLookup(attributes, atom);
  }
***************
*** 1139,1143 ****
  	if( GetByName(attributes, "isbound") == "yes" ) GetCurrent().exstrinfo = "skip";
  
! 	RegisterReadOnlyStatus( attributes);
  	RegisterLookup(attributes, conn);
  }
--- 1166,1170 ----
  	if( GetByName(attributes, "isbound") == "yes" ) GetCurrent().exstrinfo = "skip";
  
! 	//RegisterReadOnlyStatus( attributes);
  	RegisterLookup(attributes, conn);
  }
***************
*** 1299,1303 ****
  	GetCurrent().object = fco;
  
! 	RegisterReadOnlyStatus( attributes);
  	RegisterLookup(attributes, fco);
  }
--- 1326,1330 ----
  	GetCurrent().object = fco;
  
! 	//RegisterReadOnlyStatus( attributes);
  	RegisterLookup(attributes, fco);
  }
***************
*** 1411,1415 ****
  	GetCurrent().object = fco;
  
! 	RegisterReadOnlyStatus( attributes);
  	RegisterLookup(attributes, fco);
  }
--- 1438,1442 ----
  	GetCurrent().object = fco;
  
! 	//RegisterReadOnlyStatus( attributes);
  	RegisterLookup(attributes, fco);
  }
***************
*** 1590,1597 ****
  }
  
! void CMgaParser::RegisterReadOnlyStatus( const attributes_type &attributes)
! {
! 	readonly_stack.push_back( GetByNameX( attributes, "perm") != 0);
! }
  
  bool CMgaParser::GetIntendedReadOnlyFlag( bool *p_isReadOnly)
--- 1617,1624 ----
  }
  
! //void CMgaParser::RegisterReadOnlyStatus( const attributes_type &attributes)
! //{
! //	readonly_stack.push_back( GetByNameX( attributes, "perm") != 0);
! //}
  
  bool CMgaParser::GetIntendedReadOnlyFlag( bool *p_isReadOnly)

Index: MgaDumper.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/MgaDumper.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** MgaDumper.h	31 Aug 2005 20:48:04 -0000	1.15
--- MgaDumper.h	19 May 2006 18:45:35 -0000	1.16
***************
*** 47,50 ****
--- 47,51 ----
  		, m_dumpRelids( true)
  		, m_dumpLibraryStubs(false) 
+ 		, m_dumpGuids( false)
  	{ }
  
***************
*** 224,227 ****
--- 225,229 ----
  	long fco_count;
  	int dumpversion;// >=1 means new xme format, ==2 means do not dump relids
+ 	bool m_dumpGuids;
  
  	bool m_closureDump;

Index: mga.dtd
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/mga.dtd,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** mga.dtd	13 Mar 2006 19:47:24 -0000	1.12
--- mga.dtd	19 May 2006 18:45:35 -0000	1.13
***************
*** 40,43 ****
--- 40,44 ----
  	libref		CDATA		#IMPLIED
  	perm 		CDATA		#IMPLIED
+ 	guid		CDATA		#IMPLIED
  >
  
***************
*** 53,56 ****
--- 54,58 ----
  	childrelidcntr	CDATA		#IMPLIED
  	perm 		CDATA		#IMPLIED
+ 	guid		CDATA		#IMPLIED
  >
  
***************
*** 65,68 ****
--- 67,71 ----
  	relid		CDATA		#IMPLIED
  	perm 		CDATA		#IMPLIED
+ 	guid		CDATA		#IMPLIED
  >
  
***************
*** 79,82 ****
--- 82,86 ----
  	relid		CDATA		#IMPLIED
  	perm 		CDATA		#IMPLIED
+ 	guid		CDATA		#IMPLIED
  >
  
***************
*** 93,96 ****
--- 97,101 ----
  	relid		CDATA		#IMPLIED
  	perm 		CDATA		#IMPLIED
+ 	guid		CDATA		#IMPLIED
  >
  
***************
*** 106,109 ****
--- 111,115 ----
  	relid		CDATA		#IMPLIED
  	perm 		CDATA		#IMPLIED
+ 	guid		CDATA		#IMPLIED
  >
  

Index: MgaParser.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/MgaParser.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** MgaParser.h	13 Mar 2006 19:47:24 -0000	1.16
--- MgaParser.h	19 May 2006 18:45:35 -0000	1.17
***************
*** 35,39 ****
  {
  public:
! 	CMgaParser() 
  	{ 
  		m_resolveDerFuncPtr = CMgaParser::ResolveDerivation;
--- 35,40 ----
  {
  public:
! 	CMgaParser()
! 		: m_maintainGuids( false)
  	{ 
  		m_resolveDerFuncPtr = CMgaParser::ResolveDerivation;
***************
*** 140,144 ****
  	void RegisterLookup(const attributes_type &attributes, IMgaObject *object);
  
! 	void RegisterReadOnlyStatus( const attributes_type &attributes);
  	bool GetIntendedReadOnlyFlag( bool *p_isReadOnly);
  
--- 141,145 ----
  	void RegisterLookup(const attributes_type &attributes, IMgaObject *object);
  
! 	//void RegisterReadOnlyStatus( const attributes_type &attributes);
  	bool GetIntendedReadOnlyFlag( bool *p_isReadOnly);
  
***************
*** 199,202 ****
--- 200,204 ----
  	void assignrelid(IMgaObject *obj);	
  
+ 	bool m_maintainGuids; // if parser should parse and set (into MGA layer) the found guids
  // ------- Element Handlers
  	

Index: MgaDumper.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/MgaDumper.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** MgaDumper.cpp	13 Mar 2006 19:47:24 -0000	1.28
--- MgaDumper.cpp	19 May 2006 18:45:34 -0000	1.29
***************
*** 138,141 ****
--- 138,142 ----
  {
  	CHECK_IN(p);
+ 	m_dumpGuids = true; // dump GUIDs with the whole project
  	m_closureDump = false;
  	m_strictDump = false;
***************
*** 158,161 ****
--- 159,163 ----
  STDMETHODIMP CMgaDumper::DumpFCOs(IMgaProject *proj, IMgaFCOs *p, IMgaFolders *f, IMgaRegNodes *r, BSTR xmlfile)
  {
+ 	m_dumpGuids = false; // while dumping selected FCOs do NOT dump guids of the fco's
  	m_closureDump = false;
  	m_strictDump = false; // this method uses the permissive dump
***************
*** 551,554 ****
--- 553,570 ----
  	Attr("kind", metafolder, IMgaMetaFolder::get_Name);
  
+ 	if( m_dumpGuids) // this is true if Project is dumped and mgaversion of project is 2
+ 	{
+ 		try 
+ 		{
+ 			CComBstrObj bs;
+ 			HRESULT hr = folder->GetGuidDisp( PutOut( bs));
+ 			if( SUCCEEDED( hr) && bs && bs.Length() == 38) // {%08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02X} <-- dumping that form (38 chars long including braces)
+ 				Attr( "guid", bs);//Attr( "guid", IMgaObject::GetGuidDisp);
+ 
+ 		} catch( hresult_exception& )
+ 		{
+ 		}
+ 	}
+ 
  	StartElem("name");
  	Data(folder, IMgaFolder::get_Name);
***************
*** 708,711 ****
--- 724,741 ----
  		if( role != NULL )
  			Attr("role", role, IMgaMetaRole::get_Name);
+ 
+ 		if( m_dumpGuids) // this is true if Project is dumped and mgaversion of project is 2
+ 		{
+ 			try 
+ 			{
+ 				CComBstrObj bs;
+ 				HRESULT hr = fco->GetGuidDisp( PutOut( bs));
+ 				if( SUCCEEDED( hr) && bs && bs.Length() == 38) // {%08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02X} <-- dumping that form (38 chars long including braces)
+ 					Attr( "guid", bs);//Attr( "guid", IMgaFCO::GetGuidDisp);
+ 
+ 			} catch( hresult_exception& )
+ 			{
+ 			}
+ 		}
  
  		if( m_closureDump && m_v2)



More information about the GME-commit mailing list