Skip to content

Commit 14b38d0

Browse files
committed
xml-writer: Remove std aliases
1 parent fd4b693 commit 14b38d0

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

src/libutil/xml-writer.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ void XMLWriter::close()
3131
void XMLWriter::indent_(size_t depth)
3232
{
3333
if (!indent) return;
34-
output << string(depth * 2, ' ');
34+
output << std::string(depth * 2, ' ');
3535
}
3636

3737

38-
void XMLWriter::openElement(const string & name,
38+
void XMLWriter::openElement(
39+
std::string_view name,
3940
const XMLAttrs & attrs)
4041
{
4142
assert(!closed);
@@ -44,7 +45,7 @@ void XMLWriter::openElement(const string & name,
4445
writeAttrs(attrs);
4546
output << ">";
4647
if (indent) output << std::endl;
47-
pendingElems.push_back(name);
48+
pendingElems.push_back(std::string(name));
4849
}
4950

5051

@@ -59,7 +60,8 @@ void XMLWriter::closeElement()
5960
}
6061

6162

62-
void XMLWriter::writeEmptyElement(const string & name,
63+
void XMLWriter::writeEmptyElement(
64+
std::string_view name,
6365
const XMLAttrs & attrs)
6466
{
6567
assert(!closed);

src/libutil/xml-writer.hh

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@
88

99
namespace nix {
1010

11-
using std::string;
12-
using std::map;
13-
using std::list;
1411

15-
16-
typedef map<string, string> XMLAttrs;
12+
typedef std::map<std::string, std::string> XMLAttrs;
1713

1814

1915
class XMLWriter
@@ -25,7 +21,7 @@ private:
2521
bool indent;
2622
bool closed;
2723

28-
list<string> pendingElems;
24+
std::list<std::string> pendingElems;
2925

3026
public:
3127

@@ -34,11 +30,11 @@ public:
3430

3531
void close();
3632

37-
void openElement(const string & name,
33+
void openElement(std::string_view name,
3834
const XMLAttrs & attrs = XMLAttrs());
3935
void closeElement();
4036

41-
void writeEmptyElement(const string & name,
37+
void writeEmptyElement(std::string_view name,
4238
const XMLAttrs & attrs = XMLAttrs());
4339

4440
private:
@@ -53,7 +49,7 @@ class XMLOpenElement
5349
private:
5450
XMLWriter & writer;
5551
public:
56-
XMLOpenElement(XMLWriter & writer, const string & name,
52+
XMLOpenElement(XMLWriter & writer, std::string_view name,
5753
const XMLAttrs & attrs = XMLAttrs())
5854
: writer(writer)
5955
{

src/nix-env/nix-env.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ static bool cmpElemByName(const DrvInfo & a, const DrvInfo & b)
833833
}
834834

835835

836-
typedef list<Strings> Table;
836+
typedef std::list<Strings> Table;
837837

838838

839839
void printTable(Table & table)

0 commit comments

Comments
 (0)