-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from sunxfancy/dev
v0.2.1
- Loading branch information
Showing
23 changed files
with
2,586 additions
and
2,288 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,36 @@ | ||
#pragma once | ||
#include "zeroerr/print.h" | ||
|
||
#include <string> | ||
#include <sstream> | ||
#include <string> | ||
|
||
namespace zeroerr | ||
{ | ||
namespace zeroerr { | ||
|
||
template <typename... T> | ||
std::string format(const char* fmt, T... args) { | ||
std::stringstream ss; | ||
bool parse_name = false; | ||
Printer print; | ||
print.isQuoted = false; print.isCompact = true; | ||
print.line_break = ""; | ||
bool parse_name = false; | ||
Printer print; | ||
|
||
print.isQuoted = false; | ||
print.isCompact = true; | ||
print.line_break = ""; | ||
std::string str_args[] = {print(args)...}; | ||
|
||
int j = 0; | ||
for (const char* i = fmt; *i != '\0'; i++) { | ||
switch (*i) | ||
{ | ||
case '{': | ||
parse_name = true; | ||
break; | ||
case '}': | ||
parse_name = false; | ||
ss << str_args[j++]; | ||
break; | ||
default: | ||
if (!parse_name) ss << *i; | ||
break; | ||
switch (*i) { | ||
case '{': parse_name = true; break; | ||
case '}': | ||
parse_name = false; | ||
ss << str_args[j++]; | ||
break; | ||
default: | ||
if (!parse_name) ss << *i; | ||
break; | ||
} | ||
} | ||
return ss.str(); | ||
} | ||
|
||
} // namespace zeroerr | ||
} // namespace zeroerr |
Oops, something went wrong.