Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions Jzon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ THE SOFTWARE.
#include <stack>
#include <algorithm>
#include <cassert>
#include <iostream>

namespace Jzon
{
Expand Down Expand Up @@ -305,14 +306,7 @@ namespace Jzon
{
detach();
NamedNodeList &children = data->children;
for (NamedNodeList::iterator it = children.begin(); it != children.end(); ++it)
{
if ((*it).first == name)
{
children.erase(it);
break;
}
}
children.erase(std::remove_if(children.begin(), children.end(), NamedNodeComparator(name)), children.end());
}
}
void Node::clear()
Expand Down
11 changes: 11 additions & 0 deletions Jzon.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ namespace Jzon
std::string valueStr;
NamedNodeList children;
} *data;

};

JZON_API std::string escapeString(const std::string &value);
Expand All @@ -218,6 +219,16 @@ namespace Jzon
JZON_API Node object();
JZON_API Node array();

class JZON_API NamedNodeComparator
{
private:
const std::string& name;
public:
NamedNodeComparator(const std::string& name_) : name(name_) {}
bool operator()(const NamedNode& n) { return n.first == name;}
};


struct JZON_API Format
{
bool newline;
Expand Down