[GME-commit]
GMESRC/GME/Parser GUIDCreate.cpp,NONE,1.1 GUIDCreate.h,NONE,1.1
MgaDumper.cpp,1.26,1.27 MgaDumper.h,1.14,1.15 MgaParser.h,1.14,1.15
MgaParserClosureHelper.cpp,1.5,1.6 MgaParserSC.cpp,1.7,1.8
Parser.vcproj,1.1,1.2 StdAfx.h,1.4,1.5 mgaclosure.dtd,1.3,1.4
gme-commit at list.isis.vanderbilt.edu
gme-commit at list.isis.vanderbilt.edu
Wed Aug 31 21:48:06 CDT 2005
Update of /project/gme-repository/GMESRC/GME/Parser
In directory escher:/tmp/cvs-serv27096
Modified Files:
MgaDumper.cpp MgaDumper.h MgaParser.h
MgaParserClosureHelper.cpp MgaParserSC.cpp Parser.vcproj
StdAfx.h mgaclosure.dtd
Added Files:
GUIDCreate.cpp GUIDCreate.h
Log Message:
Dumping in case of smartcopied data the guidinfo also.
SmartCopyParse first tried based on guids, then relpaths.
mgaclosure.dtd changed to enable this.
CVS User: Zoltan Molnar, ISIS (zolmol)
Index: Parser.vcproj
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/Parser.vcproj,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Parser.vcproj 26 Jan 2005 17:30:59 -0000 1.1
--- Parser.vcproj 31 Aug 2005 20:48:04 -0000 1.2
***************
*** 221,224 ****
--- 221,227 ----
</File>
<File
+ RelativePath=".\GUIDCreate.cpp">
+ </File>
+ <File
RelativePath="Helper.cpp">
<FileConfiguration
***************
*** 517,520 ****
--- 520,526 ----
<File
RelativePath="GenParser.h">
+ </File>
+ <File
+ RelativePath=".\GUIDCreate.h">
</File>
<File
Index: MgaParserSC.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/MgaParserSC.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** MgaParserSC.cpp 21 Jul 2005 14:32:14 -0000 1.7
--- MgaParserSC.cpp 31 Aug 2005 20:48:04 -0000 1.8
***************
*** 10,13 ****
--- 10,14 ----
#include <list>//slist
#include "helper.h"
+ #include "GUIDcreate.h"
// --------------------------- CMgaParser - copy closure dumped data parsing
***************
*** 162,166 ****
//elementfunc("author", StartNone, EndAuthor),
elementfunc("value", StartNone, EndSCValue),
[...1084 lines suppressed...]
+ {
+ GetCurrent().exstrinfo = "skip"; // might have subelements so skip those as well
+ return;
+ }
+
if( GetByNameX(attributes, "status") == NULL )
{
***************
*** 1471,1475 ****
// when we create the registry node,
// we fill it by an empty string if not inherited or not undefined
! if( status == 0 )
COMTHROW( regnode->put_Value(PutInBstr(GetCurrData())) );
}
--- 1623,1627 ----
// when we create the registry node,
// we fill it by an empty string if not inherited or not undefined
! if( status == 0)
COMTHROW( regnode->put_Value(PutInBstr(GetCurrData())) );
}
Index: MgaParser.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/MgaParser.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** MgaParser.h 21 Jul 2005 14:32:14 -0000 1.14
--- MgaParser.h 31 Aug 2005 20:48:04 -0000 1.15
***************
*** 165,168 ****
--- 165,170 ----
bool findPlaceForElem( const attributes_type &attributes, deriv_type& deriv, CComObjPtr<IMgaFolder>& place_fld, CComObjPtr<IMgaModel>& place_mdl);
+ bool parseConnection( CComObjPtr<IMgaObject> prev, const attributes_type &attributes, CComObjPtr<IMgaFCO>& pFoundSrcObj, CComObjPtr<IMgaFCO>& pFoundDstObj, CComObjPtr<IMgaFCOs>& pFoundSrcRefChain, CComObjPtr<IMgaFCOs>& pFoundDstRefChain);
+ bool findConnectionEnd( CComObjPtr<IMgaObject> prev, const std::string& isbound, const std::string& role, const std::string& targetGUID, const std::string& target, const std::string& refchainGUID, const std::string& refchain, CComObjPtr<IMgaFCO>& pFoundObj, CComObjPtr<IMgaFCOs>& pFoundRefChain);
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);
***************
*** 171,174 ****
--- 173,180 ----
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 findFCOWithRelPathAndGUID( CComObjPtr<IMgaObject> obj_rel_to, const std::string& relpath, const std::string& guid, CComObjPtr<IMgaFCO>& pFoundFco);
+ void findFCOWithGUIDInTree( CComObjPtr<IMgaObject> pParent, const std::string& guid, CComObjPtr<IMgaFCO>& pFoundFCO);
+ void findFCOWithGUID( CComObjPtr<IMgaObject> prev, const std::string& guid, CComObjPtr<IMgaFCO>& pFoundFCO);
+ void stepUpInHierarchy( CComObjPtr<IMgaObject>& pCurrentObj, const std::string& originalPath, CComObjPtr<IMgaObject>& pNewParent, std::string& remainingPath);
static bool isNullRef( CComObjPtr<IMgaFCO>& ref);
***************
*** 229,232 ****
--- 235,239 ----
void StartSCRegNode(const attributes_type &attributes);
void StartSCAttribute(const attributes_type &attributes);
+ void EndSCRegNode();
bool m_mergeAllowed;
Index: StdAfx.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/StdAfx.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** StdAfx.h 19 Jul 2005 17:29:52 -0000 1.4
--- StdAfx.h 31 Aug 2005 20:48:04 -0000 1.5
***************
*** 30,34 ****
#include "CommonStl.h"
#define GLOBAL_ID_STR "guid"
!
typedef IMgaConstraint IMgaMetaConstraint;
typedef IMgaConstraints IMgaMetaConstraints;
--- 30,36 ----
#include "CommonStl.h"
#define GLOBAL_ID_STR "guid"
! #define GLOBAL_ID_LEN 38
! #define PREV_GLOBAL_ID_STR "guid/prev"
! #define PREV_ID_STR "prev"
typedef IMgaConstraint IMgaMetaConstraint;
typedef IMgaConstraints IMgaMetaConstraints;
Index: mgaclosure.dtd
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/mgaclosure.dtd,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** mgaclosure.dtd 19 Jul 2005 17:29:52 -0000 1.3
--- mgaclosure.dtd 31 Aug 2005 20:48:04 -0000 1.4
***************
*** 42,46 ****
closurename CDATA #IMPLIED
closurepath CDATA #IMPLIED
- merge (yes|no) "no"
>
--- 42,45 ----
***************
*** 51,54 ****
--- 50,54 ----
role NMTOKEN #IMPLIED
derivedfrom CDATA #IMPLIED
+ smartDerivedFromGUID CDATA #IMPLIED
closurelibderivedfrom CDATA #IMPLIED
closure2derivedfrom CDATA #IMPLIED
***************
*** 60,64 ****
closurename CDATA #IMPLIED
closurepath CDATA #IMPLIED
- merge (yes|no) "no"
>
--- 60,63 ----
***************
*** 69,72 ****
--- 68,72 ----
role NMTOKEN #IMPLIED
derivedfrom CDATA #IMPLIED
+ smartDerivedFromGUID CDATA #IMPLIED
closurelibderivedfrom CDATA #IMPLIED
closure2derivedfrom CDATA #IMPLIED
***************
*** 77,81 ****
closurename CDATA #IMPLIED
closurepath CDATA #IMPLIED
- merge (yes|no) "no"
>
--- 77,80 ----
***************
*** 86,89 ****
--- 85,89 ----
role NMTOKEN #IMPLIED
derivedfrom CDATA #IMPLIED
+ smartDerivedFromGUID CDATA #IMPLIED
closurelibderivedfrom CDATA #IMPLIED
closure2derivedfrom CDATA #IMPLIED
***************
*** 91,102 ****
isprimary (yes|no) "yes"
referred CDATA #IMPLIED
! closurelibreferred CDATA #IMPLIED
! closure2referred CDATA #IMPLIED
isbound (yes|no) "no"
relid CDATA #IMPLIED
closureguid CDATA #IMPLIED
closurename CDATA #IMPLIED
! closurepath CDATA #IMPLIED
! merge (yes|no) "no"
>
--- 91,102 ----
isprimary (yes|no) "yes"
referred CDATA #IMPLIED
! closurelibreferred CDATA #IMPLIED
! smartReferredGUID CDATA #IMPLIED
! closure2referred CDATA #IMPLIED
isbound (yes|no) "no"
relid CDATA #IMPLIED
closureguid CDATA #IMPLIED
closurename CDATA #IMPLIED
! closurepath CDATA #IMPLIED
>
***************
*** 107,113 ****
role NMTOKEN #IMPLIED
derivedfrom CDATA #IMPLIED
closurelibderivedfrom CDATA #IMPLIED
closure2derivedfrom CDATA #IMPLIED
! closure2members CDATA #IMPLIED
isinstance (yes|no) "no"
isprimary (yes|no) "yes"
--- 107,115 ----
role NMTOKEN #IMPLIED
derivedfrom CDATA #IMPLIED
+ smartDerivedFromGUID CDATA #IMPLIED
closurelibderivedfrom CDATA #IMPLIED
closure2derivedfrom CDATA #IMPLIED
! smartMemberGUIDs CDATA #IMPLIED
! closure2members CDATA #IMPLIED
isinstance (yes|no) "no"
isprimary (yes|no) "yes"
***************
*** 118,122 ****
closurename CDATA #IMPLIED
closurepath CDATA #IMPLIED
- merge (yes|no) "no"
>
--- 120,123 ----
***************
*** 127,130 ****
--- 128,132 ----
role NMTOKEN #IMPLIED
derivedfrom CDATA #IMPLIED
+ smartDerivedFromGUID CDATA #IMPLIED
closurelibderivedfrom CDATA #IMPLIED
closure2derivedfrom CDATA #IMPLIED
***************
*** 135,140 ****
closureguid CDATA #IMPLIED
closurename CDATA #IMPLIED
! closurepath CDATA #IMPLIED
! merge (yes|no) "no"
>
--- 137,153 ----
closureguid CDATA #IMPLIED
closurename CDATA #IMPLIED
! closurepath CDATA #IMPLIED
! smart0Role CDATA #IMPLIED
! smart0TargetGUID CDATA #IMPLIED
! smart0Target CDATA #IMPLIED
! smart0RefChainGUID CDATA #IMPLIED
! smart0RefChain CDATA #IMPLIED
! smart0IsBound CDATA #IMPLIED
! smart1Role CDATA #IMPLIED
! smart1TargetGUID CDATA #IMPLIED
! smart1Target CDATA #IMPLIED
! smart1RefChainGUID CDATA #IMPLIED
! smart1RefChain CDATA #IMPLIED
! smart1IsBound CDATA #IMPLIED
>
--- NEW FILE: GUIDCreate.cpp ---
#include "stdafx.h"
#include "GUIDCreate.h"
#include <stdio.h>
/*static*/ const char * GuidCreate::format_str = "{%08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02X}";
CComBSTR GuidCreate::newGuid()
{
char res[39];
GUID t_guid = GUID_NULL;
::CoCreateGuid(&t_guid);
if (t_guid != GUID_NULL)
{
sprintf( res, format_str,
t_guid.Data1, t_guid.Data2, t_guid.Data3,
t_guid.Data4[0], t_guid.Data4[1], t_guid.Data4[2], t_guid.Data4[3],
t_guid.Data4[4], t_guid.Data4[5], t_guid.Data4[6], t_guid.Data4[7]);
} // else send blank
return CComBSTR(res);
}
Index: MgaDumper.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/MgaDumper.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** MgaDumper.h 13 Jan 2005 21:13:47 -0000 1.14
--- MgaDumper.h 31 Aug 2005 20:48:04 -0000 1.15
***************
*** 194,197 ****
--- 194,200 ----
void DumpConstraints(IMgaObject *object);
void DumpIDRefs(const char *name, CComObjPtrVector<IMgaFCO> &fcos);
+ std::string DumpGUIDRefs( CComObjPtrVector<IMgaFCO>& fcos);
+ std::string DumpMixedGUIDRefs( CComObjPtrVector<IMgaFCO>& fcos);
+ void DumpConnDetails(CComObjPtr<IMgaConnection> connection);
// ------- Sorters
***************
*** 245,251 ****
void putInTerritory( CComObjPtrVector<IMgaFolder>&);
! std::string m_curTopPath; // used for the 'closurename' calc
! std::string m_currAbsPath;
! std::string m_currParAbsPath; // used for 'closurepath' calc
bool m_v2;
--- 248,254 ----
void putInTerritory( CComObjPtrVector<IMgaFolder>&);
! //std::string m_curTopPath; // used for the 'closurename' calc
! std::string m_currAbsPath;//? it is needed any more?
! //std::string m_currParAbsPath; // used for 'closurepath' calc
bool m_v2;
Index: MgaParserClosureHelper.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/MgaParserClosureHelper.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** MgaParserClosureHelper.cpp 21 Jul 2005 14:32:14 -0000 1.5
--- MgaParserClosureHelper.cpp 31 Aug 2005 20:48:04 -0000 1.6
***************
*** 11,14 ****
--- 11,191 ----
#include "helper.h"
+ // goes up in the object hierarchy as indicated by the number of '..'s in 'originalPath' and returns the new parent and remaining path info
+ void CMgaParser::stepUpInHierarchy( CComObjPtr<IMgaObject>& pCurrentObj, const std::string& originalPath, CComObjPtr<IMgaObject>& pNewParent, std::string& remainingPath)
+ {
+ CComObjPtr<IMgaFCO> cur_fco;
+ CComObjPtr<IMgaFolder> cur_fld;
+
+ pCurrentObj.QueryInterface( cur_fco);
+ pCurrentObj.QueryInterface( cur_fld);
+
+ bool isfco = (cur_fco != NULL);
+
+ std::string m = originalPath;
+
+ while( m.substr(0,4) == "/@..")
+ {
+ CComObjPtr<IMgaModel> mod;
+ if( isfco) COMTHROW( cur_fco->get_ParentModel( PutOut( mod)) );
+
+ if ( mod) // has a valid model parent
+ {
+ cur_fco = mod;
+ }
+ else // must have folder parent
+ {
+ CComObjPtr<IMgaFolder> fold;
+
+ if( isfco) COMTHROW( cur_fco->get_ParentFolder( PutOut( fold)) );
+ else COMTHROW( cur_fld->get_ParentFolder( PutOut( fold)) );
+
+ if ( fold)
+ {
+ isfco = false;
+ cur_fld = fold;
+ }
+ else // rootfolder reached: wrong path information
+ {
+ remainingPath = "";
+ return; // pNewParent remains empty
+ }
+ }
+
+ m = m.substr(4);
+ }
+
+ // no more '..' strings in the originalPath
+ remainingPath = m;
+ if (isfco && cur_fco) pNewParent = cur_fco;
+ else if( cur_fld) pNewParent = cur_fld;
+ }
+
+ void CMgaParser::findFCOWithRelPathAndGUID( CComObjPtr<IMgaObject> obj_rel_to, const std::string& relpath , const std::string& guid, CComObjPtr<IMgaFCO>& pFoundFCO)
+ {
+ // rel_path gives an indication how much to step up in the hierarchy
+ CComObjPtr<IMgaObject> new_parent;
+ stepUpInHierarchy( obj_rel_to, relpath, new_parent, std::string());
+ if( new_parent) // valid parent
+ findFCOWithGUIDInTree( new_parent, guid, pFoundFCO);
+ }
+
+
+ void CMgaParser::findFCOWithGUID( CComObjPtr<IMgaObject> prev, const std::string& guid, CComObjPtr<IMgaFCO>& pFoundFco)
+ {
+ CComObjPtr<IMgaModel> m;
+ CComObjPtr<IMgaFolder> f;
+ prev.QueryInterface( m);
+ prev.QueryInterface( f);
+ CComObjPtrVector<IMgaFCO> chld;
+
+ if( m)
+ COMTHROW( m->get_ChildFCOs( PutOut( chld)));
+ else if (f)
+ COMTHROW( f->get_ChildFCOs( PutOut( chld)));
+
+ for( unsigned int i = 0; i < chld.size(); ++i)
+ {
+ CComBSTR bstr;
+ COMTHROW( chld[i]->get_RegistryValue( CComBSTR( PREV_GLOBAL_ID_STR), &bstr));
+
+ if( bstr != 0 && bstr.Length() == GLOBAL_ID_LEN) //valid
+ {
+ if( bstr == CComBSTR( guid.c_str()))
+ break;
+ }
+ }
+
+ if( chld.size() > 0 && i < chld.size()) // found
+ pFoundFco = chld[i];
+
+ }
+
+ void CMgaParser::findFCOWithGUIDInTree( CComObjPtr<IMgaObject> pParent, const std::string& guid, CComObjPtr<IMgaFCO>& pFoundFCO)
+ {
+ #if(1)
+ // breadth-first
+ CComObjPtrVector<IMgaObject> queue;
+ unsigned int curr_i = 0;
+ queue.push_back( pParent);
+
+ while( !pFoundFCO && curr_i != queue.size())
+ {
+ CComObjPtr<IMgaFolder> qF;
+ CComObjPtr<IMgaModel> qM;
+ CComObjPtr<IMgaFCO> qfco;
+ queue[curr_i].QueryInterface( qF);
+ queue[curr_i].QueryInterface( qM);
+ queue[curr_i].QueryInterface( qfco);
+
+ // check if the current object has the searched GUID
+ CComBSTR bstr;
+
+ // IMgaObject has no get_RegistryValue property
+ if( qF) COMTHROW( qF->get_RegistryValue( CComBSTR( PREV_GLOBAL_ID_STR), &bstr));
+ else if( qfco) COMTHROW( qfco->get_RegistryValue( CComBSTR( PREV_GLOBAL_ID_STR), &bstr));
+
+ if( bstr != 0 && bstr.Length() == GLOBAL_ID_LEN && bstr == CComBSTR( guid.c_str())) //valid and equal
+ queue[curr_i].QueryInterface( pFoundFCO); // found if succeeds
+
+ CComObjPtrVector<IMgaFCO> chld;
+
+ // in case Folder or Model put some new children into the queue
+ if( qF)
+ {
+ CComObjPtrVector<IMgaFolder> fols;
+ COMTHROW( qF->get_ChildFolders( PutOut( fols)));
+ // append the children folders to the end of queue
+ queue.insert( queue.end(), fols.begin(), fols.end());
+
+ COMTHROW( qF->get_ChildFCOs( PutOut( chld)));
+ }
+ else if ( qM) COMTHROW( qM->get_ChildFCOs( PutOut( chld)));
+
+ // append the children fcos to the end of queue
+ queue.insert( queue.end(), chld.begin(), chld.end());
+
+ ++curr_i;
+ }
+
+ #else // depth first
+ CComObjPtr<IMgaFolder> f;
+ CComObjPtr<IMgaModel> m;
+ pParent.QueryInterface( m);
+ pParent.QueryInterface( f);
+
+ CComObjPtrVector<IMgaFCO> chld;
+ CComObjPtrVector<IMgaFolder> fols;
+
+ if( m)
+ COMTHROW( m->get_ChildFCOs( PutOut( chld)));
+ else if (f)
+ {
+ COMTHROW( f->get_ChildFCOs( PutOut( chld)));
+ COMTHROW( f->get_ChildFolders( PutOut( fols)));
+
+ }
+
+ CComBSTR bstr;
+ // perform a depth-first search
+ for( unsigned int i = 0; !pFoundFCO && i < chld.size(); ++i)
+ {
+ bstr.Empty();
+ COMTHROW( chld[i]->get_RegistryValue( CComBSTR( PREV_GLOBAL_ID_STR), &bstr));
+
+ if( bstr != 0 && bstr.Length() == GLOBAL_ID_LEN && bstr == CComBSTR( guid.c_str())) //valid and equal
+ {
+ pFoundFCO = chld[i]; // found
+ }
+ }
+
+ // if not found invoke search for children as well
+ for( unsigned int i = 0; !pFoundFCO && i < chld.size(); ++i)
+ findFCOWithGUIDInTree( CComObjPtr<IMgaObject>( chld[i]), guid, pFoundFCO);
+ for( unsigned int i = 0; !pFoundFCO && i < fols.size(); ++i)
+ findFCOWithGUIDInTree( CComObjPtr<IMgaObject>( fols[i]), guid, pFoundFCO);
+ #endif
+ }
+
+
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)
{
***************
*** 20,24 ****
std::string id_in_clipdata = GetByName(p_attributes, "closureguid"); // guid
! ASSERT( id_in_clipdata.length() == 38);
bool found = false;
--- 197,201 ----
std::string id_in_clipdata = GetByName(p_attributes, "closureguid"); // guid
! ASSERT( id_in_clipdata.length() == GLOBAL_ID_LEN);
bool found = false;
***************
*** 28,32 ****
CComBSTR bstr;
CComObjPtr<IMgaFCO> i = *it;
! COMTHROW( i->get_RegistryValue( CComBSTR(GLOBAL_ID_STR), &bstr));
if( bstr == id_in_clipdata.c_str())
{
--- 205,209 ----
CComBSTR bstr;
CComObjPtr<IMgaFCO> i = *it;
! COMTHROW( i->get_RegistryValue( CComBSTR(PREV_GLOBAL_ID_STR), &bstr));
if( bstr == id_in_clipdata.c_str())
{
***************
*** 142,146 ****
std::string id_in_clipdata = GetByName(p_attributes, "closureguid");
! ASSERT( id_in_clipdata.length() == 38);
bool found = false;
--- 319,323 ----
std::string id_in_clipdata = GetByName(p_attributes, "closureguid");
! ASSERT( id_in_clipdata.length() == GLOBAL_ID_LEN);
bool found = false;
***************
*** 150,154 ****
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)));
--- 327,331 ----
CComBSTR bstr;
CComObjPtr<IMgaFolder> i = *it;
! COMTHROW( i->get_RegistryValue( CComBSTR(PREV_GLOBAL_ID_STR), &bstr));
CComObjPtr<IMgaMetaFolder> i_metaf;
COMTHROW( i->get_MetaFolder( PutOut( i_metaf)));
Index: MgaDumper.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Parser/MgaDumper.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** MgaDumper.cpp 19 Jul 2005 17:29:52 -0000 1.26
--- MgaDumper.cpp 31 Aug 2005 20:48:04 -0000 1.27
***************
*** 513,542 ****
if( m_closureDump && m_v2)
{
- // "closurename"
- /*CComBSTR path;
- COMTHROW( folder->get_AbsPath( &path));
- std::string rel_path, abs_path;
- CopyTo( path, abs_path);
- rel_path = abs_path;
-
- if( rel_path.substr(0, m_curTopPath.length()) == m_curTopPath)
- rel_path = rel_path.substr( m_curTopPath.length());
- else
- ASSERT(0);
-
- Attr( "closurename", rel_path);
-
- // "closurepath"
- std::string place2path = abs_path.substr( m_currParAbsPath.length());
- int pp = place2path.length() - 1;
- while( pp >= 0 && place2path[pp] != '/') --pp;
-
- if( pp == -1 || pp == 0)
- place2path = "";
- else
- place2path = place2path.substr(0, pp);
-
- Attr( "closurepath", place2path);*/ // commented out when introduced new smart copy (simple)
-
// dump closureguid attribute
CComObjPtr<IMgaRegNode> regnode;
--- 513,516 ----
***************
*** 548,552 ****
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);
}
--- 522,526 ----
CComBstrObj guid_str;
COMTHROW( regnode->get_Value( PutOut(guid_str)));
! if( guid_str.Length() == GLOBAL_ID_LEN) // using { 8-4-4-4-12} form
Attr( "closureguid", guid_str);
}
***************
*** 733,778 ****
if( m_closureDump && m_v2)
{
- // "closurename"
- /*CComBSTR path;
- COMTHROW( fco->get_AbsPath( &path));
- std::string rel_path, abs_path;
- CopyTo( path, abs_path);
- rel_path = abs_path;
-
- if( rel_path.substr(0, m_curTopPath.length()) == m_curTopPath)
- rel_path = rel_path.substr( m_curTopPath.length());
- else
- ASSERT(0);
-
- Attr( "closurename", rel_path);//put the attr out only for non initial objects
-
- // "closurepath"
- if( m_currParAbsPath.length() > 0)
- {
- std::string place2path = abs_path.substr( m_currParAbsPath.length());
- int pp = place2path.length() - 1;
- while( pp >= 0 && place2path[pp] != '/') --pp;
- if( pp == -1 || pp == 0)
- place2path = "";
- else
- place2path = place2path.substr(0, pp);
- Attr( "closurepath", place2path);
- }
- 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);
--- 707,715 ----
if( m_closureDump && m_v2)
{
// dump closureguid attribute
! CComBstrObj guid_str; // this form will not create the node if is not present
! COMTHROW( fco->get_RegistryValue( CComBSTR( GLOBAL_ID_STR), PutOut( guid_str)));
! if( guid_str != 0 && guid_str.Length() == GLOBAL_ID_LEN) // using { 8-4-4-4-12} form
! Attr( "closureguid", guid_str);
Attr( "closurename", fco, IMgaFCO::get_Name);
***************
*** 842,845 ****
--- 779,790 ----
}
}
+
+ if( m_v2)
+ {
+ CComBstrObj guid;
+ COMTHROW( derivedfrom->get_RegistryValue( CComBSTR( GLOBAL_ID_STR), PutOut( guid)));
+ if( guid != 0 && guid.Length() == GLOBAL_ID_LEN)
+ Attr( "smartDerivedFromGUID", guid);
+ }
}
if(prim && (dumpversion >= 1) && (!lost_basetype) && m_dumpRelids)
***************
*** 1082,1085 ****
--- 1027,1039 ----
Attr("closure2referred", makeRel( nm, nm2));
}
+
+ // dump guid of fco if m_v2
+ if( m_v2)
+ {
+ CComBstrObj ref_guid;
+ COMTHROW( fco->get_RegistryValue( CComBSTR( GLOBAL_ID_STR), PutOut( ref_guid)));
+ if( ref_guid != 0 && ref_guid.Length() == GLOBAL_ID_LEN) // valid guid
+ Attr( "smartReferredGUID", ref_guid);
+ }
}
}
***************
*** 1122,1125 ****
--- 1076,1082 ----
}
+ if( m_closureDump && m_v2)
+ DumpConnDetails( CComObjPtr<IMgaConnection>( connection));
+
DumpFCO(connection);
***************
*** 1153,1156 ****
--- 1110,1114 ----
CComObjPtrVector<IMgaFCO> members;
COMTHROW( set->get_Members(PutOut(members)) );
+ Sort( &members); // we sort the set members by ID
if( m_closureDump)
***************
*** 1158,1166 ****
CComBSTR name;
COMTHROW( set->get_AbsPath( &name));
! CopyTo( name, m_currAbsPath);
}
! Sort( &members); // we sort the set members by ID
! DumpIDRefs("members", members);
}
--- 1116,1129 ----
CComBSTR name;
COMTHROW( set->get_AbsPath( &name));
! CopyTo( name, m_currAbsPath); // will be used by the DumpIDRefs
!
! if( m_v2)
! {
! std::string memberguids = DumpMixedGUIDRefs( members); // uses m_currAbsPath
! if( !memberguids.empty()) Attr( "smartMemberGUIDs", memberguids);
! }
}
! DumpIDRefs("members", members); // might use m_currAbsPath
}
***************
*** 1205,1209 ****
CComBSTR name;
COMTHROW( conn->get_AbsPath( &name));
! CopyTo( name, m_currAbsPath);
// m_dumpLibraryStubs is true, so the connection to a library element will be dumped with "closurelibtarget" attribute and a dummy! "target" attribute
--- 1168,1172 ----
CComBSTR name;
COMTHROW( conn->get_AbsPath( &name));
! CopyTo( name, m_currAbsPath); // used by DumpIDRefs
// m_dumpLibraryStubs is true, so the connection to a library element will be dumped with "closurelibtarget" attribute and a dummy! "target" attribute
***************
*** 1288,1291 ****
--- 1251,1317 ----
}
}
+ std::string CMgaDumper::DumpGUIDRefs( CComObjPtrVector<IMgaFCO>& fcos)
+ {
+ std::string guidrefs;
+
+ for( CComObjPtrVector<IMgaFCO>::iterator i = fcos.begin(); i != fcos.end(); ++i)
+ {
+ CComBSTR bstr;
+ COMTHROW( (*i)->get_RegistryValue( CComBSTR( GLOBAL_ID_STR), &bstr));
+
+ if( bstr != 0 && bstr.Length() == GLOBAL_ID_LEN)
+ {
+ std::string guid;
+ CopyTo(bstr, guid);
+
+ if( !guidrefs.empty() )
+ guidrefs += ' ';
+
+ guidrefs += guid;
+ }
+ else
+ return ""; // if one guid not found, then all are disregarded
+ }
+
+ return guidrefs;
+ }
+
+ std::string CMgaDumper::DumpMixedGUIDRefs( CComObjPtrVector<IMgaFCO>& fcos)
+ {
+ // this method produces a sequence of the {guid}=path forms
+ //{E200BEEB-34BC-4271-A134-AA5728C38124}\\/@../@module_ref1|kind=module_ref|relpos=0
+ std::string guidrefs;
+
+ for( CComObjPtrVector<IMgaFCO>::iterator i = fcos.begin(); i != fcos.end(); ++i)
+ {
+
+ CComBSTR name;
+ COMTHROW( (*i)->get_AbsPath( &name));
+ std::string nm;
+ CopyTo( name, nm);
+
+ if( !guidrefs.empty() )
+ guidrefs += ' ';
+
+ CComBSTR bstr;
+ COMTHROW( (*i)->get_RegistryValue( CComBSTR( GLOBAL_ID_STR), &bstr));
+
+ if( bstr != 0 && bstr.Length() == GLOBAL_ID_LEN)
+ {
+ std::string guid;
+ CopyTo(bstr, guid);
+
+
+ guidrefs += guid;
+ guidrefs += '\\';
+ }
+ //else
+ // return ""; // if one guid not found, then all are disregarded
+
+ guidrefs += makeRel( nm, m_currAbsPath);
+ }
+
+ return guidrefs;
+ }
//sort the RegNode Vector in place by Name
***************
*** 1692,1696 ****
version_string = "1";
! CopyTo( abspath, m_currParAbsPath);
COMTRY
--- 1718,1722 ----
version_string = "1";
! //CopyTo( abspath, m_currParAbsPath);
COMTRY
***************
*** 1756,1760 ****
// else: a parentless_folder is the rootfolder, so the path = "";
! CopyTo( path, m_curTopPath);// m_curTopPath will be used to dump the relative path in "closurename" attr
Dump( *j);
--- 1782,1786 ----
// else: a parentless_folder is the rootfolder, so the path = "";
! //CopyTo( path, m_curTopPath);// m_curTopPath will be used to dump the relative path in "closurename" attr
Dump( *j);
***************
*** 1780,1784 ****
! CopyTo( path, m_curTopPath);// m_curTopPath will be used to dump the relative path in "closurename" attr
Dump( *i);
--- 1806,1810 ----
! //CopyTo( path, m_curTopPath);// m_curTopPath will be used to dump the relative path in "closurename" attr
Dump( *i);
***************
*** 1795,1796 ****
--- 1821,1918 ----
}
+ void CMgaDumper::DumpConnDetails( CComObjPtr<IMgaConnection> connection)
+ {
+ const char * role_attr [] = { "smart0Role=" , "smart1Role=" };
+ const char * targetGUID_attr [] = { "smart0TargetGUID=" , "smart1TargetGUID=" };
+ const char * target_attr [] = { "smart0Target=" , "smart1Target=" };
+ const char * refchainGUID_attr[]= { "smart0RefChainGUID=" , "smart1RefChainGUID=" };
+ const char * refchain_attr [] = { "smart0RefChain=" , "smart1RefChain=" };
+ const char * isbound_attr [] = { "smart0IsBound=" , "smart1IsBound=" };
+
+ std::string array[2]; // { source_info, destin_info };
+ CComObjPtrVector<IMgaConnPoint> cps;
+ COMTHROW( connection->get_ConnPoints( PutOut( cps)));
+
+ if( 2 == cps.size())
+ {
+ for( unsigned int i = 0; i < cps.size(); ++i)
+ {
+ CComBSTR role_bstr;std::string role_str;
+ COMTHROW( cps[i]->get_ConnRole( &role_bstr));
+ int w = 0; // which?
+ if( role_bstr == CComBSTR("dst")) w = 1; // otherwise will fill arr[0]
+ CopyTo( role_bstr, role_str);
+
+ array[w] += std::string( role_attr[w]) + "\"" + role_str + "\" ";
+
+ CComObjPtr<IMgaFCO> target;
+ COMTHROW( cps[i]->get_Target(PutOut(target)) );
+
+ if( target == NULL )
+ HR_THROW(E_INVALID_MGA);
+
+ CComBSTR guid;
+ COMTHROW( target->get_RegistryValue( CComBSTR(GLOBAL_ID_STR), &guid));
+ if( guid != 0 && guid.Length() == GLOBAL_ID_LEN) // valid
+ {
+ std::string guid_str; CopyTo( guid, guid_str);
+ array[w] += std::string( targetGUID_attr[w]) + "\"" + guid_str + "\" ";
+ }
+
+ CComBSTR nameBstr;
+ COMTHROW( connection->get_AbsPath( &nameBstr));
+ CopyTo( nameBstr, m_currAbsPath); // will be used by the DumpConnPoint also
+
+ nameBstr.Empty();
+ std::string t_name;
+ COMTHROW( target->get_AbsPath( &nameBstr));
+ CopyTo( nameBstr, t_name);
+
+ //Attr("closure2target", makeRel( t_name, m_currAbsPath));
+ std::string relpath_to_end = makeRel( t_name, m_currAbsPath);
+ ASSERT( relpath_to_end.substr(0, 4) == "/@..");
+ // the path to connection end is calculated relative to the connection
+ // so if we cut off the first node, then it will be relative to the container
+ array[w] += std::string( target_attr[w]) + "\"" + relpath_to_end.substr(4) + "\" ";
+
+ CComObjPtrVector<IMgaFCO> refs;
+ COMTHROW( cps[i]->get_References(PutOut(refs)) );
+
+ std::string guidrefs = DumpGUIDRefs( refs);
+ if( !guidrefs.empty()) array[w] += std::string( refchainGUID_attr[w]) + "\"" + guidrefs + "\" ";
+
+ std::string chain;
+ for( CComObjPtrVector<IMgaFCO>::iterator j = refs.begin(); j != refs.end(); ++j)
+ {
+ CComBSTR name;
+ COMTHROW( (*j)->get_AbsPath( &name));
+ std::string nm;
+ CopyTo( name, nm);
+
+ if( !chain.empty() )
+ chain += ' ';
+
+ std::string rel_path_to = makeRel( nm, m_currAbsPath);
+ ASSERT( rel_path_to.substr( 0, 4) == "/@..");
+ // rel path converted from relative to the m_currAbsPath to relative to the container
+ chain += rel_path_to.substr(4);
+ }
+
+ array[w] += std::string( refchain_attr[w]) + "\"" + chain + "\" ";
+
+ CComObjPtr<IMgaFCO> base;
+ COMTHROW( connection->get_DerivedFrom(PutOut(base)));
+ if(base) {
+ short stat;
+ COMTHROW( connection->CompareToBase( cps[i], &stat));
+ if(!stat) {
+ //Attr("isbound", "yes" );
+ array[w] += std::string( isbound_attr[w]) + "\"yes\" ";
+ }
+ }
+ }
+
+ if( !array[0].empty()) ofs << " " << array[0] << " "; //the attr names are already in the string
+ if( !array[1].empty()) ofs << " " << array[1] << " ";
+ }
+ }
--- NEW FILE: GUIDCreate.h ---
#ifndef GUIDCREATE_H
#define GUIDCREATE_H
class GuidCreate
{
public:
static const char * format_str;
static CComBSTR newGuid();
};
#endif //GUIDCREATE_H
More information about the GME-commit
mailing list