some TODOs solved

This commit is contained in:
vaclavt
2022-02-17 20:41:47 +01:00
parent 2d26c59df6
commit 765f2bc673
6 changed files with 49 additions and 47 deletions

View File

@@ -6,11 +6,11 @@
#include <vector>
std::string
mini_sprintf_format(bool left_align, bool sign, bool space_on_left, bool padding_by_zero, int width, int precision,
int length, char specifier, const MlValue &value) {
std::string mini_sprintf_format(bool left_align, bool sign, bool space_on_left, bool padding_by_zero,
int width, int precision,
int length, char specifier, const MlValue &value) {
std::string s;
std::ostringstream stream_str; // PERF simpler solution..without string stream
std::ostringstream stream_str; // PERF string append should be faster
bool is_positive = false;
if (specifier == 's') {
@@ -47,7 +47,7 @@ mini_sprintf_format(bool left_align, bool sign, bool space_on_left, bool padding
stream_str << std::setprecision(precision);
stream_str << dval;
s = stream_str.str(); // TODO ??
s = stream_str.str();
}
if (width > -1 && s.size() < width) {
@@ -172,7 +172,7 @@ std::string mini_sprintf(const std::string &format_str, const std::vector<MlValu
// specifier
if (si >= format_str.end())
return output_str; // invalid end of string
if (*si == 'i' || *si == 'd' || *si == 'f' || *si == 's' || *si == 'c') { // TODO more specifiers
if (*si == 'i' || *si == 'd' || *si == 'f' || *si == 's' || *si == 'c') { // TODO more specifiers
std::string s = mini_sprintf_format(left_align, sign, space_on_left, padding_by_zero, width,
precision, length, *si, parameters[arg_position]);
arg_position++;