[GME-commit] GMESRC/GME/Parser Helper.cpp,1.2,1.3 Helper.h,1.2,1.3 MgaDumper.cpp,1.25,1.26 MgaParser.h,1.12,1.13 MgaParserBC.cpp,1.6,1.7 MgaParserClosureHelper.cpp,1.3,1.4 MgaParserSC.cpp,1.5,1.6 StdAfx.h,1.3,1.4 mgaclosure.dtd,1.2,1.3

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Tue Jul 19 18:29:55 CDT 2005


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

Modified Files:
	Helper.cpp Helper.h MgaDumper.cpp MgaParser.h MgaParserBC.cpp 
	MgaParserClosureHelper.cpp MgaParserSC.cpp StdAfx.h 
	mgaclosure.dtd 
Log Message:
New smart copy implemented, changed parser accordingly.


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: MgaParserSC.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/MgaParserSC.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** MgaParserSC.cpp	18 May 2005 22:36:36 -0000	1.5
--- MgaParserSC.cpp	19 Jul 2005 17:29:52 -0000	1.6
***************
*** 13,17 ****
  // --------------------------- CMgaParser - copy closure dumped data parsing
  
! STDMETHODIMP CMgaParser::ParseClos4(IMgaObject *here, BSTR filename)
  {
  	CHECK_IN(here);
--- 13,17 ----
  // --------------------------- CMgaParser - copy closure dumped data parsing
  
! STDMETHODIMP CMgaParser::ParseClos4(IMgaObject *here, BSTR filename, int options)
  {
[...1958 lines suppressed...]
! 
! 	if( GetPrevName() == "folder" )
! 	{
! 		CComObjPtr<IMgaFolder> folder;
! 		GetPrevObj(folder);
! 
! 		COMTHROW( folder->DefineConstraint(PutInBstr(constraint_name), 0, // FIXME: the mask
! 			PutInBstr(constraint_value), PutOut(constraint)) );
! 	}
! 	else
! 	{
! 		CComObjPtr<IMgaFCO> fco;
! 		GetPrevObj(fco);
! 
! 		COMTHROW( fco->DefineConstraint(PutInBstr(constraint_name), 0, // FIXME: the mask
! 			PutInBstr(constraint_value), PutOut(constraint)) );
! 	}
! }
! 
! 

Index: MgaParserBC.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/MgaParserBC.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** MgaParserBC.cpp	18 May 2005 22:36:36 -0000	1.6
--- MgaParserBC.cpp	19 Jul 2005 17:29:52 -0000	1.7
***************
*** 44,48 ****
  		m_target = target;
  		m_resolveDerFuncPtr = CMgaParser::ResolveClosure1Derivation;
! 		m_clVer = 1;
  		m_clVerStr = "1";//end
  
--- 44,48 ----
  		m_target = target;
  		m_resolveDerFuncPtr = CMgaParser::ResolveClosure1Derivation;
! 		//m_clVer = 1;
  		m_clVerStr = "1";//end
  

Index: MgaParser.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/MgaParser.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** MgaParser.h	13 Oct 2004 15:17:55 -0000	1.12
--- MgaParser.h	19 Jul 2005 17:29:52 -0000	1.13
***************
*** 14,17 ****
--- 14,18 ----
  #include <map>
  
+ 
  class CompareCComObj
  {
***************
*** 56,60 ****
  	STDMETHOD(ParseFCOs)(IMgaObject *p, BSTR filename);
  	STDMETHOD(ParseClos1)(IMgaObject *p, BSTR filename); // basic
! 	STDMETHOD(ParseClos4)(IMgaObject *p, BSTR filename); // smart
  	STDMETHOD(ParseProject)(IMgaProject *p, BSTR filename);
  
--- 57,61 ----
  	STDMETHOD(ParseFCOs)(IMgaObject *p, BSTR filename);
  	STDMETHOD(ParseClos1)(IMgaObject *p, BSTR filename); // basic
! 	STDMETHOD(ParseClos4)(IMgaObject *p, BSTR filename, int options); // smart
  	STDMETHOD(ParseProject)(IMgaProject *p, BSTR filename);
  
***************
*** 164,176 ****
  	bool findPlaceForElem( const attributes_type &attributes, deriv_type& deriv, CComObjPtr<IMgaFolder>& place_fld, CComObjPtr<IMgaModel>& place_mdl);
  
  	void findObjOnRelPath( CComObjPtr<IMgaObject> obj_rel_to, const std::string& relpath , CComObjPtr<IMgaObject>& obj, const std::string& text = "");
  	void findObjOnAbsPath( CComObjPtr<IMgaProject> project, const std::string& abspath , CComObjPtr<IMgaObject>& obj, const std::string& text = "");
- 	void pushInfo( const CComObjPtr<IMgaFolder>& place_fld, const CComObjPtr<IMgaModel>& place_mdl, const CComObjPtr<IMgaFCO>& fco1, const CComObjPtr<IMgaFCO>& fco2/* = CComObjPtr<IMgaFCO>()*/);
- 	void popInfo();
- 	void writeInfo( const CComObjPtr<IMgaObject>& place, const CComObjPtr<IMgaObject>& fco1, const CComObjPtr<IMgaObject>& fco2, bool normal_msg = true);
- 	std::vector< CComObjPtr<IMgaObject> > m_parsed1;
- 	std::vector< CComObjPtr<IMgaObject> > m_parsed2;
- 	std::vector< CComObjPtr<IMgaObject> > m_parsed3; // the archetype
  
  	bool isNeedFor2ndStep();
  	void tryToFindMissedReferreds();
--- 165,177 ----
  	bool findPlaceForElem( const attributes_type &attributes, deriv_type& deriv, CComObjPtr<IMgaFolder>& place_fld, CComObjPtr<IMgaModel>& place_mdl);
  
+ 	bool findObject( const CComObjPtr<IMgaModel>& prev, const attributes_type& attributes, CComObjPtr<IMgaFCO>& obj, const char type);
+ 	bool findObject( const CComObjPtr<IMgaFolder>& prev, const attributes_type& attributes, CComObjPtr<IMgaFCO>& obj, const char type);
+ 	bool findObjectIn( const CComObjPtr<IMgaObject>& parent, const CComObjPtrVector<IMgaFCO>& vec, const attributes_type& attributes, CComObjPtr<IMgaFCO>& obj, const char type);
+ 	bool findFolderIn( const CComObjPtr<IMgaFolder>& prev, const attributes_type& attributes, CComObjPtr<IMgaFolder>& fol);
  	void findObjOnRelPath( CComObjPtr<IMgaObject> obj_rel_to, const std::string& relpath , CComObjPtr<IMgaObject>& obj, const std::string& text = "");
  	void findObjOnAbsPath( CComObjPtr<IMgaProject> project, const std::string& abspath , CComObjPtr<IMgaObject>& obj, const std::string& text = "");
  
+ 	static bool isNullRef( CComObjPtr<IMgaFCO>& ref);
+ 	static bool isEmptySet( CComObjPtr<IMgaFCO>& set);
  	bool isNeedFor2ndStep();
  	void tryToFindMissedReferreds();
***************
*** 178,182 ****
  	std::map< CComObjPtr<IMgaFCO>, std::string, CompareCComObj > m_notFoundReferredObject;
  	std::map< CComObjPtr<IMgaFCO>, std::vector< std::string >, CompareCComObj > m_notFoundSetMembers;
- 	int  m_clVer;
  	std::string m_clVerStr;
  
--- 179,182 ----
***************
*** 214,225 ****
  	void StartBCClipboard(const attributes_type &attributes);
  
  	void StartSCConnection(const attributes_type &attributes);
  	void StartSCConnPoint(const attributes_type &attributes);
  	void StartSCReference(const attributes_type &attributes);
  	void StartSCSet(const attributes_type &attributes);
  
- 	void EndSCReference();
- 	void EndSCSet();
  	void EndSCConnection();
  
  
--- 214,232 ----
  	void StartBCClipboard(const attributes_type &attributes);
  
+ 	void StartSCFolder(const attributes_type &attributes);
  	void StartSCConnection(const attributes_type &attributes);
  	void StartSCConnPoint(const attributes_type &attributes);
  	void StartSCReference(const attributes_type &attributes);
  	void StartSCSet(const attributes_type &attributes);
+ 	void StartSCAtom(const attributes_type &attributes);
+ 	void StartSCModel(const attributes_type &attributes);
  
  	void EndSCConnection();
+ 	void EndSCName();
+ 	void EndSCValue();
+ 	void EndSCConstraint();
+ 	void StartSCRegNode(const attributes_type &attributes);
+ 	void StartSCAttribute(const attributes_type &attributes);
+ 	bool m_mergeAllowed;
  
  

Index: StdAfx.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/StdAfx.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** StdAfx.h	13 Oct 2004 15:17:55 -0000	1.3
--- StdAfx.h	19 Jul 2005 17:29:52 -0000	1.4
***************
*** 29,32 ****
--- 29,33 ----
  #include "CommonSmart.h"
  #include "CommonStl.h"
+ #define GLOBAL_ID_STR   "guid"
  
  typedef IMgaConstraint IMgaMetaConstraint;

Index: mgaclosure.dtd
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/mgaclosure.dtd,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** mgaclosure.dtd	13 Apr 2005 00:07:05 -0000	1.2
--- mgaclosure.dtd	19 Jul 2005 17:29:52 -0000	1.3
***************
*** 39,42 ****
--- 39,43 ----
  	childrelidcntr	CDATA	#IMPLIED
  	libref		CDATA		#IMPLIED
+ 	closureguid	CDATA           #IMPLIED
  	closurename	CDATA		#IMPLIED		
  	closurepath	CDATA		#IMPLIED		
***************
*** 56,59 ****
--- 57,61 ----
  	relid		CDATA		#IMPLIED
  	childrelidcntr	CDATA		#IMPLIED
+ 	closureguid	CDATA           #IMPLIED
  	closurename	CDATA		#IMPLIED	
  	closurepath	CDATA		#IMPLIED		
***************
*** 72,75 ****
--- 74,78 ----
  	isprimary	(yes|no)	"yes"
  	relid		CDATA		#IMPLIED
+ 	closureguid	CDATA           #IMPLIED
  	closurename	CDATA		#IMPLIED	
  	closurepath	CDATA		#IMPLIED		
***************
*** 92,95 ****
--- 95,99 ----
  	isbound		(yes|no)	"no"
  	relid		CDATA		#IMPLIED
+ 	closureguid	CDATA           #IMPLIED
  	closurename	CDATA		#IMPLIED	
  	closurepath	CDATA		#IMPLIED		
***************
*** 111,114 ****
--- 115,119 ----
  	isbound		(yes|no)	"no"
  	relid		CDATA		#IMPLIED
+ 	closureguid	CDATA           #IMPLIED
  	closurename	CDATA		#IMPLIED	
  	closurepath	CDATA		#IMPLIED		
***************
*** 128,131 ****
--- 133,137 ----
  	isbound		(yes|no)	"no"
  	relid		CDATA		#IMPLIED
+ 	closureguid	CDATA           #IMPLIED
  	closurename	CDATA		#IMPLIED	
  	closurepath	CDATA		#IMPLIED		

Index: Helper.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/Helper.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Helper.h	13 Oct 2004 15:17:55 -0000	1.2
--- Helper.h	19 Jul 2005 17:29:52 -0000	1.3
***************
*** 15,18 ****
--- 15,23 ----
  std::string makeNameViewable( const std::string& m);
  
+ CComBSTR makeLink( CComObjPtr<IMgaObject> obj, const std::string& nm_2 = "", bool use_anyway_nm_2 = false);
+ 
+ CComBSTR makeLink( CComObjPtr<IMgaFCO> obj, const std::string& nm_2 = "", bool use_anyway_nm_2 = false);
+ 
+ 
  #endif // HELPER_H_259823495872394857
  

Index: Helper.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/Helper.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Helper.cpp	13 Oct 2004 15:17:55 -0000	1.2
--- Helper.cpp	19 Jul 2005 17:29:52 -0000	1.3
***************
*** 110,112 ****
  
  	return res;
! }
\ No newline at end of file
--- 110,136 ----
  
  	return res;
! }
! 
! CComBSTR makeLink( CComObjPtr<IMgaObject> p_obj, const std::string& nm2, bool use_anyway_nm_2)
! {
! 	CComBSTR bstr, id, nm;
! 	COMTHROW( p_obj->get_ID( &id));
! 	COMTHROW( p_obj->get_Name( &nm));
! 	if( nm == 0 || nm == "" || use_anyway_nm_2) // if called from the Start... (or just derived) then the name its not yet parsed
! 		nm = nm2.c_str();
! 	bstr.Append("<A HREF=\"mga:");
! 	bstr.AppendBSTR( id);
! 	bstr.Append("\">");
! 	if( nm.Length() != 0)
! 		bstr.AppendBSTR( nm);
! 	else
! 		bstr.Append("emptyname");
! 	bstr.Append("</A>");
! 
! 	return bstr;
! }
! 
! CComBSTR makeLink( CComObjPtr<IMgaFCO> p_fco, const std::string& nm_2, bool use_anyway_nm_2)
! {
! 	return makeLink( CComObjPtr<IMgaObject>( p_fco), nm_2, use_anyway_nm_2);
! }

