diff --git a/preprocessor.cpp b/preprocessor.cpp index 3515e9263..fccd362a3 100644 --- a/preprocessor.cpp +++ b/preprocessor.cpp @@ -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 &result, const std::string &filename) +void Preprocessor::preprocess(std::istream &istr, std::map &result) { std::list configs; std::string data; - preprocess( istr, filename, data, configs ); + preprocess( istr, data, configs ); for ( std::list::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 &resultConfigurations) +void Preprocessor::preprocess(std::istream &istr, std::string &processedFile, std::list &resultConfigurations) { - processedFile = read(istr, filename); + processedFile = read(istr); // Replace all tabs with spaces.. std::replace( processedFile.begin(), processedFile.end(), '\t', ' ' ); diff --git a/preprocessor.h b/preprocessor.h index e77620df6..6cf381414 100644 --- a/preprocessor.h +++ b/preprocessor.h @@ -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 &result, const std::string &filename); + void preprocess(std::istream &istr, std::map &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 &resultConfigurations ); + void preprocess(std::istream &istr, std::string &processedFile, std::list &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 diff --git a/testpreprocessor.cpp b/testpreprocessor.cpp index 09cb725ef..2932f99bc 100644 --- a/testpreprocessor.cpp +++ b/testpreprocessor.cpp @@ -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 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 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 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 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 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 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 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 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 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 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 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 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 actual; Preprocessor preprocessor; - preprocessor.preprocess( istr, actual, "" ); + preprocessor.preprocess( istr, actual ); // Compare results.. ASSERT_EQUALS( true, cmpmaps(actual, expected));