[GME-commit]
GMESRC/GME/Mga MgaCoreObj.cpp,1.1,1.2 MgaCoreObj.h,1.2,1.3
MgaFolder.cpp,1.23,1.24
gme-commit at list.isis.vanderbilt.edu
gme-commit at list.isis.vanderbilt.edu
Fri Jul 23 17:55:27 CDT 2004
Update of /var/lib/gme/GMESRC/GME/Mga
In directory braindrain:/tmp/cvs-serv12842
Modified Files:
MgaCoreObj.cpp MgaCoreObj.h MgaFolder.cpp
Log Message:
Folder move related bug corrected. Prevents moving a parent folder onto its child.
CVS User: zolmol
Index: MgaCoreObj.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/Mga/MgaCoreObj.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MgaCoreObj.cpp 11 Mar 2002 21:43:00 -0000 1.1
--- MgaCoreObj.cpp 23 Jul 2004 21:55:24 -0000 1.2
***************
*** 81,84 ****
--- 81,99 ----
+ bool IsFolderContained(CoreObj &fold, CoreObj &parentFold, int *level) {
+ CoreObj f = fold;
+ int l = 0;
+ if( !f) return false;
+ ASSERT( !f.IsFCO());
+ while( !COM_EQUAL( f, parentFold)) {
+ if( f.IsRootFolder()) return false;
+ f = f[ ATTRID_FPARENT];
+ ASSERT( !f.IsFCO());
+ l++;
+ }
+ if(level) *level = l;
+ return true;
+ }
+
CoreObj CoreObj::GetMaster(int offset) {
Index: MgaCoreObj.h
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/Mga/MgaCoreObj.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MgaCoreObj.h 9 Apr 2002 22:21:00 -0000 1.2
--- MgaCoreObj.h 23 Jul 2004 21:55:24 -0000 1.3
***************
*** 82,85 ****
--- 82,86 ----
bool IsFCO() const { metaid_type s = GetMetaID(); return s >= DTID_MODEL && s <= DTID_SET; }
bool IsRootFCO() const;
+ bool IsRootFolder() const;
bool IsObject() const { metaid_type s = GetMetaID(); return s >= DTID_MODEL && s <= DTID_FOLDER; }
bool IsSubObject() const { metaid_type s = GetMetaID(); return s >= DTID_FOLDER; }
***************
*** 224,227 ****
--- 225,229 ----
inline bool CoreObj::IsRootFCO() const { return ((*this)[ATTRID_ROLEMETA] == METAREF_NULL); }
+ inline bool CoreObj::IsRootFolder() const { return this->GetMetaID() == DTID_ROOT; }
***************
*** 245,248 ****
--- 247,251 ----
// level is only assigned if return value is true;
bool IsContained(CoreObj &fco, CoreObj &parentFCO, int *level = NULL);
+ bool IsFolderContained(CoreObj &fold, CoreObj &parentFold, int *level = NULL);
// get the derived equivalent of 'objinbase' in 'subtype'
Index: MgaFolder.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/Mga/MgaFolder.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** MgaFolder.cpp 14 Jul 2004 19:30:14 -0000 1.23
--- MgaFolder.cpp 23 Jul 2004 21:55:24 -0000 1.24
***************
*** 179,183 ****
CoreObj curr_parent = cur[ATTRID_FCOPARENT];
!
if( !COM_EQUAL( curr_parent, self)) {
--- 179,183 ----
CoreObj curr_parent = cur[ATTRID_FCOPARENT];
! if( IsFolderContained( self, cur)) COMTHROW(E_MGA_OP_REFUSED);// do not allow moving a parent (grandparent...) into its child
if( !COM_EQUAL( curr_parent, self)) {
More information about the GME-commit
mailing list