Index: MgaParserClosureHelper.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/MgaParserClosureHelper.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** MgaParserClosureHelper.cpp	13 Oct 2004 15:17:55 -0000	1.3
--- MgaParserClosureHelper.cpp	19 Jul 2005 17:29:52 -0000	1.4
***************
*** 11,14 ****
--- 11,181 ----
  #include "helper.h"
  
+ bool CMgaParser::findObjectIn( const CComObjPtr<IMgaObject>& p_parent, const CComObjPtrVector<IMgaFCO>& p_vec, const attributes_type& p_attributes, CComObjPtr<IMgaFCO>& p_obj, const char p_typeRequested)
+ {
+ 	// if the user invoked "paste closure/smart" then merge is not allowed, do not look for existing objects
+ 	if( !m_mergeAllowed) return false; 
+ 
+ 	// TODO : use role to narrow search
+ 	//std::string role_in_clipdata = GetByName(p_attributes, "role");
+ 
+ 	std::string id_in_clipdata = GetByName(p_attributes, "closureguid"); // guid
+ 	ASSERT( id_in_clipdata.length() == 38); 
+ 
+ 	bool found = false;
+ 	CComObjPtrVector<IMgaFCO>::const_iterator it = p_vec.begin();
+ 	while( it != p_vec.end() && !found)
+ 	{
+ 		CComBSTR bstr;
+ 		CComObjPtr<IMgaFCO> i = *it;
+ 		COMTHROW( i->get_RegistryValue( CComBSTR(GLOBAL_ID_STR), &bstr));
+ 		if( bstr == id_in_clipdata.c_str())
+ 		{
+ 			found = true;
+ 			p_obj = i;
+ 		}
+ 		else
+ 			++it;
+ 	}
+ 	if( found && p_obj)
+ 	{
+ 		// checking object type
+ 		switch( p_typeRequested) {
+ 			case 'M':
+ 				{
+ 					CComObjPtr<IMgaModel> _t_m;
+ 					COMTHROW( p_obj.QueryInterface( _t_m));
+ 					found = _t_m != 0;
+ 					break;
+ 				}
+ 			case 'A':
+ 				{
+ 					CComObjPtr<IMgaAtom> _t_a;
+ 					COMTHROW( p_obj.QueryInterface( _t_a));
+ 					found = _t_a != 0;
+ 					break;
+ 				}
+ 			case 'R':
+ 				{
+ 					CComObjPtr<IMgaReference> _t_r;
+ 					COMTHROW( p_obj.QueryInterface( _t_r));
+ 					found = _t_r != 0;
+ 					break;
+ 				}
+ 			case 'C':
+ 				{
+ 					CComObjPtr<IMgaConnection> _t_c;
+ 					COMTHROW( p_obj.QueryInterface( _t_c));
+ 					found = _t_c != 0;
+ 					break;
+ 				}
+ 			case 'S':
+ 				{
+ 					CComObjPtr<IMgaSet> _t_s;
+ 					COMTHROW( p_obj.QueryInterface( _t_s));
+ 					found = _t_s != 0;
+ 					break;
+ 				}
+ 			case 'F':
+ 				{
+ 					CComObjPtr<IMgaFolder> _t_f;
+ 					COMTHROW( p_obj.QueryInterface( _t_f));
+ 					found = _t_f != 0;
+ 					break;
+ 				}
+ 			case '*':  // means that we don't know the object's type a priori
+ 			default :
+ 				{
+ 					found = p_obj != 0;
+ 					break;
+ 				}
+ 		};
+ 	}
+ 
+ 	if( !found                    // id not stored in registry (or different ids found only)
+ 	   && p_typeRequested != 'C') // but the names may allow us to merge
+ 	{                             // except if Connection (usually having same names)
+ 		const std::string* s = 0;
+ 		s = GetByNameX(p_attributes, "closurename");
+ 		if( s != 0 && s->compare("") != 0)
+ 		{
+ 			CComObjPtr<IMgaObject> obj2;
+ 			findObjOnRelPath( CComObjPtr<IMgaObject>(p_parent), *s, obj2, "mergable object");
+ 			if( obj2) COMTHROW( obj2.QueryInterface( p_obj));
+ 			found = p_obj != 0;
+ 		}
+ 	}
+ 	return found;
+ }
+ 
+ bool CMgaParser::findObject( const CComObjPtr<IMgaModel>& p_prev, const attributes_type& p_attributes, CComObjPtr<IMgaFCO>& p_obj, const char p_typeRequested)
+ {
+ 	CComObjPtrVector<IMgaFCO> chld;
+ 	if( GetByNameX( p_attributes, "kind"))
+ 		COMTHROW( p_prev->GetChildrenOfKind( PutInBstrAttr(p_attributes, "kind"), PutOut( chld)));
+ 	else
+ 		COMTHROW(p_prev->get_ChildFCOs( PutOut( chld)));
+ 
+ 	return findObjectIn( CComObjPtr<IMgaObject>(p_prev), chld, p_attributes, p_obj, p_typeRequested);
+ }
+ 
+ bool CMgaParser::findObject( const CComObjPtr<IMgaFolder>& p_prev, const attributes_type& p_attributes, CComObjPtr<IMgaFCO>& p_obj, const char p_typeRequested)
+ {
+ 	CComObjPtrVector<IMgaFCO> chld;
+ 	
+ 	if( GetByNameX( p_attributes, "kind"))
+ 		COMTHROW( p_prev->GetChildrenOfKind( PutInBstrAttr(p_attributes, "kind"), PutOut( chld)));
+ 	else
+ 		COMTHROW(p_prev->get_ChildFCOs( PutOut( chld)));
+ 
+ 	return findObjectIn( CComObjPtr<IMgaObject>(p_prev), chld, p_attributes, p_obj, p_typeRequested);
+ }
+ 
+ bool CMgaParser::findFolderIn( const CComObjPtr<IMgaFolder>& p_prev, const attributes_type& p_attributes, CComObjPtr<IMgaFolder>& p_folder)
+ {
+ 	// if the user invoked ''paste closure/smart'' then merge is not allowed, do not look for existing objects
+ 	if( !m_mergeAllowed) return false; 
+ 
+ 	CComObjPtrVector<IMgaFolder> chld;
+ 	COMTHROW(p_prev->get_ChildFolders( PutOut( chld)));
+ 
+ 	std::string req_kind = GetByName( p_attributes, "kind");
+ 
+ 	std::string id_in_clipdata = GetByName(p_attributes, "closureguid");
+ 	ASSERT( id_in_clipdata.length() == 38);
+ 
+ 	bool found = false;
+ 	CComObjPtrVector<IMgaFolder>::const_iterator it = chld.begin();
+ 	while( it != chld.end() && !found)
+ 	{
+ 		CComBSTR bstr;
+ 		CComObjPtr<IMgaFolder> i = *it;
+ 		COMTHROW( i->get_RegistryValue( CComBSTR(GLOBAL_ID_STR), &bstr)); 
+ 		CComObjPtr<IMgaMetaFolder> i_metaf;
+ 		COMTHROW( i->get_MetaFolder( PutOut( i_metaf)));
+ 		CComBSTR i_kind;
+ 		COMTHROW( i_metaf->get_Name( &i_kind));
+ 
+ 		if( bstr == id_in_clipdata.c_str() && i_kind == req_kind.c_str())
+ 		{
+ 			found = true;
+ 			p_folder = i;
+ 		}
+ 		else
+ 			++it;
+ 	}
+ 	if( !found)  // id not stored in registry (or different ids found only)
+ 	{           // but the names may allow us to merge
+ 		const std::string* s = 0;
+ 		s = GetByNameX(p_attributes, "closurename");
+ 		if( s != 0 && s->compare("") != 0)
+ 		{
+ 			CComObjPtr<IMgaObject> obj2;
+ 			findObjOnRelPath( CComObjPtr<IMgaObject>(p_prev), *s, obj2, "mergable object");
+ 			if( obj2) COMTHROW( obj2.QueryInterface( p_folder));
+ 			found = p_folder != 0;
+ 		}
+ 	}
+ 	return found;
+ }
  void CMgaParser::findObjOnAbsPath( CComObjPtr<IMgaProject> p_project, const std::string& p_absPath , CComObjPtr<IMgaObject>& p_obj, const std::string& text)
  {
***************
*** 24,38 ****
  			if( m_GME) 
  			{
! 				CComBSTR bstr, id, nm;
! 				COMTHROW( p_obj->get_ID( &id));
! 				COMTHROW( p_obj->get_Name( &nm));
! 				bstr.Append("[Smartcopy Parser] Name ambiguity, selected: <A HREF=\"mga:");
! 				bstr.AppendBSTR( id);
! 				bstr.Append("\">");
! 				if( nm.Length()!= 0)
! 					bstr.AppendBSTR( nm);
! 				else
! 					bstr.Append("emptyname");
! 				bstr.Append("</A>");
  				
  				if( !text.empty())
--- 191,207 ----
  			if( m_GME) 
  			{
! 				CComBSTR bstr;//, id, nm;
! 				//COMTHROW( p_obj->get_ID( &id));
! 				//COMTHROW( p_obj->get_Name( &nm));
! 				bstr.Append("[Smartcopy Parser] Name ambiguity, selected: ");
! 				bstr.AppendBSTR( makeLink( p_obj));
! 				//bstr.Append("[Smartcopy Parser] Name ambiguity, selected: <A HREF=\"mga:");
! 				//bstr.AppendBSTR( id);
! 				//bstr.Append("\">");
! 				//if( nm.Length()!= 0)
! 				//	bstr.AppendBSTR( nm);
! 				//else
! 				//	bstr.Append("emptyname");
! 				//bstr.Append("</A>");
  				
  				if( !text.empty())
***************
*** 114,128 ****
  			if( m_GME) 
  			{
! 				CComBSTR bstr, id, nm;
! 				COMTHROW( obj->get_ID( &id));
! 				COMTHROW( obj->get_Name( &nm));
! 				bstr.Append("[Smartcopy Parser] Name ambiguity, selected: <A HREF=\"mga:");
! 				bstr.AppendBSTR( id);
! 				bstr.Append("\">");
! 				if( nm.Length()!= 0)
! 					bstr.AppendBSTR( nm);
! 				else
! 					bstr.Append("emptyname");
! 				bstr.Append("</A>"); 
  
  				if( !text.empty())
--- 283,299 ----
  			if( m_GME) 
  			{
! 				CComBSTR bstr;//, id, nm;
! 				//COMTHROW( obj->get_ID( &id));
! 				//COMTHROW( obj->get_Name( &nm));
! 				bstr.Append("[Smartcopy Parser] Name ambiguity, selected: ");
! 				bstr.AppendBSTR( makeLink( obj));
! 				//bstr.Append("[Smartcopy Parser] Name ambiguity, selected: <A HREF=\"mga:");
! 				//bstr.AppendBSTR( id);
! 				//bstr.Append("\">");
! 				//if( nm.Length()!= 0)
! 				//	bstr.AppendBSTR( nm);
! 				//else
! 				//	bstr.Append("emptyname");
! 				//bstr.Append("</A>"); 
  
  				if( !text.empty())
***************
*** 238,315 ****
  }
  
! void CMgaParser::popInfo()
! {
! 	if( m_parsed1.empty() || m_parsed2.empty()) return; // empty stack of informations
! 
! 	CComObjPtr<IMgaObject> obj = m_parsed1[0]; m_parsed1.pop_back();
! 	CComObjPtr<IMgaObject> fco1 = m_parsed2[0]; m_parsed2.pop_back();
! 	CComObjPtr<IMgaObject> fco2 = m_parsed3[0]; m_parsed3.pop_back();
  
- 	writeInfo( obj, fco1, fco2);
- }
  
! void CMgaParser::pushInfo( const CComObjPtr<IMgaFolder>& place_fld, const CComObjPtr<IMgaModel>& place_mdl, const CComObjPtr<IMgaFCO>& fco1, const CComObjPtr<IMgaFCO>& fco2)
  {
! 	CComObjPtr<IMgaObject> obj;
! 	if( place_fld)
! 		obj = place_fld;
! 	else if( place_mdl)
! 		obj = place_mdl;
! 	else ASSERT(0);
! 
! 	//m_parsed.push_back( pair< CComObjPtr<IMgaObject>, CComObjPtr<IMgaObject>( obj, fco1) );
! 	m_parsed1.push_back( obj);
! 	m_parsed2.push_back( CComObjPtr<IMgaObject>( fco1));
! 	m_parsed3.push_back( CComObjPtr<IMgaObject>( fco2));
  }
  
! void CMgaParser::writeInfo( const CComObjPtr<IMgaObject>& obj, const CComObjPtr<IMgaObject>& fco1, const CComObjPtr<IMgaObject>& fco2, bool normal_msg)
  {
! 	if( obj && fco1 )
  	{
! 		CComBSTR bstr, id2, nm2, id1, nm1, id0, nm0;
! 		COMTHROW( obj->get_ID( &id0));
! 		COMTHROW( obj->get_Name( &nm0));
! 		COMTHROW( fco1->get_ID( &id1));
! 		COMTHROW( fco1->get_Name( &nm1));
! 		if( fco2) COMTHROW( fco2->get_ID( &id2));
! 		if( fco2) COMTHROW( fco2->get_Name( &nm2));
  
! 		bstr.Append("[Smartcopy Parser] <A HREF=\"mga:");
! 		bstr.AppendBSTR( id1);
! 		bstr.Append("\">");
  
! 		if( nm1.Length() != 0)	bstr.AppendBSTR( nm1);
! 		else					bstr.Append("emptyname");
  
! 		bstr.Append( "</A>");
  
! 		if( fco2) 
  		{
! 			bstr.Append( " derived from <A HREF=\"mga:");
! 			bstr.AppendBSTR( id2);
  			bstr.Append("\">");
  
! 			if( nm2.Length() != 0)	bstr.AppendBSTR( nm2);
! 			else					bstr.Append("emptyname");
  
! 			bstr.Append("</A>");
  		}
  
! 		if( !normal_msg)
! 			bstr.Append(" could not be");
! 		bstr.Append( " inserted into <A HREF=\"mga:");
! 		bstr.AppendBSTR( id0);
! 		bstr.Append( "\">");
  
! 		if( nm0.Length() != 0)	bstr.AppendBSTR( nm0);
! 		else					bstr.Append("emptyname");
  
! 		bstr.Append( "</A>.");
! 		if( m_GME) 
  		{
! 			if( normal_msg) COMTHROW( m_GME->ConsoleMessage(bstr, MSG_INFO));
! 			else			COMTHROW( m_GME->ConsoleMessage(bstr, MSG_ERROR));
  		}
  	}
! }
\ No newline at end of file
--- 409,683 ----
  }
  
! //void CMgaParser::popInfo()
! //{
! //	if( m_parsed1.empty() || m_parsed2.empty()) return; // empty stack of informations
! //
! //	CComObjPtr<IMgaObject> obj = m_parsed1[0]; m_parsed1.pop_back();
! //	CComObjPtr<IMgaObject> fco1 = m_parsed2[0]; m_parsed2.pop_back();
! //	CComObjPtr<IMgaObject> fco2 = m_parsed3[0]; m_parsed3.pop_back();
! //
! //	writeInfo( obj, fco1, fco2);
! //}
! //
! //void CMgaParser::pushInfo( const CComObjPtr<IMgaFolder>& place_fld, const CComObjPtr<IMgaModel>& place_mdl, const CComObjPtr<IMgaFCO>& fco1, const CComObjPtr<IMgaFCO>& fco2)
! //{
! //	CComObjPtr<IMgaObject> obj;
! //	if( place_fld)
! //		obj = place_fld;
! //	else if( place_mdl)
! //		obj = place_mdl;
! //	else ASSERT(0);
! //
! //	//m_parsed.push_back( pair< CComObjPtr<IMgaObject>, CComObjPtr<IMgaObject>( obj, fco1) );
! //	m_parsed1.push_back( obj);
! //	m_parsed2.push_back( CComObjPtr<IMgaObject>( fco1));
! //	m_parsed3.push_back( CComObjPtr<IMgaObject>( fco2));
! //}
! //
! //void CMgaParser::writeInfo( const CComObjPtr<IMgaObject>& obj, const CComObjPtr<IMgaObject>& fco1, const CComObjPtr<IMgaObject>& fco2, bool normal_msg)
! //{
! //	if( obj && fco1 )
! //	{
! //		CComBSTR bstr, id2, nm2, id1, nm1, id0, nm0;
! //		COMTHROW( obj->get_ID( &id0));
! //		COMTHROW( obj->get_Name( &nm0));
! //		COMTHROW( fco1->get_ID( &id1));
! //		COMTHROW( fco1->get_Name( &nm1));
! //		if( fco2) COMTHROW( fco2->get_ID( &id2));
! //		if( fco2) COMTHROW( fco2->get_Name( &nm2));
! //
! //		bstr.Append("[Smartcopy Parser] <A HREF=\"mga:");
! //		bstr.AppendBSTR( id1);
! //		bstr.Append("\">");
! //
! //		if( nm1.Length() != 0)	bstr.AppendBSTR( nm1);
! //		else					bstr.Append("emptyname");
! //
! //		bstr.Append( "</A>");
! //
! //		if( fco2) 
! //		{
! //			bstr.Append( " derived from <A HREF=\"mga:");
! //			bstr.AppendBSTR( id2);
! //			bstr.Append("\">");
! //
! //			if( nm2.Length() != 0)	bstr.AppendBSTR( nm2);
! //			else					bstr.Append("emptyname");
! //
! //			bstr.Append("</A>");
! //		}
! //
! //		if( !normal_msg)
! //			bstr.Append(" could not be");
! //		bstr.Append( " inserted into <A HREF=\"mga:");
! //		bstr.AppendBSTR( id0);
! //		bstr.Append( "\">");
! //
! //		if( nm0.Length() != 0)	bstr.AppendBSTR( nm0);
! //		else					bstr.Append("emptyname");
! //
! //		bstr.Append( "</A>.");
! //		if( m_GME) 
! //		{
! //			if( normal_msg) COMTHROW( m_GME->ConsoleMessage(bstr, MSG_INFO));
! //			else			COMTHROW( m_GME->ConsoleMessage(bstr, MSG_ERROR));
! //		}
! //	}
! //}
  
  
! bool CMgaParser::isNeedFor2ndStep()
  {
! 	return !m_notFoundReferredObject.empty() || !m_notFoundSetMembers.empty();
  }
  
! void CMgaParser::tryToFindMissedReferreds()
  {
! 	std::map< CComObjPtr<IMgaFCO>, std::string >::iterator it = m_notFoundReferredObject.begin();
! 	std::map< CComObjPtr<IMgaFCO>, std::string >::iterator itend = m_notFoundReferredObject.end();
! 	for( ; it != itend; ++it)
  	{
! 		if( !it->first) continue;
! 		bool error = false;
  
! 		CComObjPtr<IMgaObject> target;
! 		findObjOnRelPath( CComObjPtr<IMgaObject>( it->first), it->second, target, "referred object");
! 		if( target)
! 		{
! 			CComObjPtr<IMgaReference> ref;
! 			COMTHROW( it->first.QueryInterface( ref));
! 			CComObjPtr<IMgaFCO> fco_target;
! 			COMTHROW( target.QueryInterface( fco_target));
  
! 			if( ref && fco_target)
! 			{
! 				COMTHROW( ref->put_Referred( fco_target));
  
! 				CComBSTR id1, nm1, id2, nm2, bstr("[Smartcopy Parser] Reference <A HREF=\"mga:");
! 				COMTHROW( ref->get_ID( &id1));
! 				COMTHROW( ref->get_Name( &nm1));
! 				COMTHROW( fco_target->get_ID( &id2));
! 				COMTHROW( fco_target->get_Name( &nm2));
  
! 				bstr.AppendBSTR( id1);
! 				bstr.Append("\">");
! 				if( nm1.Length() != 0)
! 					bstr.AppendBSTR( nm1);
! 				else
! 					bstr.Append("emptyname");
! 
! 				bstr.Append("</A> set to refer to <A HREF=\"mga:");
! 				bstr.AppendBSTR( id2);
! 				bstr.Append("\">");
! 				if( nm2.Length() != 0)
! 					bstr.AppendBSTR( nm2);
! 				else
! 					bstr.Append("emptyname");
! 
! 				bstr.Append("</A> in 2nd step successfully.");
! 				if( m_GME) COMTHROW( m_GME->ConsoleMessage(bstr, MSG_INFO));
! 			}
! 			else
! 				error = true;
! 		}
! 		else 
! 			error = true;
! 
! 		if( error)
  		{
! 			CComBSTR id1, nm1, bstr( "[Smartcopy Parser] Reference <A HREF=\"mga:");
! 			COMTHROW( it->first->get_ID( &id1));
! 			COMTHROW( it->first->get_Name( &nm1));
! 			bstr.AppendBSTR( id1);
  			bstr.Append("\">");
+ 			if( nm1.Length() != 0)
+ 				bstr.AppendBSTR( nm1);
+ 			else
+ 				bstr.Append("emptyname");
  
! 			bstr.Append("</A>: target not found in 2nd step. ");
! 			bstr.Append("Search path used: ");
! 			bstr.Append( makeViewable( it->second).c_str());
  
! 			if( m_GME) COMTHROW( m_GME->ConsoleMessage(bstr, MSG_ERROR));
  		}
+ 	}
+ }
  
! void CMgaParser::tryToFindMissedSetMembers()
! {
! 	std::map< CComObjPtr<IMgaFCO>, std::vector< std::string >, CompareCComObj >::iterator it = m_notFoundSetMembers.begin();
! 	std::map< CComObjPtr<IMgaFCO>, std::vector< std::string >, CompareCComObj >::iterator itend = m_notFoundSetMembers.end();
! 	for( ; it != itend; ++it)
! 	{
! 		if( !it->first || it->second.empty()) continue;
  
! 		CComObjPtr<IMgaSet> set;
! 		COMTHROW( it->first.QueryInterface( set));
  
! 		if( !set) continue;
! 
! 		std::vector< std::string >::iterator member_it = it->second.begin();
! 		std::vector< std::string >::iterator member_it_end = it->second.end();
! 		for( ; member_it != member_it_end; ++member_it)
  		{
! 			if( member_it->empty()) continue;
! 
! 			bool error = false;
! 			CComObjPtr<IMgaObject> member;
! 			findObjOnRelPath( CComObjPtr<IMgaObject>( it->first), *member_it, member, "set member");
! 			if( member)
! 			{
! 				CComObjPtr<IMgaFCO> fco_member;
! 				COMTHROW( member.QueryInterface( fco_member));
! 
! 				if( fco_member)
! 				{
! 					COMTHROW( set->AddMember( fco_member));
! 
! 					CComBSTR id1, nm1, id2, nm2, bstr("[Smartcopy Parser] Member <A HREF=\"mga:");
! 					COMTHROW( set->get_ID( &id1));
! 					COMTHROW( set->get_Name( &nm1));
! 					COMTHROW( fco_member->get_ID( &id2));
! 					COMTHROW( fco_member->get_Name( &nm2));
! 
! 					bstr.AppendBSTR( id2);
! 					bstr.Append("\">");
! 					if( nm2.Length() != 0)
! 						bstr.AppendBSTR( nm2);
! 					else
! 						bstr.Append("emptyname");
! 
! 					bstr.Append("</A> added to set <A HREF=\"mga:");
! 					bstr.AppendBSTR( id1);
! 					bstr.Append("\">");
! 					if( nm1.Length() != 0)
! 						bstr.AppendBSTR( nm1);
! 					else
! 						bstr.Append("emptyname");
! 
! 					bstr.Append("</A> in 2nd step successfully.");
! 					if( m_GME) COMTHROW( m_GME->ConsoleMessage(bstr, MSG_INFO));
! 				}
! 				else
! 					error = true;
! 			}
! 			else
! 				error = true;
! 
! 			if( error)
! 			{
! 				CComBSTR id1, nm1, bstr( "[Smartcopy Parser] Set <A HREF=\"mga:");
! 				COMTHROW( set->get_ID( &id1));
! 				COMTHROW( set->get_Name( &nm1));
! 				bstr.AppendBSTR( id1);
! 				bstr.Append("\">");
! 				if( nm1.Length() != 0)
! 					bstr.AppendBSTR( nm1);
! 				else
! 					bstr.Append("emptyname");
! 
! 				bstr.Append("</A>: member not found in 2nd step. ");
! 				bstr.Append("Search path used: ");
! 				bstr.Append( makeViewable( *member_it).c_str());
! 
! 				if( m_GME) COMTHROW( m_GME->ConsoleMessage(bstr, MSG_ERROR));
! 			}
  		}
  	}
! }
! 
! /*static*/ bool CMgaParser::isEmptySet( CComObjPtr<IMgaFCO>& fco)
! {
! 	bool empty = false;
! 	CComObjPtr<IMgaSet> t_set;
! 	if( fco) 
! 	{
! 		COMTHROW( fco.QueryInterface( t_set));
! 		if( t_set) 
! 		{
! 			CComObjPtrVector<IMgaFCO> mems;
! 			COMTHROW( t_set->get_Members( PutOut( mems)));
! 			if( mems.size() == 0) empty = true;
! 		}
! 	}
! 	return empty;
! }
! 
! /*static*/ bool CMgaParser::isNullRef( CComObjPtr<IMgaFCO>& fco)
! {
! 	bool null = false;
! 	CComObjPtr<IMgaReference> t_ref;
! 	ASSERT( fco);
! 	if( fco)
! 	{
! 		COMTHROW( fco.QueryInterface( t_ref));
! 		if( t_ref) 
! 		{
! 			CComObjPtr<IMgaFCO> referred;
! 			COMTHROW( t_ref->get_Referred( PutOut(referred)));
! 			if( !referred) null = true;
! 		}
! 	}
! 	return null;
! }

Index: MgaDumper.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/MgaDumper.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** MgaDumper.cpp	9 May 2005 17:42:26 -0000	1.25
--- MgaDumper.cpp	19 Jul 2005 17:29:52 -0000	1.26
***************
*** 514,518 ****
  	{
  		// "closurename"
! 		CComBSTR path;
  		COMTHROW( folder->get_AbsPath( &path));
  		std::string rel_path, abs_path;
--- 514,518 ----
  	{
  		// "closurename"
! 		/*CComBSTR path;
  		COMTHROW( folder->get_AbsPath( &path));
  		std::string rel_path, abs_path;
***************
*** 537,541 ****
  			place2path = place2path.substr(0, pp);
  
! 		Attr( "closurepath", place2path);
  	}
  
--- 537,558 ----
  			place2path = place2path.substr(0, pp);
  
! 		Attr( "closurepath", place2path);*/ // commented out when introduced new smart copy (simple)
! 
! 		// dump	closureguid attribute
! 		CComObjPtr<IMgaRegNode> regnode;
! 		COMTHROW( folder->get_RegistryNode( CComBSTR( GLOBAL_ID_STR), PutOut( regnode)));
! 		long status;
! 		COMTHROW( regnode->get_Status( &status));
! 		if( status == ATTSTATUS_HERE)
! 		{
! 			CComBstrObj guid_str;
! 			COMTHROW( regnode->get_Value( PutOut(guid_str)));
! 			if( guid_str.Length() == 38) // using { 8-4-4-4-12} form
! 				Attr( "closureguid", guid_str);
! 		}
! 
! 
! 		Attr( "closurename", folder, IMgaFolder::get_Name);
! 
  	}
  
***************
*** 717,721 ****
  		{
  			// "closurename"
! 			CComBSTR path;
  			COMTHROW( fco->get_AbsPath( &path));
  			std::string rel_path, abs_path;
--- 734,738 ----
  		{
  			// "closurename"
! 			/*CComBSTR path;
  			COMTHROW( fco->get_AbsPath( &path));
  			std::string rel_path, abs_path;
***************
*** 729,733 ****
  
  			Attr( "closurename", rel_path);//put the attr out only for non initial objects
! 
  			// "closurepath"
  			if( m_currParAbsPath.length() > 0)
--- 746,750 ----
  
  			Attr( "closurename", rel_path);//put the attr out only for non initial objects
! 			
  			// "closurepath"
  			if( m_currParAbsPath.length() > 0)
***************
*** 744,747 ****
--- 761,781 ----
  			else // when is invoked from non-container
  				Attr( "closurepath", ""); // this will mean that always the target_container will be the target
+ 			*/ // commented out when new smart copy introduced (simple)
+ 
+ 			// dump	closureguid attribute
+ 			CComObjPtr<IMgaRegNode> regnode;
+ 			COMTHROW( fco->get_RegistryNode( CComBSTR( GLOBAL_ID_STR), PutOut( regnode)));
+ 			long status;
+ 			COMTHROW( regnode->get_Status( &status));
+ 			if( status == ATTSTATUS_HERE)
+ 			{
+ 				CComBstrObj guid_str;
+ 				COMTHROW( regnode->get_Value( PutOut(guid_str)));
+ 				if( guid_str.Length() == 38) // using { 8-4-4-4-12} form
+ 					Attr( "closureguid", guid_str);
+ 			}
+ 
+ 			Attr( "closurename", fco, IMgaFCO::get_Name);
+ 
  		}
  
***************
*** 1054,1058 ****
  	CComObjPtr<IMgaFCO> base;
  	COMTHROW( reference->get_DerivedFrom(PutOut(base)));
! 	if(base && CheckInClosure(base)) {
  		short stat;
  		COMTHROW( reference->CompareToBase(&stat));
--- 1088,1093 ----
  	CComObjPtr<IMgaFCO> base;
  	COMTHROW( reference->get_DerivedFrom(PutOut(base)));
! 	if(base && CheckInClosure(base)
! 		|| base && m_closureDump && m_v2) {
  		short stat;
  		COMTHROW( reference->CompareToBase(&stat));
***************
*** 1077,1081 ****
  	CComObjPtr<IMgaFCO> base;
  	COMTHROW( connection->get_DerivedFrom(PutOut(base)));
! 	if(base && CheckInClosure(base)) {
  		short stat;
  		COMTHROW( connection->CompareToBase(NULL, &stat));
--- 1112,1117 ----
  	CComObjPtr<IMgaFCO> base;
  	COMTHROW( connection->get_DerivedFrom(PutOut(base)));
! 	if(base && CheckInClosure(base)
! 		|| base && m_closureDump && m_v2) {
  		short stat;
  		COMTHROW( connection->CompareToBase(NULL, &stat));
***************
*** 1103,1107 ****
  	CComObjPtr<IMgaFCO> base;
  	COMTHROW( set->get_DerivedFrom(PutOut(base)));
! 	if(base && CheckInClosure(base)) {
  		short stat;
  		COMTHROW( set->CompareToBase(&stat));
--- 1139,1144 ----
  	CComObjPtr<IMgaFCO> base;
  	COMTHROW( set->get_DerivedFrom(PutOut(base)));
! 	if(base && CheckInClosure(base)
! 		|| base && m_closureDump && m_v2) {
  		short stat;
  		COMTHROW( set->CompareToBase(&stat));
***************
*** 1153,1157 ****
  	CComObjPtr<IMgaFCO> base;
  	COMTHROW( conn->get_DerivedFrom(PutOut(base)));
! 	if(base && CheckInClosure(base)) {
  		short stat;
  		COMTHROW( conn->CompareToBase(connpoint, &stat));
--- 1190,1195 ----
  	CComObjPtr<IMgaFCO> base;
  	COMTHROW( conn->get_DerivedFrom(PutOut(base)));
! 	if(base && CheckInClosure(base)
! 		|| base && m_closureDump && m_v2) {
  		short stat;
  		COMTHROW( conn->CompareToBase(connpoint, &stat));



More information about the GME-commit mailing list