Commit bebbec17 authored by Alexander Lapshin's avatar Alexander Lapshin

.

parent 0dccb7d4
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include <string> #include <string>
#include <map> #include <map>
#include <list> #include <list>
#include "stdio.h" #include <stdio.h>
#include <iomanip> #include <iomanip>
#include "Converter.h" #include "Converter.h"
#include "MException.h" #include "MException.h"
...@@ -15,21 +15,27 @@ ...@@ -15,21 +15,27 @@
#define SPACES " \t\r\n" #define SPACES " \t\r\n"
static std::string ToStr(int arg) static std::string ToStr(const int arg, const int leading_zeros = 0)
{ {
std::ostringstream ss; std::ostringstream ss;
if(leading_zeros) {
ss << std::setw(leading_zeros) << std::setfill('0');
}
ss << arg; ss << arg;
return ss.str(); return ss.str();
} }
static std::string ToStr(size_t arg) static std::string ToStr(const size_t arg, const int leading_zeros = 0)
{ {
std::ostringstream ss; std::ostringstream ss;
if (leading_zeros) {
ss << std::setw(leading_zeros) << std::setfill('0');
}
ss << arg; ss << arg;
return ss.str(); return ss.str();
} }
static std::string ToStr(double arg) static std::string ToStr(const double arg)
{ {
std::ostringstream ss; std::ostringstream ss;
ss << arg; ss << arg;
...@@ -37,7 +43,7 @@ static std::string ToStr(double arg) ...@@ -37,7 +43,7 @@ static std::string ToStr(double arg)
} }
static std::string ToStr(double value, int precision) static std::string ToStr(const double value, const int precision)
{ {
std::ostringstream ss; std::ostringstream ss;
ss << std::setprecision(precision); ss << std::setprecision(precision);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment