Preprocessor: Get rid of an unused parameter

This commit is contained in:
Nicolas Le Cam 2009-01-02 00:06:27 +00:00
parent 2e439d8cea
commit 08cd1894ee
3 changed files with 22 additions and 23 deletions

View File

@ -34,7 +34,7 @@ Preprocessor::Preprocessor()
}
/** Just read the code into a string. Perform simple cleanup of the code */
std::string Preprocessor::read(std::istream &istr, const std::string &filename)
std::string Preprocessor::read(std::istream &istr)
{
// Get filedata from stream..
bool ignoreSpace = true;
@ -140,11 +140,11 @@ std::string Preprocessor::read(std::istream &istr, const std::string &filename)
return code.str();
}
void Preprocessor::preprocess(std::istream &istr, std::map<std::string, std::string> &result, const std::string &filename)
void Preprocessor::preprocess(std::istream &istr, std::map<std::string, std::string> &result)
{
std::list<std::string> configs;
std::string data;
preprocess( istr, filename, data, configs );
preprocess( istr, data, configs );
for ( std::list<std::string>::const_iterator it = configs.begin(); it != configs.end(); ++it )
result[ *it ] = Preprocessor::getcode( data, *it );
}
@ -173,9 +173,9 @@ std::string Preprocessor::removeSpaceNearNL( const std::string &str )
return tmp;
}
void Preprocessor::preprocess(std::istream &istr, const std::string &filename, std::string &processedFile, std::list<std::string> &resultConfigurations)
void Preprocessor::preprocess(std::istream &istr, std::string &processedFile, std::list<std::string> &resultConfigurations)
{
processedFile = read(istr, filename);
processedFile = read(istr);
// Replace all tabs with spaces..
std::replace( processedFile.begin(), processedFile.end(), '\t', ' ' );

View File

@ -37,24 +37,23 @@ public:
* \param istr The (file/string) stream to read from.
* \param result The map that will get the results
*/
void preprocess(std::istream &istr, std::map<std::string, std::string> &result, const std::string &filename);
void preprocess(std::istream &istr, std::map<std::string, std::string> &result);
/**
* Extract the code for each configuration. Use this with getcode() to get the
* file data for each individual configuration.
*
* @param istr The (file/string) stream to read from.
* @param filename
* @param processedFile Give reference to empty string as a parameter,
* function will fill processed file here. Use this also as a filedata parameter
* to getcode() if you recieved more than once configurations.
* @param resultConfigurations List of configurations. Pass these one by one
* to getcode() with processedFile.
*/
void preprocess(std::istream &istr, const std::string &filename, std::string &processedFile, std::list<std::string> &resultConfigurations );
void preprocess(std::istream &istr, std::string &processedFile, std::list<std::string> &resultConfigurations );
/** Just read the code into a string. Perform simple cleanup of the code */
std::string read(std::istream &istr, const std::string &filename);
std::string read(std::istream &istr);
/**
* Get preprocessed code for a given configuration

View File

@ -70,7 +70,7 @@ private:
" #aa\t /* remove this */\tb \r\n";
Preprocessor p;
std::istringstream istr(code);
std::string codestr( p.read(istr,"") );
std::string codestr( p.read(istr) );
ASSERT_EQUALS( "a \n#aa b \n", codestr );
}
@ -155,7 +155,7 @@ private:
std::istringstream istr(filedata);
std::map<std::string, std::string> actual;
Preprocessor preprocessor;
preprocessor.preprocess( istr, actual, "" );
preprocessor.preprocess( istr, actual );
// Compare results..
ASSERT_EQUALS( true, cmpmaps(actual, expected));
@ -179,7 +179,7 @@ private:
std::istringstream istr(filedata);
std::map<std::string, std::string> actual;
Preprocessor preprocessor;
preprocessor.preprocess( istr, actual, "" );
preprocessor.preprocess( istr, actual );
// Compare results..
ASSERT_EQUALS( true, cmpmaps(actual, expected));
@ -202,7 +202,7 @@ private:
std::istringstream istr(filedata);
std::map<std::string, std::string> actual;
Preprocessor preprocessor;
preprocessor.preprocess( istr, actual, "" );
preprocessor.preprocess( istr, actual );
// Compare results..
ASSERT_EQUALS( true, cmpmaps(actual, expected));
@ -228,7 +228,7 @@ private:
std::istringstream istr(filedata);
std::map<std::string, std::string> actual;
Preprocessor preprocessor;
preprocessor.preprocess( istr, actual, "" );
preprocessor.preprocess( istr, actual );
// Compare results..
ASSERT_EQUALS( true, cmpmaps(actual, expected));
@ -252,7 +252,7 @@ private:
std::istringstream istr(filedata);
std::map<std::string, std::string> actual;
Preprocessor preprocessor;
preprocessor.preprocess( istr, actual, "" );
preprocessor.preprocess( istr, actual );
// Compare results..
ASSERT_EQUALS( true, cmpmaps(actual, expected));
@ -279,7 +279,7 @@ private:
std::istringstream istr(filedata);
std::map<std::string, std::string> actual;
Preprocessor preprocessor;
preprocessor.preprocess( istr, actual, "" );
preprocessor.preprocess( istr, actual );
// Compare results..
ASSERT_EQUALS( true, cmpmaps(actual, expected));
@ -302,7 +302,7 @@ private:
std::istringstream istr(filedata);
std::map<std::string, std::string> actual;
Preprocessor preprocessor;
preprocessor.preprocess( istr, actual, "" );
preprocessor.preprocess( istr, actual );
// Compare results..
ASSERT_EQUALS( true, cmpmaps(actual, expected));
@ -325,7 +325,7 @@ private:
std::istringstream istr(filedata);
std::map<std::string, std::string> actual;
Preprocessor preprocessor;
preprocessor.preprocess( istr, actual, "" );
preprocessor.preprocess( istr, actual );
// Compare results..
ASSERT_EQUALS( true, cmpmaps(actual, expected));
@ -345,7 +345,7 @@ private:
std::istringstream istr(filedata);
std::map<std::string, std::string> actual;
Preprocessor preprocessor;
preprocessor.preprocess( istr, actual, "" );
preprocessor.preprocess( istr, actual );
// Compare results..
ASSERT_EQUALS( true, cmpmaps(actual, expected));
@ -370,7 +370,7 @@ private:
std::istringstream istr(filedata);
std::map<std::string, std::string> actual;
Preprocessor preprocessor;
preprocessor.preprocess( istr, actual, "" );
preprocessor.preprocess( istr, actual );
// Compare results..
ASSERT_EQUALS( true, cmpmaps(actual, expected));
@ -390,7 +390,7 @@ private:
std::istringstream istr(filedata);
std::map<std::string, std::string> actual;
Preprocessor preprocessor;
preprocessor.preprocess( istr, actual, "" );
preprocessor.preprocess( istr, actual );
// Compare results..
ASSERT_EQUALS( true, cmpmaps(actual, expected));
@ -415,7 +415,7 @@ private:
std::istringstream istr(filedata);
std::map<std::string, std::string> actual;
Preprocessor preprocessor;
preprocessor.preprocess( istr, actual, "" );
preprocessor.preprocess( istr, actual );
// Compare results..
ASSERT_EQUALS( true, cmpmaps(actual, expected));
@ -435,7 +435,7 @@ private:
std::istringstream istr(filedata);
std::map<std::string, std::string> actual;
Preprocessor preprocessor;
preprocessor.preprocess( istr, actual, "" );
preprocessor.preprocess( istr, actual );
// Compare results..
ASSERT_EQUALS( true, cmpmaps(actual, expected));