Make cajun containers implement the STL container interfaces rather than being retarded special snowflakes

Originally committed to SVN as r5746.
This commit is contained in:
Thomas Goyne 2011-10-17 21:59:35 +00:00
parent 85bfb91f73
commit 2f64a116a7
11 changed files with 136 additions and 235 deletions

View File

@ -75,7 +75,7 @@ Hotkey::Hotkey(const std::string &file, const std::string &default_config)
json::UnknownElement hotkey_root = agi::json_util::file(config_file, default_config);
json::Object object = hotkey_root;
for (json::Object::const_iterator index(object.Begin()); index != object.End(); index++) {
for (json::Object::const_iterator index(object.begin()); index != object.end(); index++) {
const json::Object::Member& member = *index;
const json::Object& obj = member.element;
BuildHotkey(member.name, obj);
@ -84,22 +84,20 @@ Hotkey::Hotkey(const std::string &file, const std::string &default_config)
void Hotkey::BuildHotkey(std::string const& context, const json::Object& object) {
for (json::Object::const_iterator index(object.Begin()); index != object.End(); index++) {
for (json::Object::const_iterator index(object.begin()); index != object.end(); index++) {
const json::Object::Member& member = *index;
const json::Array& array = member.element;
for (json::Array::const_iterator arr_index(array.Begin()); arr_index != array.End(); arr_index++) {
for (json::Array::const_iterator arr_index(array.begin()); arr_index != array.end(); arr_index++) {
Combo combo(context, member.name);
const json::Object& obj = *arr_index;
const json::Array& arr_mod = obj["modifiers"];
if (arr_mod.Size() > 0) {
for (json::Array::const_iterator arr_mod_index(arr_mod.Begin()); arr_mod_index != arr_mod.End(); arr_mod_index++) {
for (json::Array::const_iterator arr_mod_index(arr_mod.begin()); arr_mod_index != arr_mod.end(); arr_mod_index++) {
const json::String& key_mod = *arr_mod_index;
combo.KeyInsert(key_mod.Value());
} // for arr_mod_index
}
combo.KeyInsert(static_cast<const json::String&>(obj["key"]).Value());
ComboInsert(combo);
@ -178,7 +176,7 @@ void Hotkey::Flush() {
json::Array modifiers;
for (int i = 0; i != combo_map.size()-1; i++) {
modifiers.Insert(json::String(combo_map[i]));
modifiers.push_back(json::String(combo_map[i]));
}
json::Object hotkey;
@ -188,7 +186,7 @@ void Hotkey::Flush() {
json::Object& context_obj = root[index->second.Context()];
json::Array& combo_array = context_obj[index->second.CmdName()];
combo_array.Insert(hotkey);
combo_array.push_back(hotkey);
}
io::Save file(config_file);

View File

@ -89,17 +89,17 @@ LogSink::~LogSink() {
entry["line"] = json::Number(sink[i]->line);
entry["message"] = json::String(std::string(sink[i]->message, sink[i]->len));
array.Insert(entry);
array.push_back(entry);
}
json::Array timeval_open;
timeval_open.Insert(json::Number(time_start.tv_sec));
timeval_open.Insert(json::Number(time_start.tv_usec));
timeval_open.push_back(json::Number(time_start.tv_sec));
timeval_open.push_back(json::Number(time_start.tv_usec));
root["timeval"]["open"] = timeval_open;
json::Array timeval_close;
timeval_close.Insert(json::Number(time_close.tv_sec));
timeval_close.Insert(json::Number(time_close.tv_usec));
timeval_close.push_back(json::Number(time_close.tv_sec));
timeval_close.push_back(json::Number(time_close.tv_usec));
root["timeval"]["close"] = timeval_close;

View File

@ -34,7 +34,7 @@ MRUManager::MRUManager(const std::string &config, const std::string &default_con
json::UnknownElement root = json_util::file(config, default_config);
const json::Object& root_new = (json::Object)root;
json::Object::const_iterator index_object(root_new.Begin()), index_objectEnd(root_new.End());
json::Object::const_iterator index_object(root_new.begin()), index_objectEnd(root_new.end());
for (; index_object != index_objectEnd; ++index_object) {
const json::Object::Member& member = *index_object;
@ -98,7 +98,7 @@ void MRUManager::Flush() {
const MRUListMap &map_list = i->second;
for (MRUListMap::const_iterator i_lst = map_list.begin(); i_lst != map_list.end(); ++i_lst) {
array.Insert(json::String(*i_lst));
array.push_back(json::String(*i_lst));
}
}
@ -121,7 +121,7 @@ static json::String cast_str(json::UnknownElement const& e) {
/// @param array json::Array of values.
void MRUManager::Load(const std::string &key, const json::Array& array) {
try {
transform(array.Begin(), array.End(), back_inserter(mru[key]), cast_str);
transform(array.begin(), array.end(), back_inserter(mru[key]), cast_str);
}
catch (json::Exception const&) {
// Out of date MRU file; just discard the data and skip it

View File

@ -143,7 +143,7 @@ void Options::Flush() {
for (std::vector<std::string>::const_iterator i_str = array_string.begin(); i_str != array_string.end(); ++i_str) {
json::Object obj;
obj["string"] = json::String(*i_str);
array.Insert(obj);
array.push_back(obj);
}
PutOption(obj_out, i->first, (json::Array)array);
@ -159,7 +159,7 @@ void Options::Flush() {
for (std::vector<int64_t>::const_iterator i_int = array_int.begin(); i_int != array_int.end(); ++i_int) {
json::Object obj;
obj["int"] = json::Number((const double)*i_int);
array.Insert(obj);
array.push_back(obj);
}
PutOption(obj_out, i->first, (json::Array)array);
}
@ -174,7 +174,7 @@ void Options::Flush() {
for (std::vector<double>::const_iterator i_double = array_double.begin(); i_double != array_double.end(); ++i_double) {
json::Object obj;
obj["double"] = json::Number(*i_double);
array.Insert(obj);
array.push_back(obj);
}
PutOption(obj_out, i->first, (json::Array)array);
}
@ -193,7 +193,7 @@ void Options::Flush() {
obj["colour"] = json::String(str);
array.Insert(obj);
array.push_back(obj);
}
PutOption(obj_out, i->first, (json::Array)array);
}
@ -208,7 +208,7 @@ void Options::Flush() {
for (std::vector<bool>::const_iterator i_bool = array_bool.begin(); i_bool != array_bool.end(); ++i_bool) {
json::Object obj;
obj["bool"] = json::Boolean(*i_bool);
array.Insert(obj);
array.push_back(obj);
}
PutOption(obj_out, i->first, (json::Array)array);
}
@ -224,10 +224,10 @@ void Options::Flush() {
bool Options::PutOption(json::Object &obj, const std::string &path, const json::UnknownElement &value) {
// Having a '/' denotes it is a leaf.
if (path.find('/') == std::string::npos) {
json::Object::iterator pos = obj.Find(path);
json::Object::iterator pos = obj.find(path);
// Fail if a key of the same name already exists.
if (pos != obj.End())
if (pos != obj.end())
throw OptionErrorDuplicateKey("Key already exists");
obj[path] = value;
@ -235,11 +235,11 @@ bool Options::PutOption(json::Object &obj, const std::string &path, const json::
} else {
std::string thispart = path.substr(0, path.find("/"));
std::string restpart = path.substr(path.find("/")+1, path.size());
json::Object::iterator pos = obj.Find(thispart);
json::Object::iterator pos = obj.find(thispart);
// New key, make object.
if (pos == obj.End())
pos = obj.Insert(json::Object::Member(thispart, json::Object()));
if (pos == obj.end())
pos = obj.insert(json::Object::Member(thispart, json::Object()));
PutOptionVisitor visitor(restpart, value);
pos->element.Accept(visitor);

View File

@ -37,7 +37,7 @@ ConfigVisitor::ConfigVisitor(OptionValueMap &val, const std::string &member_name
}
void ConfigVisitor::Visit(const json::Object& object) {
json::Object::const_iterator index(object.Begin()), index_end(object.End());
json::Object::const_iterator index(object.begin()), index_end(object.end());
if (!name.empty())
name += "/";
@ -56,12 +56,12 @@ void ConfigVisitor::Visit(const json::Object& object) {
void ConfigVisitor::Visit(const json::Array& array) {
OptionValueList *array_list = NULL;
json::Array::const_iterator index(array.Begin()), indexEnd(array.End());
json::Array::const_iterator index(array.begin()), indexEnd(array.end());
for (; index != indexEnd; ++index) {
const json::Object& index_array = *index;
json::Object::const_iterator index_object(index_array.Begin()), index_objectEnd(index_array.End());
json::Object::const_iterator index_object(index_array.begin()), index_objectEnd(index_array.end());
for (; index_object != index_objectEnd; ++index_object) {
const json::Object::Member& member = *index_object;

View File

@ -28,8 +28,6 @@ namespace json
/////////////////////////////////////////////////
// forward declarations (more info further below)
class Visitor;
class ConstVisitor;
@ -48,16 +46,12 @@ class Null;
/////////////////////////////////////////////////////////////////////////
// Exception - base class for all JSON-related runtime errors
class Exception : public std::runtime_error
{
public:
Exception(const std::string& sMessage);
Exception(const std::string& sMessage) : std::runtime_error(sMessage) { }
};
/////////////////////////////////////////////////////////////////////////
// UnknownElement - provides a typesafe surrogate for any of the JSON-
// sanctioned element types. This class allows the Array and Object
@ -147,37 +141,40 @@ private:
/////////////////////////////////////////////////////////////////////////////////
// Array - mimics std::deque<UnknownElement>. The array contents are effectively
// heterogeneous thanks to the ElementUnknown class. push_back has been replaced
// by more generic insert functions.
// heterogeneous thanks to the ElementUnknown class.
class Array
{
public:
typedef std::deque<UnknownElement> Elements;
typedef Elements::iterator iterator;
typedef Elements::const_iterator const_iterator;
typedef std::deque<UnknownElement> elements;
typedef elements::iterator iterator;
typedef elements::const_iterator const_iterator;
iterator Begin();
iterator End();
const_iterator Begin() const;
const_iterator End() const;
iterator begin() { return m_Elements.begin(); }
iterator end() { return m_Elements.end(); }
const_iterator begin() const { return m_Elements.begin(); }
const_iterator end() const { return m_Elements.end(); }
iterator Insert(const UnknownElement& element, iterator itWhere);
iterator Insert(const UnknownElement& element);
iterator Erase(iterator itWhere);
void Resize(size_t newSize);
void Clear();
iterator insert(iterator it, const UnknownElement& element) { m_Elements.insert(it, element); }
void push_back(const UnknownElement& element) { m_Elements.push_back(element); }
iterator erase(iterator it) { return m_Elements.erase(it); }
void resize(size_t newsize) { m_Elements.resize(newsize); }
void clear() { m_Elements.clear(); }
size_t Size() const;
bool Empty() const;
size_t size() const { return m_Elements.size(); }
bool empty() const { return m_Elements.empty(); }
UnknownElement& front() { return m_Elements.front(); }
const UnknownElement& front() const { return m_Elements.front(); }
UnknownElement& back() { return m_Elements.back(); }
const UnknownElement& back() const { return m_Elements.back(); }
UnknownElement& operator[] (size_t index);
const UnknownElement& operator[] (size_t index) const;
bool operator == (const Array& array) const;
bool operator == (const Array& array) const { return m_Elements == array.m_Elements; }
private:
Elements m_Elements;
elements m_Elements;
};
@ -189,7 +186,8 @@ class Object
{
public:
struct Member {
Member(const std::string& nameIn = std::string(), const UnknownElement& elementIn = UnknownElement());
Member(const std::string& nameIn = std::string(), const UnknownElement& elementIn = UnknownElement())
: name(nameIn), element(elementIn) { }
bool operator == (const Member& member) const;
@ -201,23 +199,22 @@ public:
typedef Members::iterator iterator;
typedef Members::const_iterator const_iterator;
bool operator == (const Object& object) const;
bool operator == (const Object& object) const { return m_Members == object.m_Members; }
iterator Begin();
iterator End();
const_iterator Begin() const;
const_iterator End() const;
iterator begin() { return m_Members.begin(); }
iterator end() { return m_Members.end(); }
const_iterator begin() const { return m_Members.begin(); }
const_iterator end() const { return m_Members.end(); }
size_t Size() const;
bool Empty() const;
size_t size() const { return m_Members.size(); }
bool empty() const { return m_Members.empty(); }
iterator Find(const std::string& name);
const_iterator Find(const std::string& name) const;
iterator find(const std::string& name);
const_iterator find(const std::string& name) const;
iterator Insert(const Member& member);
iterator Insert(const Member& member, iterator itWhere);
iterator Erase(iterator itWhere);
void Clear();
iterator insert(const Member& member);
iterator erase(iterator it) { return m_Members.erase(it); }
void clear() { m_Members.clear(); }
UnknownElement& operator [](const std::string& name);
const UnknownElement& operator [](const std::string& name) const;
@ -266,7 +263,7 @@ public:
};
} // End namespace
} // end namespace
#include "elements.inl"

View File

@ -22,11 +22,6 @@ TODO:
namespace json
{
inline Exception::Exception(const std::string& sMessage) :
std::runtime_error(sMessage) {}
/////////////////////////
// UnknownElement members
@ -143,29 +138,25 @@ inline UnknownElement& UnknownElement::operator = (const UnknownElement& unknown
inline UnknownElement& UnknownElement::operator[] (const std::string& key)
{
// the people want an object. make us one if we aren't already
Object& object = ConvertTo<Object>();
return object[key];
return ConvertTo<Object>()[key];
}
inline const UnknownElement& UnknownElement::operator[] (const std::string& key) const
{
// throws if we aren't an object
const Object& object = CastTo<Object>();
return object[key];
return CastTo<Object>()[key];
}
inline UnknownElement& UnknownElement::operator[] (size_t index)
{
// the people want an array. make us one if we aren't already
Array& array = ConvertTo<Array>();
return array[index];
return ConvertTo<Array>()[index];
}
inline const UnknownElement& UnknownElement::operator[] (size_t index) const
{
// throws if we aren't an array
const Array& array = CastTo<Array>();
return array[index];
return CastTo<Array>()[index];
}
@ -206,140 +197,70 @@ inline bool UnknownElement::operator == (const UnknownElement& element) const
return m_pImp->Compare(*element.m_pImp);
}
//////////////////
// Object members
inline Object::Member::Member(const std::string& nameIn, const UnknownElement& elementIn) :
name(nameIn), element(elementIn) {}
inline bool Object::Member::operator == (const Member& member) const
{
return name == member.name &&
element == member.element;
return name == member.name && element == member.element;
}
class Object::Finder : public std::unary_function<Object::Member, bool>
{
std::string m_name;
public:
Finder(const std::string& name) : m_name(name) {}
bool operator () (const Object::Member& member) {
return member.name == m_name;
}
private:
std::string m_name;
};
inline Object::iterator Object::Begin() { return m_Members.begin(); }
inline Object::iterator Object::End() { return m_Members.end(); }
inline Object::const_iterator Object::Begin() const { return m_Members.begin(); }
inline Object::const_iterator Object::End() const { return m_Members.end(); }
inline size_t Object::Size() const { return m_Members.size(); }
inline bool Object::Empty() const { return m_Members.empty(); }
inline Object::iterator Object::Find(const std::string& name)
inline Object::iterator Object::find(const std::string& name)
{
return std::find_if(m_Members.begin(), m_Members.end(), Finder(name));
}
inline Object::const_iterator Object::Find(const std::string& name) const
inline Object::const_iterator Object::find(const std::string& name) const
{
return std::find_if(m_Members.begin(), m_Members.end(), Finder(name));
}
inline Object::iterator Object::Insert(const Member& member)
inline Object::iterator Object::insert(const Member& member)
{
return Insert(member, End());
}
inline Object::iterator Object::Insert(const Member& member, iterator itWhere)
{
iterator it = Find(member.name);
iterator it = find(member.name);
if (it != m_Members.end())
throw Exception("Object member already exists: " + member.name);
it = m_Members.insert(itWhere, member);
return it;
}
inline Object::iterator Object::Erase(iterator itWhere)
{
return m_Members.erase(itWhere);
m_Members.push_back(member);
return --it;
}
inline UnknownElement& Object::operator [](const std::string& name)
{
iterator it = Find(name);
iterator it = find(name);
if (it == m_Members.end())
{
Member member(name);
it = Insert(member, End());
it = insert(Member(name));
}
return it->element;
}
inline const UnknownElement& Object::operator [](const std::string& name) const
{
const_iterator it = Find(name);
if (it == End())
const_iterator it = find(name);
if (it == end())
throw Exception("Object member not found: " + name);
return it->element;
}
inline void Object::Clear()
{
m_Members.clear();
}
inline bool Object::operator == (const Object& object) const
{
return m_Members == object.m_Members;
}
/////////////////
// Array members
inline Array::iterator Array::Begin() { return m_Elements.begin(); }
inline Array::iterator Array::End() { return m_Elements.end(); }
inline Array::const_iterator Array::Begin() const { return m_Elements.begin(); }
inline Array::const_iterator Array::End() const { return m_Elements.end(); }
inline Array::iterator Array::Insert(const UnknownElement& element, iterator itWhere)
{
return m_Elements.insert(itWhere, element);
}
inline Array::iterator Array::Insert(const UnknownElement& element)
{
return Insert(element, End());
}
inline Array::iterator Array::Erase(iterator itWhere)
{
return m_Elements.erase(itWhere);
}
inline void Array::Resize(size_t newSize)
{
m_Elements.resize(newSize);
}
inline size_t Array::Size() const { return m_Elements.size(); }
inline bool Array::Empty() const { return m_Elements.empty(); }
inline UnknownElement& Array::operator[] (size_t index)
{
size_t nMinSize = index + 1; // zero indexed
if (m_Elements.size() < nMinSize)
m_Elements.resize(nMinSize);
size_t nMinsize = index + 1; // zero indexed
if (m_Elements.size() < nMinsize)
m_Elements.resize(nMinsize);
return m_Elements[index];
}
@ -350,16 +271,6 @@ inline const UnknownElement& Array::operator[] (size_t index) const
return m_Elements[index];
}
inline void Array::Clear() {
m_Elements.clear();
}
inline bool Array::operator == (const Array& array) const
{
return m_Elements == array.m_Elements;
}
////////////////////////
// TrivialType_T members
@ -397,8 +308,6 @@ bool TrivialType_T<DataTypeT>::operator == (const TrivialType_T<DataTypeT>& triv
return m_tValue == trivial.m_tValue;
}
//////////////////
// Null members
@ -407,6 +316,4 @@ inline bool Null::operator == (const Null& trivial) const
return true;
}
} // End namespace
} // end namespace

View File

@ -417,13 +417,12 @@ inline void Reader::Parse(Object& object, Reader::TokenStream& tokenStream)
// try adding it to the object (this could throw)
try
{
object.Insert(member);
object.insert(member);
}
catch (Exception&)
{
// must be a duplicate name
std::string sMessage = "Duplicate object member token: " + member.name;
throw ParseException(sMessage, tokenName.locBegin, tokenName.locEnd);
throw ParseException("Duplicate object member token: " + member.name, tokenName.locBegin, tokenName.locEnd);
}
bContinue = (tokenStream.EOS() == false &&
@ -445,8 +444,8 @@ inline void Reader::Parse(Array& array, Reader::TokenStream& tokenStream)
while (bContinue)
{
// ...what's next? could be anything
Array::iterator itElement = array.Insert(UnknownElement());
UnknownElement& element = *itElement;
array.push_back(UnknownElement());
UnknownElement& element = array.back();
Parse(element, tokenStream);
bContinue = (tokenStream.EOS() == false &&

View File

@ -46,21 +46,21 @@ void Writer::Write_i(const ElementTypeT& element, std::ostream& ostr)
inline void Writer::Write_i(const Array& array)
{
if (array.Empty())
if (array.empty())
m_ostr << "[]";
else
{
m_ostr << '[' << std::endl;
++m_nTabDepth;
Array::const_iterator it(array.Begin()),
itEnd(array.End());
while (it != itEnd) {
Array::const_iterator it(array.begin()),
itend(array.end());
while (it != itend) {
m_ostr << std::string(m_nTabDepth, '\t');
Write_i(*it);
if (++it != itEnd)
if (++it != itend)
m_ostr << ',';
m_ostr << std::endl;
}
@ -72,20 +72,20 @@ inline void Writer::Write_i(const Array& array)
inline void Writer::Write_i(const Object& object)
{
if (object.Empty())
if (object.empty())
m_ostr << "{}";
else
{
m_ostr << '{' << std::endl;
++m_nTabDepth;
Object::const_iterator it(object.Begin()),
itEnd(object.End());
while (it != itEnd) {
Object::const_iterator it(object.begin()),
itend(object.end());
while (it != itend) {
m_ostr << std::string(m_nTabDepth, '\t') << '"' << it->name << "\" : ";
Write_i(it->element);
if (++it != itEnd)
if (++it != itend)
m_ostr << ',';
m_ostr << std::endl;
}
@ -111,8 +111,8 @@ inline void Writer::Write_i(const String& stringElement)
const std::string& s = stringElement.Value();
std::string::const_iterator it(s.begin()),
itEnd(s.end());
for (; it != itEnd; ++it)
itend(s.end());
for (; it != itend; ++it)
{
switch (*it)
{
@ -150,4 +150,4 @@ inline void Writer::Visit(const Null& null) { Write_i(null); }
} // End namespace
} // end namespace

View File

@ -229,8 +229,8 @@ struct CommandMenuBar : public wxMenuBar {
/// @param[out] value Output value to write to
/// @return Was the requested index found
bool read_entry(json::Object const& obj, const char *name, std::string *value) {
json::Object::const_iterator it = obj.Find(name);
if (it == obj.End()) return false;
json::Object::const_iterator it = obj.find(name);
if (it == obj.end()) return false;
*value = static_cast<json::String const&>(it->element);
return true;
}
@ -241,7 +241,7 @@ typedef json::Object menu_map;
/// Get the root object of the menu configuration
menu_map const& get_menus_root() {
static menu_map root;
if (!root.Empty()) return root;
if (!root.empty()) return root;
try {
root = agi::json_util::file(StandardPaths::DecodePath("?user/menu.json").utf8_str().data(), GET_DEFAULT_CONFIG(default_menu));
@ -263,8 +263,8 @@ menu_map const& get_menus_root() {
menu_items const& get_menu(std::string const& name) {
menu_map const& root = get_menus_root();
menu_map::const_iterator it = root.Find(name);
if (it == root.End()) throw menu::UnknownMenu("Menu named " + name + " not found");
menu_map::const_iterator it = root.find(name);
if (it == root.end()) throw menu::UnknownMenu("Menu named " + name + " not found");
return it->element;
}
@ -276,7 +276,7 @@ wxMenu *build_menu(std::string const& name, agi::Context *c, CommandManager *cm,
/// @param ele json object to process
/// @param cm Command manager for this menu
void process_menu_item(wxMenu *parent, agi::Context *c, json::Object const& ele, CommandManager *cm) {
if (ele.Empty()) {
if (ele.empty()) {
parent->AppendSeparator();
return;
}
@ -333,7 +333,7 @@ wxMenu *build_menu(std::string const& name, agi::Context *c, CommandManager *cm,
menu_items const& items = get_menu(name);
if (!menu) menu = new wxMenu;
for_each(items.Begin(), items.End(), bind(process_menu_item, menu, c, _1, cm));
for_each(items.begin(), items.end(), bind(process_menu_item, menu, c, _1, cm));
return menu;
}
@ -389,7 +389,7 @@ namespace menu {
menu_items const& items = get_menu(name);
CommandMenuBar *menu = new CommandMenuBar(c);
for (menu_items::const_iterator it = items.Begin(); it != items.End(); ++it) {
for (menu_items::const_iterator it = items.begin(); it != items.end(); ++it) {
std::string submenu, disp;
read_entry(*it, "submenu", &submenu);
read_entry(*it, "text", &disp);

View File

@ -42,7 +42,7 @@
namespace {
json::Object const& get_root() {
static json::Object root;
if (root.Empty()) {
if (root.empty()) {
root = agi::json_util::parse(new std::istringstream(GET_DEFAULT_CONFIG(default_toolbar)));
}
return root;
@ -92,8 +92,8 @@ namespace {
/// Populate the toolbar with buttons
void Populate() {
json::Object const& root = get_root();
json::Object::const_iterator it = root.Find(name);
if (it == root.End()) {
json::Object::const_iterator it = root.find(name);
if (it == root.end()) {
// Toolbar names are all hardcoded so this should never happen
throw agi::InternalError("Toolbar named " + name + " not found.", 0);
}
@ -101,10 +101,10 @@ namespace {
int icon_size = OPT_GET("App/Toolbar Icon Size")->GetInt();
json::Array arr = it->element;
commands.reserve(arr.Size());
commands.reserve(arr.size());
bool needs_onidle = false;
for (json::Array::const_iterator it = arr.Begin(); it != arr.End(); ++it) {
for (json::Array::const_iterator it = arr.begin(); it != arr.end(); ++it) {
json::String const& command_name = *it;
if (command_name.Value().empty()) {