[GME-commit] GMESRC/GME/XmlBackEnd CoreXmlFile.cpp, 1.30, 1.31 CoreXmlFile.h, 1.14, 1.15

Log messages of CVS commits gme-commit at list.isis.vanderbilt.edu
Wed Feb 20 13:10:19 CST 2008


Update of /project/gme-repository/GMESRC/GME/XmlBackEnd
In directory escher:/tmp/cvs-serv5371

Modified Files:
	CoreXmlFile.cpp CoreXmlFile.h 
Log Message:
Project file will always be called project.mgx.



CVS User: Zoltan Molnar, ISIS (zolmol)

Index: CoreXmlFile.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/XmlBackEnd/CoreXmlFile.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** CoreXmlFile.cpp	19 Feb 2008 23:39:08 -0000	1.30
--- CoreXmlFile.cpp	20 Feb 2008 19:10:16 -0000	1.31
***************
*** 126,153 ****
  
  /*static*/ const char * CCoreXmlFile::m_contentConst = "contents";
- ///*static*/ const char * CCoreXmlFile::m_dtdFileContent = "\
- //<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
- //<!ENTITY lt     \"&#38;#60;\"> \n\
- //<!ENTITY gt     \"&#62;\"> \n\
- //<!ENTITY amp    \"&#38;#38;\"> \n\
- //<!ENTITY apos   \"&#39;\"> \n\
- //<!ENTITY quot   \"&#34;\">\n\
- //<!ELEMENT Root EMPTY>\n\
- //<!ATTLIST Root\n\
- //	MetaId		CDATA		#IMPLIED\n\
- //	Id		CDATA		#IMPLIED\n\
- //	Name		CDATA		#IMPLIED\n\
- //	CDate		CDATA		#IMPLIED\n\
- //	MDate		CDATA		#IMPLIED\n\
- //	Author		CDATA		#IMPLIED\n\
- //	GUID		CDATA		#IMPLIED\n\
- //	VERSION		CDATA		#IMPLIED\n\
- //	ParadigmGUID		CDATA		#IMPLIED\n\
- //	ParadigmVersion		CDATA		#IMPLIED\n\
- //	ExtParadigm		CDATA		#IMPLIED\n\
- //	Comment		CDATA		#IMPLIED\n\
- //	MGA_Version	CDATA		#IMPLIED\n\
- //>\n\
- //";
  
  bool XmlObjComp::operator()( XmlObject * p1, XmlObject * p2) const
--- 126,129 ----
***************
*** 2138,2147 ****
  	char ext[_MAX_EXT];
  
  	_splitpath( m_folderPath.c_str(), drive, dir, fname, ext );
  
  	if( p_reset)
  	{
! 		// fname will be reset
! 		
  		char                 buf[_MAX_PATH];
  		_finddata_t          fileInfo;
--- 2114,2125 ----
  	char ext[_MAX_EXT];
  
+ 	// a conn string like 'c:\\t\\v\\p' comes in in m_folderPath
+ 	// which is then divided in 'c' as drive, 't\\v' as dir
+ 	// and 'p' as fname (although p is a directory) and '' as ext
  	_splitpath( m_folderPath.c_str(), drive, dir, fname, ext );
  
  	if( p_reset)
  	{
! 		// m_projectFileName will be reset to a valid .mgx filename
  		char                 buf[_MAX_PATH];
  		_finddata_t          fileInfo;
***************
*** 2149,2153 ****
  		sprintf( buf, "%s\\*.mgx", m_folderPath.c_str() );
  
! 		long searchHandle = _findfirst( buf, &fileInfo ); // findfirst
  		long ret = searchHandle;
  		long count = 0;
--- 2127,2131 ----
  		sprintf( buf, "%s\\*.mgx", m_folderPath.c_str() );
  
! 		long searchHandle = _findfirst( buf, &fileInfo ); // findfirst in project dir
  		long ret = searchHandle;
  		long count = 0;
***************
*** 2156,2172 ****
  
  		if( count > 1)
! 			sendMsg( "Multiple .mgx files found in directory " + m_folderPath, MSG_ERROR);
  		else if( count == 0)
! 			sendMsg( "No .mgx files found in directory " + m_folderPath, MSG_ERROR);
  		else
  		{
! 			m_projectName = fileInfo.name; // has the ".mgx"
! 			_findclose( searchHandle );
! 
  			m_projectFileName = m_folderPath;
  			m_projectFileName += "\\";
! 			m_projectFileName += m_projectName;
  
! 			m_projectName = m_projectName.erase( m_projectName.length() - 4); // cut the ".mgx"
  		}
  		return;
--- 2134,2149 ----
  
  		if( count > 1)
! 			sendMsg( "Multiple .mgx files were found in directory " + m_folderPath, MSG_ERROR);
  		else if( count == 0)
! 			sendMsg( "No .mgx file was found in directory " + m_folderPath, MSG_ERROR);
  		else
  		{
! 			// new m_projectFileName value set, a real one
  			m_projectFileName = m_folderPath;
  			m_projectFileName += "\\";
! 			m_projectFileName += fileInfo.name; // m_projectName or m_vssPath or m_parentFolderPath do NOT change
  
! 			sendMsg( "Loading project file: " + m_projectFileName, MSG_INFO);
! 			_findclose( searchHandle );
  		}
  		return;
***************
*** 2178,2192 ****
  		m_parentFolderPath.resize(m_parentFolderPath.size()-1);
  
  	m_projectName = fname;
  
! 	m_cacheFileName = m_folderPath;
! 	m_cacheFileName += "\\";
! 	m_cacheFileName += m_projectName;
! 	m_cacheFileName += ".bin";
  
! 	m_projectFileName = m_folderPath;
! 	m_projectFileName += "\\";
! 	m_projectFileName += m_projectName;
! 	m_projectFileName += ".mgx";
  
  	m_vssPath = m_vssParentPath;
--- 2155,2165 ----
  		m_parentFolderPath.resize(m_parentFolderPath.size()-1);
  
+ 	// this is the name of the project directory : 'p' in the example above
  	m_projectName = fname;
  
! 	m_cacheFileName = m_folderPath + "\\project.bin";
  
! 	// the name of the project file siting in the project dir: 'c:\\t\\u\\p\\project.mgx'
! 	m_projectFileName = m_folderPath + "\\project.mgx";
  
  	m_vssPath = m_vssParentPath;
***************
*** 2195,2232 ****
  }
  
- /*void CCoreXmlFile::setFileNamesOnOpen(BSTR connection)
- {
- std::string conn;
- 
- CopyTo(connection, conn);
- 
- if( !(std::string(conn, 0, 4) == "MGX=") )
- HR_THROW(E_INVALID_USAGE);
- 
- conn.erase(0, 4);
- 
- char drive[_MAX_DRIVE];
- char dir[_MAX_DIR];
- char fname[_MAX_FNAME];
- char ext[_MAX_EXT];
- 
- _splitpath( conn.c_str(), drive, dir, fname, ext );
- 
- m_folderPath = drive;
- m_folderPath += "\\";
- m_folderPath += dir;
- m_folderPath.resize(m_folderPath.size()-1); // remove the ending "\"
- 
- m_cacheFileName = m_folderPath;
- m_cacheFileName += "\\";
- m_cacheFileName += fname;
- m_cacheFileName += ".bin";
- 
- m_projectFileName = m_folderPath;
- m_projectFileName += "\\";
- m_projectFileName += fname;
- m_projectFileName += ".mgx";
- }*/
- 
  void CCoreXmlFile::getContainerFileName(XmlObject * obj, std::string& str, bool fullpath)
  {
--- 2168,2171 ----
***************
*** 3266,3272 ****
  
  	makeSureFileExistsInVerSys( OperatingOptions::m_sysConfName, isSV() ? OperatingOptions::m_sysConfDefContentsSvn : OperatingOptions::m_sysConfDefContentsPlain);
- 
- 
- 	//makeSureFileExistsInVerSys( "xmga.dtd", m_dtdFileContent);
  }
  
--- 3205,3208 ----
***************
*** 3287,3295 ****
  	if( doc == NULL )
  	{
! 		setFileNames( true); // reset the file names
  		doc = parser->parseURI( m_projectFileName.c_str() );
  		if( doc == NULL)
  		{
! 			sendMsg( "Could not find or parse project file " + m_projectFileName, MSG_ERROR);
  			HR_THROW(E_FILEOPEN);
  		}
--- 3223,3235 ----
  	if( doc == NULL )
  	{
! 		//sendMsg( "Could not find or parse project file " + m_projectFileName, MSG_ERROR);
! 		WIN32_FILE_ATTRIBUTE_DATA attr;
! 		bool fexists = GetFileAttributesEx( m_projectFileName.c_str(), GetFileExInfoStandard, &attr );
! 		setFileNames( true); // reset the file name to a newly found one
  		doc = parser->parseURI( m_projectFileName.c_str() );
  		if( doc == NULL)
  		{
! 			if( fexists) sendMsg( "Could not parse project file '" + m_projectFileName + "'!", MSG_ERROR);
! 			else         sendMsg( "Could not find project file '" + m_projectFileName + "' in directory " + m_folderPath, MSG_ERROR);
  			HR_THROW(E_FILEOPEN);
  		}
***************
*** 3358,3376 ****
  		}
  
! 		m_vssUser = m_userOpts.m_useAccountInfo? m_userOpts.m_defUserName.c_str(): userNameFromSvnSshUrl(); // TODO
! 		m_vssPassword = m_userOpts.m_useAccountInfo? m_userOpts.m_defPassword.c_str(): ""; // TODO
  
  		m_sourceControl = SC_SUBVERSION;
  
! 		svnSetup( false);
! 		//getUserCredentialInfo(-1); // fills m_vssUser, m_vssPassword
! 		//svnSshHandling();
! 		//svnOptions();
! 		//createSubversionClientImpl();
! 		//testSubversion();
! 
! 		//m_svn = new HiClient( m_vssUser, m_vssPassword);
! 		//if( !m_svn) AfxMessageBox( "NO SVN CLIENT OBJECT");
! 		//if( !m_svn) throw -1;
  
  		// upon Open, the connection string might not have the full URL in it, so 
--- 3298,3308 ----
  		}
  
! 		m_vssUser = m_userOpts.m_useAccountInfo? m_userOpts.m_defUserName.c_str(): userNameFromSvnSshUrl();
! 		m_vssPassword = m_userOpts.m_useAccountInfo? m_userOpts.m_defPassword.c_str(): "";
  
  		m_sourceControl = SC_SUBVERSION;
  
! 		svnSetup( false); //false => won't throw if cancelled
! 		// fills m_vssUser, m_vssPassword
  
  		// upon Open, the connection string might not have the full URL in it, so 
***************
*** 3503,3512 ****
  		catch(...)
  		{
! 			// TODO:
  		}
  	}
  	catch( hresult_exception& e)
  	{
! 		if( e.hr == E_INVALID_FILENAME) // file could not be opened
  			sendMsg( "Error while saving. Could not open file " + fileName, MSG_ERROR);
  		else
--- 3435,3444 ----
  		catch(...)
  		{
! 			sendMsg( "Failed while adding to version control file: " + fileName, MSG_WARNING);
  		}
  	}
  	catch( hresult_exception& e)
  	{
! 		if( e.hr == E_INVALID_FILENAME) // file could not be opened, thrown by Transcoder::init()
  			sendMsg( "Error while saving. Could not open file " + fileName, MSG_ERROR);
  		else
***************
*** 3542,3547 ****
  
  	bool spec_root = metaToken == "Root"; // or: m_metaid==METAID_ROOT
- 	//if( spec_root) // <!DOCTYPE Root SYSTEM "my.dtd">
- 	//	ofs << "<!DOCTYPE Root SYSTEM \"xmga.dtd\">\n";
  
  	// the multiline case? for details see Mga\MgaGeneric.cpp
--- 3474,3477 ----
***************
*** 4000,4011 ****
  {
  	UnresolvedPointerVec pointers;
- 	//char                 buf[_MAX_PATH];
- 	//_finddata_t          fileInfo;
  
  	// todo: preconditions
  	if( m_userOpts.m_measureTime) 
  	{  
  		sendMsg( std::string( "Loading ") + m_folderPath, MSG_INFO);
  	}
  
  	clearAll();
--- 3930,3943 ----
  {
  	UnresolvedPointerVec pointers;
  
  	// todo: preconditions
+ #ifdef _DEBUG
+ #if(DETAILS_ABOUT_XMLBACKEND)
  	if( m_userOpts.m_measureTime) 
  	{  
  		sendMsg( std::string( "Loading ") + m_folderPath, MSG_INFO);
  	}
+ #endif
+ #endif
  
  	clearAll();
***************
*** 4013,4031 ****
  	loadDirs( m_folderPath, pointers, fullLoad);
  
  	if( m_userOpts.m_measureTime) { sendMsg( "resolvePointers", MSG_INFO); }
! 
  
  	resolvePointers( pointers );
  
! 
  	if( m_userOpts.m_measureTime) { sendMsg( "resetSourceControl", MSG_INFO); }
  
- 
  	_timeb b1, b2;
  	_ftime( &b1);
! 
  
  	resetSourceControlForAll();
  
  	_ftime( &b2);
  
--- 3945,3969 ----
  	loadDirs( m_folderPath, pointers, fullLoad);
  
+ #ifdef _DEBUG
+ #if(DETAILS_ABOUT_XMLBACKEND)
  	if( m_userOpts.m_measureTime) { sendMsg( "resolvePointers", MSG_INFO); }
! #endif
! #endif
  
  	resolvePointers( pointers );
  
! #ifdef _DEBUG
! #if(DETAILS_ABOUT_XMLBACKEND)
  	if( m_userOpts.m_measureTime) { sendMsg( "resetSourceControl", MSG_INFO); }
  
  	_timeb b1, b2;
  	_ftime( &b1);
! #endif
! #endif
  
  	resetSourceControlForAll();
  
+ #ifdef _DEBUG
+ #if(DETAILS_ABOUT_XMLBACKEND)
  	_ftime( &b2);
  
***************
*** 4035,4041 ****
--- 3973,3983 ----
  		sendMsg( std::string( msg_buf), MSG_INFO);
  	}
+ #endif
+ #endif
  
  	if( m_userOpts.m_onLoadShowStatus)
  	{
+ #ifdef _DEBUG
+ #if(DETAILS_ABOUT_XMLBACKEND)
  		if( m_userOpts.m_measureTime) { sendMsg( "updateSourceControlRegnodes begn", MSG_INFO); }
  
***************
*** 4043,4049 ****
  
  		_ftime( &b3);
! 
  		updateSourceControlInfo(); // show current status upon 'OpenProject'
  
  		_ftime( &b4);
  
--- 3985,3994 ----
  
  		_ftime( &b3);
! #endif
! #endif
  		updateSourceControlInfo(); // show current status upon 'OpenProject'
  
+ #ifdef _DEBUG
+ #if(DETAILS_ABOUT_XMLBACKEND)
  		_ftime( &b4);
  
***************
*** 4055,4058 ****
--- 4000,4005 ----
  			sendMsg( std::string( msg_buf), MSG_INFO);
  		}
+ #endif
+ #endif
  	}
  }
