mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-27 00:06:16 +02:00
printLiteral: Do not overload
This commit is contained in:
parent
9c74df5bb4
commit
1e2dd669bc
5 changed files with 16 additions and 16 deletions
|
@ -913,13 +913,13 @@ std::ostream & NixRepl::printValue(std::ostream & str, Value & v, unsigned int m
|
|||
|
||||
case nBool:
|
||||
str << ANSI_CYAN;
|
||||
printLiteral(str, v.boolean);
|
||||
printLiteralBool(str, v.boolean);
|
||||
str << ANSI_NORMAL;
|
||||
break;
|
||||
|
||||
case nString:
|
||||
str << ANSI_WARNING;
|
||||
printLiteral(str, v.string.s);
|
||||
printLiteralString(str, v.string.s);
|
||||
str << ANSI_NORMAL;
|
||||
break;
|
||||
|
||||
|
@ -959,7 +959,7 @@ std::ostream & NixRepl::printValue(std::ostream & str, Value & v, unsigned int m
|
|||
if (isVarName(i.first))
|
||||
str << i.first;
|
||||
else
|
||||
printLiteral(str, i.first);
|
||||
printLiteralString(str, i.first);
|
||||
str << " = ";
|
||||
if (seen.count(i.second))
|
||||
str << "«repeated»";
|
||||
|
|
|
@ -105,10 +105,10 @@ void Value::print(const SymbolTable & symbols, std::ostream & str,
|
|||
str << integer;
|
||||
break;
|
||||
case tBool:
|
||||
printLiteral(str, boolean);
|
||||
printLiteralBool(str, boolean);
|
||||
break;
|
||||
case tString:
|
||||
printLiteral(str, string.s);
|
||||
printLiteralString(str, string.s);
|
||||
break;
|
||||
case tPath:
|
||||
str << path; // !!! escaping?
|
||||
|
|
|
@ -74,7 +74,7 @@ std::ostream & operator <<(std::ostream & str, const SymbolStr & symbol)
|
|||
else {
|
||||
char c = s[0];
|
||||
if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_')) {
|
||||
printLiteral(str, s);
|
||||
printLiteralString(str, s);
|
||||
return str;
|
||||
}
|
||||
for (auto c : s)
|
||||
|
@ -82,7 +82,7 @@ std::ostream & operator <<(std::ostream & str, const SymbolStr & symbol)
|
|||
(c >= 'A' && c <= 'Z') ||
|
||||
(c >= '0' && c <= '9') ||
|
||||
c == '_' || c == '\'' || c == '-')) {
|
||||
printLiteral(str, s);
|
||||
printLiteralString(str, s);
|
||||
return str;
|
||||
}
|
||||
str << s;
|
||||
|
@ -107,7 +107,7 @@ void ExprFloat::show(const SymbolTable & symbols, std::ostream & str) const
|
|||
|
||||
void ExprString::show(const SymbolTable & symbols, std::ostream & str) const
|
||||
{
|
||||
printLiteral(str, s);
|
||||
printLiteralString(str, s);
|
||||
}
|
||||
|
||||
void ExprPath::show(const SymbolTable & symbols, std::ostream & str) const
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace nix {
|
||||
|
||||
std::ostream &
|
||||
printLiteral(std::ostream & str, const std::string_view string)
|
||||
printLiteralString(std::ostream & str, const std::string_view string)
|
||||
{
|
||||
str << "\"";
|
||||
for (auto i = string.begin(); i != string.end(); ++i) {
|
||||
|
@ -19,7 +19,7 @@ printLiteral(std::ostream & str, const std::string_view string)
|
|||
}
|
||||
|
||||
std::ostream &
|
||||
printLiteral(std::ostream & str, bool boolean)
|
||||
printLiteralBool(std::ostream & str, bool boolean)
|
||||
{
|
||||
str << (boolean ? "true" : "false");
|
||||
return str;
|
||||
|
|
|
@ -17,14 +17,14 @@ namespace nix {
|
|||
*
|
||||
* @param s The logical string
|
||||
*/
|
||||
std::ostream & printLiteral(std::ostream & o, std::string_view s);
|
||||
inline std::ostream & printLiteral(std::ostream & o, const char * s) {
|
||||
return printLiteral(o, std::string_view(s));
|
||||
std::ostream & printLiteralString(std::ostream & o, std::string_view s);
|
||||
inline std::ostream & printLiteralString(std::ostream & o, const char * s) {
|
||||
return printLiteralString(o, std::string_view(s));
|
||||
}
|
||||
inline std::ostream & printLiteral(std::ostream & o, const std::string & s) {
|
||||
return printLiteral(o, std::string_view(s));
|
||||
inline std::ostream & printLiteralString(std::ostream & o, const std::string & s) {
|
||||
return printLiteralString(o, std::string_view(s));
|
||||
}
|
||||
|
||||
/** Print `true` or `false`. */
|
||||
std::ostream & printLiteral(std::ostream & o, bool b);
|
||||
std::ostream & printLiteralBool(std::ostream & o, bool b);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue