Author: mpiulachs Date: Thu Nov 15 21:03:30 2007 New Revision: 30465
URL: http://svn.reactos.org/svn/reactos?rev=30465&view=rev Log: Move ReplaceVariable funtion to the Environment class inset of using 3 copy-pasted versions of this function
Modified: branches/rbuild/reactos/tools/rbuild/bootstrap.cpp branches/rbuild/reactos/tools/rbuild/cdfile.cpp branches/rbuild/reactos/tools/rbuild/project.cpp branches/rbuild/reactos/tools/rbuild/rbuild.h
Modified: branches/rbuild/reactos/tools/rbuild/bootstrap.cpp URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/boot... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/bootstrap.cpp (original) +++ branches/rbuild/reactos/tools/rbuild/bootstrap.cpp Thu Nov 15 21:03:30 2007 @@ -75,17 +75,17 @@ __LINE__ ); }
-string -Bootstrap::ReplaceVariable ( const string& name, - const string& value, - string path ) -{ - size_t i = path.find ( name ); - if ( i != string::npos ) - return path.replace ( i, name.length (), value ); - else - return path; -} +//string +//Bootstrap::ReplaceVariable ( const string& name, +// const string& value, +// string path ) +//{ +// size_t i = path.find ( name ); +// if ( i != string::npos ) +// return path.replace ( i, name.length (), value ); +// else +// return path; +//}
void Bootstrap::Initialize () @@ -99,7 +99,7 @@
const XMLAttribute* att = node.GetAttribute ( "installbase", false ); if ( att != NULL ) - base = ReplaceVariable ( "$(CDOUTPUT)", Environment::GetCdOutputPath (), att->value ); + base = Environment::ReplaceVariable ( "$(CDOUTPUT)", Environment::GetCdOutputPath (), att->value ); else base = "";
Modified: branches/rbuild/reactos/tools/rbuild/cdfile.cpp URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/cdfi... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/cdfile.cpp (original) +++ branches/rbuild/reactos/tools/rbuild/cdfile.cpp Thu Nov 15 21:03:30 2007 @@ -22,29 +22,29 @@
using std::string;
-string -CDFile::ReplaceVariable ( const string& name, - const string& value, - string path ) -{ - size_t i = path.find ( name ); - if ( i != string::npos ) - return path.replace ( i, name.length (), value ); - else - return path; -} - -string -BootstrapFile::ReplaceVariable ( const string& name, - const string& value, - string path ) -{ - size_t i = path.find ( name ); - if ( i != string::npos ) - return path.replace ( i, name.length (), value ); - else - return path; -} +//string +//CDFile::ReplaceVariable ( const string& name, +// const string& value, +// string path ) +//{ +// size_t i = path.find ( name ); +// if ( i != string::npos ) +// return path.replace ( i, name.length (), value ); +// else +// return path; +//} +// +//string +//BootstrapFile::ReplaceVariable ( const string& name, +// const string& value, +// string path ) +//{ +// size_t i = path.find ( name ); +// if ( i != string::npos ) +// return path.replace ( i, name.length (), value ); +// else +// return path; +//}
CDFile::CDFile ( const Project& project, const XMLElement& cdfileNode, @@ -54,7 +54,7 @@ const XMLAttribute* att = cdfileNode.GetAttribute ( "installbase", false ); string target_relative_directory; if ( att != NULL ) - target_relative_directory = ReplaceVariable ( "$(CDOUTPUT)", Environment::GetCdOutputPath (), att->value ); + target_relative_directory = Environment::ReplaceVariable ( "$(CDOUTPUT)", Environment::GetCdOutputPath (), att->value ); else target_relative_directory = "";
@@ -78,7 +78,7 @@ const XMLAttribute* att = cdfileNode.GetAttribute ( "installbase", false ); string target_relative_directory; if ( att != NULL ) - target_relative_directory = ReplaceVariable ( "$(CDOUTPUT)", Environment::GetCdOutputPath (), att->value ); + target_relative_directory = Environment::ReplaceVariable ( "$(CDOUTPUT)", Environment::GetCdOutputPath (), att->value ); else target_relative_directory = "";
Modified: branches/rbuild/reactos/tools/rbuild/project.cpp URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/proj... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/project.cpp (original) +++ branches/rbuild/reactos/tools/rbuild/project.cpp Thu Nov 15 21:03:30 2007 @@ -61,6 +61,18 @@ defaultIntermediate ); }
+string +Environment::ReplaceVariable ( const string& name, + const string& value, + string path ) +{ + size_t i = path.find ( name ); + if ( i != string::npos ) + return path.replace ( i, name.length (), value ); + else + return path; +} + /* static */ string Environment::GetOutputPath () {
Modified: branches/rbuild/reactos/tools/rbuild/rbuild.h URL: http://svn.reactos.org/svn/reactos/branches/rbuild/reactos/tools/rbuild/rbui... ============================================================================== --- branches/rbuild/reactos/tools/rbuild/rbuild.h (original) +++ branches/rbuild/reactos/tools/rbuild/rbuild.h Thu Nov 15 21:03:30 2007 @@ -207,6 +207,9 @@ static std::string GetAutomakeFile ( const std::string& defaultFile ); static std::string GetEnvironmentVariablePathOrDefault ( const std::string& name, const std::string& defaultValue ); + static std::string ReplaceVariable ( const std::string& name, + const std::string& value, + std::string path ); };
@@ -988,9 +991,9 @@ private: bool IsSupportedModuleType ( ModuleType type ); void Initialize(); - static std::string ReplaceVariable ( const std::string& name, - const std::string& value, - std::string path ); + //static std::string ReplaceVariable ( const std::string& name, + // const std::string& value, + // std::string path ); };
@@ -1003,10 +1006,10 @@ CDFile ( const Project& project, const XMLElement& bootstrapNode, const std::string& path ); -private: - static std::string ReplaceVariable ( const std::string& name, - const std::string& value, - std::string path ); +//private: +// static std::string ReplaceVariable ( const std::string& name, +// const std::string& value, +// std::string path ); };
class BootstrapFile : public XmlNode @@ -1018,10 +1021,10 @@ BootstrapFile ( const Project& project, const XMLElement& bootstrapNode, const std::string& path ); -private: - static std::string ReplaceVariable ( const std::string& name, - const std::string& value, - std::string path ); +//private: +// static std::string ReplaceVariable ( const std::string& name, +// const std::string& value, +// std::string path ); };
class InstallFile : public XmlNode