***************
*** 5429,5433 ****
  	else if( isSV())
  	{
! 		return m_vssUser; //TODO
  	}
  	else
--- 5376,5380 ----
  	else if( isSV())
  	{
! 		return m_vssUser;
  	}
  	else
***************
*** 6262,6270 ****
  
  	svnSetup( true); // true => strictly requires login data, throws if dlg is canceled
! 	//getUserCredentialInfo(-1); // fills m_vssUser, m_vssPassword
! 	//svnSshHandling();
! 	//svnOptions();
! 	//createSubversionClientImpl();
! 	//testSubversion();
  
  	if( !isVersionedInSVN( m_svnUrl, /*isDir = */true))
--- 6209,6213 ----
  
  	svnSetup( true); // true => strictly requires login data, throws if dlg is canceled
! 	// fills m_vssUser, m_vssPassword
  
  	if( !isVersionedInSVN( m_svnUrl, /*isDir = */true))

Index: CoreXmlFile.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/XmlBackEnd/CoreXmlFile.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** CoreXmlFile.h	19 Feb 2008 23:39:09 -0000	1.14
--- CoreXmlFile.h	20 Feb 2008 19:10:16 -0000	1.15
***************
*** 807,811 ****
  	std::string                     m_contentPath;
  	static const char *             m_contentConst;
- 	//static const char *           m_dtdFileContent;//obsolete?
  	std::string                     m_cacheFileName;
  	std::string                     m_projectFileName;
--- 807,810 ----



More information about the GME-commit mailing list