[GME-commit] GMESRC/GME/Parser MgaDumper.cpp,1.27,1.28 MgaParser.cpp,1.31,1.32 MgaParser.h,1.15,1.16 mga.dtd,1.11,1.12

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Mon Mar 13 19:47:26 CST 2006


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

Modified Files:
	MgaDumper.cpp MgaParser.cpp MgaParser.h mga.dtd 
Log Message:
"Perm" flag (permission flag) added to dumper/parser.
Non-mandatory attributed dumped if object is readonly.
If attribute is found by Parser (the value is disregarded actually) the object is made readonly after the object's inner contents have been added (that's why EndObject has been introd.)



CVS User: Zoltan Molnar, ISIS (zolmol)

Index: MgaParser.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/MgaParser.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** MgaParser.cpp	13 Jan 2006 23:17:06 -0000	1.31
--- MgaParser.cpp	13 Mar 2006 19:47:24 -0000	1.32
***************
*** 529,533 ****
  }
  
- 
  CMgaParser::elementfunc CMgaParser::elementfuncs_mga[] = 
  {
--- 529,532 ----
***************
*** 537,550 ****
  	elementfunc("author", StartNone, EndAuthor),
  	elementfunc("value", StartNone, EndValue),
! 	elementfunc("folder", StartFolder, EndNone),
! 	elementfunc("model", StartModel, EndNone),
! 	elementfunc("atom", StartAtom, EndNone),
  	elementfunc("regnode", StartRegNode, EndNone),
  	elementfunc("attribute", StartAttribute, EndNone),
! 	elementfunc("connection", StartConnection, EndNone),
  	elementfunc("connpoint", StartConnPoint, EndNone),
  	elementfunc("constraint", StartNone, EndConstraint),
! 	elementfunc("reference", StartReference, EndNone),
! 	elementfunc("set", StartSet, EndNone),
  	elementfunc("clipboard", StartClipboard, EndNone),
  	elementfunc("", NULL, NULL)
--- 536,549 ----
  	elementfunc("author", StartNone, EndAuthor),
  	elementfunc("value", StartNone, EndValue),
! 	elementfunc("folder", StartFolder, EndObject),
! 	elementfunc("model", StartModel, EndObject),
! 	elementfunc("atom", StartAtom, EndObject),
  	elementfunc("regnode", StartRegNode, EndNone),
  	elementfunc("attribute", StartAttribute, EndNone),
! 	elementfunc("connection", StartConnection, EndObject),
  	elementfunc("connpoint", StartConnPoint, EndNone),
  	elementfunc("constraint", StartNone, EndConstraint),
! 	elementfunc("reference", StartReference, EndObject),
! 	elementfunc("set", StartSet, EndObject),
  	elementfunc("clipboard", StartClipboard, EndNone),
  	elementfunc("", NULL, NULL)
***************
*** 819,826 ****
  	COMTHROW(folder->put_ChildRelIDCounter(crid));
  
  	RegisterLookup(attributes, folder);
  }
  
- 
  void CMgaParser::ResolveDerivation(const attributes_type &attributes, deriv_type &deriv)
  {
--- 818,825 ----
  	COMTHROW(folder->put_ChildRelIDCounter(crid));
  
+ 	RegisterReadOnlyStatus( attributes);
  	RegisterLookup(attributes, folder);
  }
  
  void CMgaParser::ResolveDerivation(const attributes_type &attributes, deriv_type &deriv)
  {
***************
*** 916,919 ****
--- 915,919 ----
  	COMTHROW(CComQIPtr<IMgaModel>(model)->put_ChildRelIDCounter(crid));
  
+ 	RegisterReadOnlyStatus( attributes);
  	RegisterLookup(attributes, model);
  }
***************
*** 989,992 ****
--- 989,993 ----
  	GetCurrent().object = atom;
  
+ 	RegisterReadOnlyStatus( attributes);
  	RegisterLookup(attributes, atom);
  }
***************
*** 1138,1141 ****
--- 1139,1143 ----
  	if( GetByName(attributes, "isbound") == "yes" ) GetCurrent().exstrinfo = "skip";
  
+ 	RegisterReadOnlyStatus( attributes);
  	RegisterLookup(attributes, conn);
  }
***************
*** 1297,1300 ****
--- 1299,1303 ----
  	GetCurrent().object = fco;
  
+ 	RegisterReadOnlyStatus( attributes);
  	RegisterLookup(attributes, fco);
  }
***************
*** 1408,1411 ****
--- 1411,1415 ----
  	GetCurrent().object = fco;
  
+ 	RegisterReadOnlyStatus( attributes);
  	RegisterLookup(attributes, fco);
  }
***************
*** 1584,1586 ****
--- 1588,1619 ----
  
  	return S_OK;
