xml-writer: Remove std aliases

This commit is contained in:
Eelco Dolstra 2022-02-25 13:39:38 +01:00
parent fd4b693ca2
commit 14b38d0887
3 changed files with 12 additions and 14 deletions

View file

@ -31,11 +31,12 @@ void XMLWriter::close()
void XMLWriter::indent_(size_t depth) void XMLWriter::indent_(size_t depth)
{ {
if (!indent) return; if (!indent) return;
output << string(depth * 2, ' '); output << std::string(depth * 2, ' ');
} }
void XMLWriter::openElement(const string & name, void XMLWriter::openElement(
std::string_view name,
const XMLAttrs & attrs) const XMLAttrs & attrs)
{ {
assert(!closed); assert(!closed);
@ -44,7 +45,7 @@ void XMLWriter::openElement(const string & name,
writeAttrs(attrs); writeAttrs(attrs);
output << ">"; output << ">";
if (indent) output << std::endl; if (indent) output << std::endl;
pendingElems.push_back(name); pendingElems.push_back(std::string(name));
} }
@ -59,7 +60,8 @@ void XMLWriter::closeElement()
} }
void XMLWriter::writeEmptyElement(const string & name, void XMLWriter::writeEmptyElement(
std::string_view name,
const XMLAttrs & attrs) const XMLAttrs & attrs)
{ {
assert(!closed); assert(!closed);

View file

@ -8,12 +8,8 @@
namespace nix { namespace nix {
using std::string;
using std::map;
using std::list;
typedef std::map<std::string, std::string> XMLAttrs;
typedef map<string, string> XMLAttrs;
class XMLWriter class XMLWriter
@ -25,7 +21,7 @@ private:
bool indent; bool indent;
bool closed; bool closed;
list<string> pendingElems; std::list<std::string> pendingElems;
public: public:
@ -34,11 +30,11 @@ public:
void close(); void close();
void openElement(const string & name, void openElement(std::string_view name,
const XMLAttrs & attrs = XMLAttrs()); const XMLAttrs & attrs = XMLAttrs());
void closeElement(); void closeElement();
void writeEmptyElement(const string & name, void writeEmptyElement(std::string_view name,
const XMLAttrs & attrs = XMLAttrs()); const XMLAttrs & attrs = XMLAttrs());
private: private:
@ -53,7 +49,7 @@ class XMLOpenElement
private: private:
XMLWriter & writer; XMLWriter & writer;
public: public:
XMLOpenElement(XMLWriter & writer, const string & name, XMLOpenElement(XMLWriter & writer, std::string_view name,
const XMLAttrs & attrs = XMLAttrs()) const XMLAttrs & attrs = XMLAttrs())
: writer(writer) : writer(writer)
{ {

View file

@ -833,7 +833,7 @@ static bool cmpElemByName(const DrvInfo & a, const DrvInfo & b)
} }
typedef list<Strings> Table; typedef std::list<Strings> Table;
void printTable(Table & table) void printTable(Table & table)