[GME-commit] GMESRC/GME/Mga MgaLibOps.h, 1.9, 1.10 MgaLibOps.cpp, 1.20, 1.21

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Mon Mar 19 13:35:40 CST 2007


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

Modified Files:
	MgaLibOps.h MgaLibOps.cpp 
Log Message:
AttachLibrary and RefreshLibrary are able to process %VAR% style environment variables in Library names.


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: MgaLibOps.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaLibOps.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** MgaLibOps.cpp	8 Mar 2007 19:24:33 -0000	1.20
--- MgaLibOps.cpp	19 Mar 2007 19:35:38 -0000	1.21
***************
*** 336,340 ****
  									   
  void CreateLibraryImage(CMgaProject *mgaproject, LibWorker& lw, CoreObj &libimgroot, bool p_tolerateOldMga, bool *p_ptrIsOldMga, Typedefs::LIBMAP& p_results, Typedefs::LIBVEC& p_dependentLibs, CComBSTR& p_infoMsg) {
! 	CComBSTR connstr = lw.getConnectionStr();
  	CComPtr<IMgaProject> p;
  	PointerFixup fixup;
--- 336,340 ----
  									   
  void CreateLibraryImage(CMgaProject *mgaproject, LibWorker& lw, CoreObj &libimgroot, bool p_tolerateOldMga, bool *p_ptrIsOldMga, Typedefs::LIBMAP& p_results, Typedefs::LIBVEC& p_dependentLibs, CComBSTR& p_infoMsg) {
! 	CComBSTR connstr = lw.getExpandedConnectionStr();
  	CComPtr<IMgaProject> p;
  	PointerFixup fixup;
***************
*** 554,558 ****
  			msg.Append( "optimized ");
  		msg.Append("library image from [");
! 		msg.Append( lw.getConnectionStr());
  		msg.Append("]--");
  		reporter.show( msg, false);
--- 554,558 ----
  			msg.Append( "optimized ");
  		msg.Append("library image from [");
! 		msg.Append( lw.getExpandedConnectionStr());
  		msg.Append("]--");
  		reporter.show( msg, false);
***************
*** 769,773 ****
  				msg.Append( "optimized ");
  			msg.Append("library image from [");
! 			msg.Append( lw.getConnectionStr());
  			msg.Append("]--");
  			reporter.show( msg, false);
--- 769,773 ----
  				msg.Append( "optimized ");
  			msg.Append("library image from [");
! 			msg.Append( lw.getExpandedConnectionStr());
  			msg.Append("]--");
  			reporter.show( msg, false);
***************
*** 1010,1013 ****
--- 1010,1036 ----
  {
  	return m_libName;
+ }
+ 
+ CComBSTR LibWorker::getExpandedConnectionStr() const
+ {	// the environment variable (if found) is replaced with its value
+ 	CComBSTR r;
+ 	std::string v;
+ 	CopyTo( m_libName, v);
+ 
+ 	// replacing the found environment variable, %Name% syntax used
+ 	unsigned int pos = v.find( '%');
+ 	if( pos != std::string::npos) // found
+ 	{
+ 		unsigned int npos = v.find( '%', pos + 1); //next occurence of '%'
+ 		if( npos != -1 && npos > pos + 1)
+ 		{
+ 			// get the value of the environment variable between the two %'s
+ 			char *value = getenv( v.substr( pos + 1, npos - pos - 1).c_str());
+ 			v.replace( pos, npos - pos + 1, value);
+ 		}
+ 	}
+ 
+ 	CopyTo( v, &r);
+ 	return r;
  }
  

Index: MgaLibOps.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaLibOps.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** MgaLibOps.h	8 Mar 2007 19:24:33 -0000	1.9
--- MgaLibOps.h	19 Mar 2007 19:35:38 -0000	1.10
***************
*** 522,525 ****
--- 522,526 ----
  	bool          isOptimized() const;
  	CComBSTR      getConnectionStr() const;
+ 	CComBSTR      getExpandedConnectionStr() const;
  
  	void flatten( CoreObj&     p_rootfolder



More information about the GME-commit mailing list