[GME-commit] GMESRC/GME/Mga MgaCheck.cpp,1.7,1.8 MgaComplexOps.cpp,1.15,1.16 MgaFCO.cpp,1.34,1.35 MgaFCO.h,1.25,1.26 MgaGeneric.h,1.8,1.9

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


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

Modified Files:
	MgaCheck.cpp MgaComplexOps.cpp MgaFCO.cpp MgaFCO.h 
	MgaGeneric.h 
Log Message:
Read-only flag can be applied on a IMgaObject.


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: MgaComplexOps.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaComplexOps.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** MgaComplexOps.cpp	14 Feb 2006 19:55:36 -0000	1.15
--- MgaComplexOps.cpp	13 Mar 2006 19:08:31 -0000	1.16
***************
*** 159,162 ****
--- 159,163 ----
  
  			if(self[ATTRID_PERMISSIONS] & LIBRARY_FLAG) COMTHROW(E_MGA_OP_REFUSED);
+ 			if(self[ATTRID_PERMISSIONS] & READONLY_FLAG) COMTHROW(E_MGA_OP_REFUSED);
  			// check for non-primary deerived
  			if(self[ATTRID_RELID] >= RELIDSPACE) COMTHROW(E_MGA_OP_REFUSED);
***************
*** 1243,1246 ****
--- 1244,1248 ----
  				CoreObj curp = cur[ATTRID_FCOPARENT];
  				if(!COM_EQUAL(curp, self)) {
+ 					ObjForCore(curp)->CheckWrite(); // parent of cur will change, so check for WRITE permission
  					CoreObjMark(curp, OBJEVENT_LOSTCHILD);
  					assignnewchild(cur);

Index: MgaGeneric.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaGeneric.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** MgaGeneric.h	19 Jul 2004 07:01:00 -0000	1.8
--- MgaGeneric.h	13 Mar 2006 19:08:31 -0000	1.9
***************
*** 119,123 ****
  #define LIBRARY_FLAG 2 
  #define LIBROOT_FLAG 4 
! #define EXEMPT_FLAG 8 
  
  
--- 119,124 ----
  #define LIBRARY_FLAG 2 
  #define LIBROOT_FLAG 4 
! #define EXEMPT_FLAG 8
! #define READONLY_FLAG 16
  
  

Index: MgaFCO.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaFCO.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** MgaFCO.cpp	26 Jan 2005 17:30:47 -0000	1.34
--- MgaFCO.cpp	13 Mar 2006 19:08:31 -0000	1.35
***************
*** 95,98 ****
--- 95,99 ----
  		if(mgaproject->read_only) COMTHROW(E_MGA_READ_ONLY_ACCESS);
  		if(self[ATTRID_PERMISSIONS] & LIBRARY_FLAG) COMTHROW(E_MGA_LIBOBJECT);
+ 		if(self[ATTRID_PERMISSIONS] & READONLY_FLAG) COMTHROW(E_MGA_READ_ONLY_ACCESS);
  }
  

Index: MgaFCO.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaFCO.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** MgaFCO.h	28 Nov 2005 22:09:15 -0000	1.25
--- MgaFCO.h	13 Mar 2006 19:08:31 -0000	1.26
***************
*** 146,149 ****
--- 146,156 ----
   STDMETHOD(get_Exempt)(VARIANT_BOOL *pVal) { return inFCO->get_Exempt(pVal); }
  
+  STDMETHOD(PutReadOnlyAccessWithPropagate)( VARIANT_BOOL pReadOnly)
+ 								{ return inFCO->PutReadOnlyAccessWithPropagate( pReadOnly); }
+  STDMETHOD(PutReadOnlyAccess)( VARIANT_BOOL pReadOnly)
+ 								{ return inFCO->PutReadOnlyAccess( pReadOnly); }
+  STDMETHOD(HasReadOnlyAccess)( VARIANT_BOOL *pReadOnly)
+ 								{ return inFCO->HasReadOnlyAccess( pReadOnly); }
+ 
   STDMETHOD(get_ChildObjects)(IMgaObjects **pVal) 
  								{ return inFCO->get_ChildObjects(pVal); }
