[GME-commit] GMESRC/GME/Mga MgaFolder.cpp,1.20,1.21

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Thu Jun 3 12:17:06 CDT 2004


Update of /var/lib/gme/GMESRC/GME/Mga
In directory braindrain:/tmp/cvs-serv4674

Modified Files:
	MgaFolder.cpp 
Log Message:
Folder copy/move conforms to the paradigm from now on.


CVS User: zolmol

Index: MgaFolder.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/Mga/MgaFolder.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** MgaFolder.cpp	2 Jun 2004 21:43:19 -0000	1.20
--- MgaFolder.cpp	3 Jun 2004 16:17:04 -0000	1.21
***************
*** 64,67 ****
--- 64,69 ----
  				COMTHROW(E_MGA_NOT_CHANGEABLE);
  		}
+ 		else
+ 			ASSERT(0); // where else can a a folder be copied?
  
  // Copy trees
***************
*** 74,91 ****
  			ObjTreeCopyFoldersToo(mgaproject, oldobj, nobjs[i], crealist);  // copy
  			assignnewchild(nobjs[i]);
- 			metaref_type tkind = METAREF_NULL;
- 			if(targettype != DTID_FOLDER) ASSERT(0);
  			
! 			// NO metarole needed, operate with kinds only
! 			CComPtr<IMgaMetaFolder> mf; 
! 			COMTHROW(get_MetaFolder(&mf));
! 			CComQIPtr<IMgaMetaFolder> parentmeta = mf;
! 			if(!parentmeta) COMTHROW(E_MGA_META_INCOMPATIBILITY);
! 			COMTHROW( parentmeta->get_MetaRef(&tkind));
  
! 			if(tkind == METAREF_NULL)  COMTHROW(E_MGA_INVALID_ROLE); //E_MGA_INVALID_KIND ? instead
  
- 			(nobjs[i])[ATTRID_META] = tkind;
  			i++;
  		} MGACOLL_ITERATE_END;
  
--- 76,96 ----
  			ObjTreeCopyFoldersToo(mgaproject, oldobj, nobjs[i], crealist);  // copy
  			assignnewchild(nobjs[i]);
  			
! 			CComPtr<IMgaMetaFolder> meta_of_copied_f; 
! 			COMTHROW( MGACOLL_ITER->get_MetaFolder( &meta_of_copied_f));
  
! 			if( !meta_of_copied_f) 
! 				COMTHROW(E_MGA_META_INCOMPATIBILITY);
! 
! 			metaref_type copied_kind = METAREF_NULL;
! 			COMTHROW( meta_of_copied_f->get_MetaRef( &copied_kind));
! 
! 			if( copied_kind == METAREF_NULL)
! 				COMTHROW(E_MGA_INVALID_ROLE); //E_MGA_INVALID_KIND ? instead
! 			
! 			(nobjs[i])[ATTRID_META] = copied_kind;
  
  			i++;
+ 
  		} MGACOLL_ITERATE_END;
  
***************
*** 129,136 ****
  
  		bool valid = (cnt > 0);
! 		if ( cnt == 1)
  		{
  			valid = false;
- 			// check whether the source folder is the target as well
  			CComPtr<IMgaFolder> mf;
  			MGACOLL_ITERATE( IMgaFolder, movelist) {
--- 134,140 ----
  
  		bool valid = (cnt > 0);
! 		if ( cnt == 1) // check whether the only selected folder is drag-and-dropped onto itself (*this == movelist[0])
  		{
  			valid = false;
  			CComPtr<IMgaFolder> mf;
  			MGACOLL_ITERATE( IMgaFolder, movelist) {
***************
*** 144,148 ****
  
  			if (is_equal == VARIANT_FALSE) // not equal
- 				//COMTHROW( E_MGA_INVALID_ARG); // do not copy/move onto itself
  				valid = true;
  		}
--- 148,151 ----
***************
*** 161,164 ****
--- 164,169 ----
  					COMTHROW(E_MGA_NOT_CHANGEABLE);
  			}
+ 			else
+ 				ASSERT(0); // where else can a a folder be moved?
  
  
***************
*** 183,206 ****
  
  				ObjTreeCollectFoldersToo( mgaproject, cur, moveslist, CHK_MOVED);
- 				metaref_type tkind = METAREF_NULL;
  				
! 				if(targettype != DTID_FOLDER) 
! 					ASSERT(0);
! 
! 				CComPtr<IMgaMetaFolder> mf; 
! 				COMTHROW(get_MetaFolder(&mf));
! 				CComQIPtr<IMgaMetaFolder> parentmeta = mf;
! 
! 				if(!parentmeta) 
! 					COMTHROW(E_MGA_META_INCOMPATIBILITY); // might be optimized by removing the parentmeta
  
! 				COMTHROW( parentmeta->get_MetaRef(&tkind));
  
! 				cur[ATTRID_META];
  
! 				if(tkind == METAREF_NULL)
! 					COMTHROW(E_MGA_INVALID_ROLE);
  				
! 				cur[ATTRID_META] = tkind;
  
  				i++;
--- 188,205 ----
  
  				ObjTreeCollectFoldersToo( mgaproject, cur, moveslist, CHK_MOVED);
  				
! 				CComPtr<IMgaMetaFolder> meta_of_moved_f; 
! 				COMTHROW( MGACOLL_ITER->get_MetaFolder( &meta_of_moved_f));
  
! 				if( !meta_of_moved_f) 
! 					COMTHROW(E_MGA_META_INCOMPATIBILITY);
  
! 				metaref_type moved_kind = METAREF_NULL;
! 				COMTHROW( meta_of_moved_f->get_MetaRef( &moved_kind));
  
! 				if(moved_kind == METAREF_NULL)
! 					COMTHROW(E_MGA_INVALID_ROLE); //E_MGA_INVALID_KIND ? instead
  				
! 				cur[ATTRID_META] = moved_kind;
  
  				i++;
***************
*** 211,217 ****
  			}
  
! 			if(targettype == DTID_FOLDER) {
! 				DeriveMoveds(mgaproject, nobjs, moved_into, cnt, targetlevel);
! 			}
  
  // Reroute references
--- 210,214 ----
  			}
  
! 			DeriveMoveds(mgaproject, nobjs, moved_into, cnt, targetlevel);
  
  // Reroute references
***************
*** 220,224 ****
  			}
  
! 			docheck(mgaproject);
  
  // Assemble return array:
--- 217,221 ----
  			}
  
! 			docheck(mgaproject); // this method check whether the operations are valid
  
  // Assemble return array:



More information about the GME-commit mailing list