1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 10:41:16 +02:00

Unindent print.hh declarations

This commit is contained in:
Rebecca Turner 2023-12-18 10:34:19 -08:00
parent a38e6b9087
commit c9125603a5
No known key found for this signature in database

View file

@ -10,45 +10,47 @@
#include <iostream> #include <iostream>
namespace nix { namespace nix {
/**
* Print a string as a Nix string literal.
*
* Quotes and fairly minimal escaping are added.
*
* @param s The logical string
*/
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 & printLiteralString(std::ostream & o, const std::string & s) {
return printLiteralString(o, std::string_view(s));
}
/** Print `true` or `false`. */ /**
std::ostream & printLiteralBool(std::ostream & o, bool b); * Print a string as a Nix string literal.
*
/** * Quotes and fairly minimal escaping are added.
* Print a string as an attribute name in the Nix expression language syntax. *
* * @param s The logical string
* Prints a quoted string if necessary. */
*/ std::ostream & printLiteralString(std::ostream & o, std::string_view s);
std::ostream & printAttributeName(std::ostream & o, std::string_view s); inline std::ostream & printLiteralString(std::ostream & o, const char * s) {
return printLiteralString(o, std::string_view(s));
/** }
* Returns `true' is a string is a reserved keyword which requires quotation inline std::ostream & printLiteralString(std::ostream & o, const std::string & s) {
* when printing attribute set field names. return printLiteralString(o, std::string_view(s));
*/ }
bool isReservedKeyword(const std::string_view str);
/** Print `true` or `false`. */
/** std::ostream & printLiteralBool(std::ostream & o, bool b);
* Print a string as an identifier in the Nix expression language syntax.
* /**
* FIXME: "identifier" is ambiguous. Identifiers do not have a single * Print a string as an attribute name in the Nix expression language syntax.
* textual representation. They can be used in variable references, *
* let bindings, left-hand sides or attribute names in a select * Prints a quoted string if necessary.
* expression, or something else entirely, like JSON. Use one of the */
* `print*` functions instead. std::ostream & printAttributeName(std::ostream & o, std::string_view s);
*/
std::ostream & printIdentifier(std::ostream & o, std::string_view s); /**
* Returns `true' is a string is a reserved keyword which requires quotation
* when printing attribute set field names.
*/
bool isReservedKeyword(const std::string_view str);
/**
* Print a string as an identifier in the Nix expression language syntax.
*
* FIXME: "identifier" is ambiguous. Identifiers do not have a single
* textual representation. They can be used in variable references,
* let bindings, left-hand sides or attribute names in a select
* expression, or something else entirely, like JSON. Use one of the
* `print*` functions instead.
*/
std::ostream & printIdentifier(std::ostream & o, std::string_view s);
} }