Skip to content
Snippets Groups Projects
Commit 08172e1b authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[BL] Remove unused correctScientificNotation().

This is also untested and not compiled anywhere because of the undefined
macro MSVC.
parent 957f8684
No related branches found
No related tags found
No related merge requests found
...@@ -106,66 +106,3 @@ std::string format(const char* format_str, ... ) ...@@ -106,66 +106,3 @@ std::string format(const char* format_str, ... )
} }
} // end namespace BaseLib } // end namespace BaseLib
#ifdef MSVC
void correctScientificNotation(std::string filename, std::size_t precision)
{
std::ifstream stream;
std::ofstream outputStream;
stream.open(filename.c_str());
std::string tmpFilename = filename + ".tmp";
outputStream.open(tmpFilename.c_str());
if (!stream)
{
WARN("correctScientificNotation: fstream is not open.");
return;
}
std::string line;
// Iterate over lines in stream
while (getline(stream, line))
{
std::string word;
std::istringstream iss(line);
// Iterate over all words in line
while (iss >> word)
{
// Search for e+0
std::size_t exponentPosition = word.find("e+0", precision);
if (exponentPosition == std::string::npos)
// If not found search for e-0
exponentPosition = word.find("e-0", precision);
if (exponentPosition != std::string::npos)
{
std::size_t wordSize = word.size();
std::size_t exponentSize = wordSize - exponentPosition;
if(exponentSize > 4)
{
// Erase the leading zero considering trailing characters
int i = wordSize - 1;
while (!isdigit(word[i]))
--i;
std::size_t erasePos = wordSize - 3 - (wordSize - 1 - i);
std::string eraseString = word.substr(erasePos, 1);
if (eraseString.find("0") != std::string::npos)
word.erase(erasePos, 1);
}
}
outputStream << word << " ";
}
outputStream << "\n";
}
stream.close();
outputStream.close();
remove(filename.c_str());
rename(tmpFilename.c_str(), filename.c_str());
}
#endif
...@@ -90,7 +90,3 @@ std::string const& tostring(std::string const& value); ...@@ -90,7 +90,3 @@ std::string const& tostring(std::string const& value);
std::string format(const char* format_string, ... ); std::string format(const char* format_string, ... );
} // end namespace BaseLib } // end namespace BaseLib
#ifdef MSVC
void correctScientificNotation(std::string filename, std::size_t precision = 0);
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment