style(3p/nix): Reformat project in Google C++ style
Reformatted with:
fd . -e hh -e cc | xargs clang-format -i
This commit is contained in:
parent
65a1aae98c
commit
0f2cf531f7
175 changed files with 32126 additions and 34689 deletions
75
third_party/nix/src/libutil/xml-writer.hh
vendored
75
third_party/nix/src/libutil/xml-writer.hh
vendored
|
|
@ -1,69 +1,56 @@
|
|||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace nix {
|
||||
|
||||
using std::string;
|
||||
using std::map;
|
||||
using std::list;
|
||||
|
||||
using std::map;
|
||||
using std::string;
|
||||
|
||||
typedef map<string, string> XMLAttrs;
|
||||
|
||||
class XMLWriter {
|
||||
private:
|
||||
std::ostream& output;
|
||||
|
||||
class XMLWriter
|
||||
{
|
||||
private:
|
||||
bool indent;
|
||||
bool closed;
|
||||
|
||||
std::ostream & output;
|
||||
list<string> pendingElems;
|
||||
|
||||
bool indent;
|
||||
bool closed;
|
||||
public:
|
||||
XMLWriter(bool indent, std::ostream& output);
|
||||
~XMLWriter();
|
||||
|
||||
list<string> pendingElems;
|
||||
void close();
|
||||
|
||||
public:
|
||||
void openElement(const string& name, const XMLAttrs& attrs = XMLAttrs());
|
||||
void closeElement();
|
||||
|
||||
XMLWriter(bool indent, std::ostream & output);
|
||||
~XMLWriter();
|
||||
void writeEmptyElement(const string& name,
|
||||
const XMLAttrs& attrs = XMLAttrs());
|
||||
|
||||
void close();
|
||||
private:
|
||||
void writeAttrs(const XMLAttrs& attrs);
|
||||
|
||||
void openElement(const string & name,
|
||||
const XMLAttrs & attrs = XMLAttrs());
|
||||
void closeElement();
|
||||
|
||||
void writeEmptyElement(const string & name,
|
||||
const XMLAttrs & attrs = XMLAttrs());
|
||||
|
||||
private:
|
||||
void writeAttrs(const XMLAttrs & attrs);
|
||||
|
||||
void indent_(size_t depth);
|
||||
void indent_(size_t depth);
|
||||
};
|
||||
|
||||
class XMLOpenElement {
|
||||
private:
|
||||
XMLWriter& writer;
|
||||
|
||||
class XMLOpenElement
|
||||
{
|
||||
private:
|
||||
XMLWriter & writer;
|
||||
public:
|
||||
XMLOpenElement(XMLWriter & writer, const string & name,
|
||||
const XMLAttrs & attrs = XMLAttrs())
|
||||
: writer(writer)
|
||||
{
|
||||
writer.openElement(name, attrs);
|
||||
}
|
||||
~XMLOpenElement()
|
||||
{
|
||||
writer.closeElement();
|
||||
}
|
||||
public:
|
||||
XMLOpenElement(XMLWriter& writer, const string& name,
|
||||
const XMLAttrs& attrs = XMLAttrs())
|
||||
: writer(writer) {
|
||||
writer.openElement(name, attrs);
|
||||
}
|
||||
~XMLOpenElement() { writer.closeElement(); }
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue