ENH: ExpandVariables functions return a char * for convenience

This commit is contained in:
John Biddiscombe 2001-09-01 16:12:52 -04:00
parent 7aa0d0d888
commit 0645a50061
2 changed files with 14 additions and 13 deletions

View File

@ -866,12 +866,12 @@ int cmMakefile::DumpDocumentationToFile(std::ostream& f)
} }
void cmMakefile::ExpandVariablesInString(std::string& source) const const char *cmMakefile::ExpandVariablesInString(std::string& source) const
{ {
this->ExpandVariablesInString(source, false); return this->ExpandVariablesInString(source, false);
} }
void cmMakefile::ExpandVariablesInString(std::string& source, const char *cmMakefile::ExpandVariablesInString(std::string& source,
bool escapeQuotes) const bool escapeQuotes) const
{ {
// This method replaces ${VAR} and @VAR@ where VAR is looked up // This method replaces ${VAR} and @VAR@ where VAR is looked up
@ -885,7 +885,7 @@ void cmMakefile::ExpandVariablesInString(std::string& source,
// nothing needs to be expanded // nothing needs to be expanded
if((markerPos == std::string::npos) || (markerPos >= source.size()-1)) if((markerPos == std::string::npos) || (markerPos >= source.size()-1))
{ {
return; return source.c_str();
} }
// current position // current position
std::string::size_type currentPos =0; // start at 0 std::string::size_type currentPos =0; // start at 0
@ -1009,6 +1009,7 @@ void cmMakefile::ExpandVariablesInString(std::string& source,
} }
result += source.substr(currentPos); // pick up the rest of the string result += source.substr(currentPos); // pick up the rest of the string
source = result; source = result;
return source.c_str();
} }
void cmMakefile::RemoveVariablesInString(std::string& source) const void cmMakefile::RemoveVariablesInString(std::string& source) const

View File

@ -504,8 +504,8 @@ public:
* entry in the m_Definitions map. Also @var@ is * entry in the m_Definitions map. Also @var@ is
* expanded to match autoconf style expansions. * expanded to match autoconf style expansions.
*/ */
void ExpandVariablesInString(std::string& source) const; const char *ExpandVariablesInString(std::string& source) const;
void ExpandVariablesInString(std::string& source, bool escapeQuotes) const; const char *ExpandVariablesInString(std::string& source, bool escapeQuotes) const;
/** /**
* Remove any remaining variables in the string. Anything with ${var} or * Remove any remaining variables in the string. Anything with ${var} or