+ }
+ 
+ void CMgaParser::RegisterReadOnlyStatus( const attributes_type &attributes)
+ {
+ 	readonly_stack.push_back( GetByNameX( attributes, "perm") != 0);
+ }
+ 
+ bool CMgaParser::GetIntendedReadOnlyFlag( bool *p_isReadOnly)
+ {
+ 	ASSERT( !readonly_stack.empty());
+ 	if( readonly_stack.empty()) return false;
+ 
+ 	ASSERT( p_isReadOnly);
+ 	*p_isReadOnly = readonly_stack.back();
+ 	readonly_stack.pop_back();
+ 
+ 	return true;
+ }
+ 
+ void CMgaParser::EndObject()
+ {
+ 	bool ro = false; // should be made read only?
+ 	bool re = GetIntendedReadOnlyFlag( &ro); // re: is stack ok?
+ 	if( ro && re)
+ 	{
+ 		CComQIPtr<IMgaObject> obj( GetCurrent().object);
+ 		ASSERT( obj);
+ 		if( obj) COMTHROW( obj->PutReadOnlyAccess( VARIANT_TRUE));
+ 	} // else if( re) stack error
  }

Index: mga.dtd
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/mga.dtd,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** mga.dtd	13 Apr 2005 00:07:05 -0000	1.11
--- mga.dtd	13 Mar 2006 19:47:24 -0000	1.12
***************
*** 39,42 ****
--- 39,43 ----
  	childrelidcntr	CDATA	#IMPLIED
  	libref		CDATA		#IMPLIED
+ 	perm 		CDATA		#IMPLIED
  >
  
***************
*** 51,54 ****
--- 52,56 ----
  	relid		CDATA		#IMPLIED
  	childrelidcntr	CDATA		#IMPLIED
+ 	perm 		CDATA		#IMPLIED
  >
  
***************
*** 62,65 ****
--- 64,68 ----
  	isprimary	(yes|no)	"yes"
  	relid		CDATA		#IMPLIED
+ 	perm 		CDATA		#IMPLIED
  >
  
***************
*** 75,78 ****
--- 78,82 ----
  	isbound		(yes|no)	"no"
  	relid		CDATA		#IMPLIED
+ 	perm 		CDATA		#IMPLIED
  >
  
***************
*** 88,91 ****
--- 92,96 ----
  	isbound		(yes|no)	"no"
  	relid		CDATA		#IMPLIED
+ 	perm 		CDATA		#IMPLIED
  >
  
***************
*** 100,103 ****
--- 105,109 ----
  	isbound		(yes|no)	"no"
  	relid		CDATA		#IMPLIED
+ 	perm 		CDATA		#IMPLIED
  >
  

Index: MgaParser.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/MgaParser.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** MgaParser.h	31 Aug 2005 20:48:04 -0000	1.15
--- MgaParser.h	13 Mar 2006 19:47:24 -0000	1.16
***************
*** 140,143 ****
--- 140,146 ----
  	void RegisterLookup(const attributes_type &attributes, IMgaObject *object);
  
+ 	void RegisterReadOnlyStatus( const attributes_type &attributes);
+ 	bool GetIntendedReadOnlyFlag( bool *p_isReadOnly);
+ 
  	typedef std::hash_map<std::string, CComBstrObj> id_lookup_type;
  	typedef id_lookup_type::iterator id_lookup_iterator;
***************
*** 145,148 ****
--- 148,154 ----
  	id_lookup_type id_lookup;
  
+ 	typedef std::list< bool > readonly_stack_type;
+ 	readonly_stack_type readonly_stack;
+ 
  // ------- Derivation
  
***************
*** 192,195 ****
--- 198,202 ----
  	void preparerelid(const attributes_type &attributes);
  	void assignrelid(IMgaObject *obj);	
+ 
  // ------- Element Handlers
  	
***************
*** 211,214 ****
--- 218,222 ----
  	void StartSet(const attributes_type &attributes);
  	void StartClipboard(const attributes_type &attributes);
+ 	void EndObject();
  
  	void StartProjectInfo(const attributes_type &attributes);

Index: MgaDumper.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/MgaDumper.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** MgaDumper.cpp	31 Aug 2005 20:48:04 -0000	1.27
--- MgaDumper.cpp	13 Mar 2006 19:47:24 -0000	1.28
***************
*** 541,544 ****
--- 541,548 ----
  		COMTHROW( folder->get_LibraryName(PutOut(libname)) );
  		if(libname) Attr("libref",libname);
+ 
+ 		VARIANT_BOOL readonly;
+ 		COMTHROW( folder->HasReadOnlyAccess( &readonly));
+ 		if( readonly) Attr( "perm", "1");
  	}
  
***************
*** 790,793 ****
--- 794,801 ----
  		if(prim && (dumpversion >= 1) && (!lost_basetype) && m_dumpRelids)
  			LAttr("relid", fco, IMgaFCO::get_RelID);
+ 
+ 		VARIANT_BOOL readonly;
+ 		COMTHROW( fco->HasReadOnlyAccess( &readonly));
+ 		if( readonly) Attr( "perm", "1");
  	}
  



More information about the GME-commit mailing list