***************
*** 160,165 ****
   STDMETHOD(GetNthObjectByPathDisp)(long n_th, BSTR path, IMgaObject **pVal) 
  								{ return inFCO->get_NthObjectByPath(n_th, path, pVal); }
! 
! 
   STDMETHOD(get_MetaRole)( IMgaMetaRole **pVal)		{ return inFCO->get_MetaRole(pVal); }
  
--- 167,171 ----
   STDMETHOD(GetNthObjectByPathDisp)(long n_th, BSTR path, IMgaObject **pVal) 
  								{ return inFCO->get_NthObjectByPath(n_th, path, pVal); }
!  
   STDMETHOD(get_MetaRole)( IMgaMetaRole **pVal)		{ return inFCO->get_MetaRole(pVal); }
  
***************
*** 379,382 ****
--- 385,391 ----
  	HRESULT put_Exempt(VARIANT_BOOL newVal);
   	HRESULT get_Exempt(VARIANT_BOOL *pVal);
+ 	HRESULT PutReadOnlyAccessWithPropagate( VARIANT_BOOL pReadOnly);
+ 	HRESULT PutReadOnlyAccess( VARIANT_BOOL pReadOnly);
+ 	HRESULT HasReadOnlyAccess( VARIANT_BOOL *pReadOnly);
  
   	HRESULT get_ChildObjects(IMgaObjects **pVal);

Index: MgaCheck.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaCheck.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** MgaCheck.cpp	26 Jan 2005 17:30:46 -0000	1.7
--- MgaCheck.cpp	13 Mar 2006 19:08:31 -0000	1.8
***************
*** 352,353 ****
--- 352,407 ----
  	} COMCATCH(;);
  }
+ 
+ void change_mode( CoreObj& obj, bool ro)
+ {
+ 	if( ro)
+ 		obj[ATTRID_PERMISSIONS] = obj[ATTRID_PERMISSIONS] | READONLY_FLAG;
+ 	else
+ 		obj[ATTRID_PERMISSIONS] = obj[ATTRID_PERMISSIONS] & ~READONLY_FLAG;
+ }
+ 
+ void change_mode_rec( CoreObj& obj, bool ro)
+ {
+ 	change_mode( obj, ro);
+ 
+ 	if( obj.IsContainer())
+ 	{
+ 		ITERATE_THROUGH(obj[ATTRID_FCOPARENT+ATTRID_COLLECTION]) 
+ 		{
+ 			change_mode_rec( ITER, ro);
+ 		}
+ 	}
+ }
+ 
+ HRESULT FCO::PutReadOnlyAccess( VARIANT_BOOL pReadOnly)
+ {
+ 	COMTRY_IN_TRANSACTION {
+ 		CHECK_INBOOLPAR(pReadOnly);
+ 
+ 		change_mode( self, pReadOnly);
+ 		COMTHROW(Check());
+ 
+ 		SelfMark(OBJEVENT_PROPERTIES);
+ 	} COMCATCH_IN_TRANSACTION(;);
+ }
+ 
+ HRESULT FCO::PutReadOnlyAccessWithPropagate( VARIANT_BOOL pReadOnly)
+ {
+ 	COMTRY_IN_TRANSACTION {
+ 		CHECK_INBOOLPAR(pReadOnly);
+ 
+ 		change_mode_rec( self, pReadOnly);
+ 		COMTHROW(Check());
+ 
+ 		SelfMark(OBJEVENT_PROPERTIES);
+ 	} COMCATCH_IN_TRANSACTION(;);
+ }
+ 
+ HRESULT FCO::HasReadOnlyAccess( VARIANT_BOOL *pPtrReadOnly)
+ {
+ 	COMTRY {
+ 		CHECK_OUTPAR(pPtrReadOnly);
+ 		long perm = self[ATTRID_PERMISSIONS];
+ 		*pPtrReadOnly = perm & READONLY_FLAG ? VARIANT_TRUE : VARIANT_FALSE; 
+ 	} COMCATCH(;);
+ }



More information about the GME-commit mailing list