throw UnknownNodeNameException() << ": '" << name << "'";
GenericNode::ptr node (i->second);
children_.erase(i);
+ node->parent_ = 0;
+ node->name_.clear();
return node;
}
prefix_ void senf::console::DirectoryNode::add(GenericNode::ptr node)
{
BOOST_ASSERT( ! node->parent() );
+ if (node->name().empty()) {
+ node->name("unnamed");
+ SENF_LOG((senf::log::MESSAGE)("Adding 'unnamed' node"));
+ }
if (children_.find(node->name()) != children_.end()) {
unsigned suffix (0);
std::string newName;
do {
++suffix;
- newName = node->name() + boost::lexical_cast<std::string>(suffix);
+ newName = node->name() + "-" + boost::lexical_cast<std::string>(suffix);
} while (children_.find(newName) != children_.end());
- name(*node, newName);
+ SENF_LOG((senf::log::MESSAGE)("Uniquifying node '" << node->name() << "' to '"
+ << newName << "'"));
+ node->name(newName);
}
children_.insert(std::make_pair(node->name(),node));
node->parent_ = this;
}
///////////////////////////////////////////////////////////////////////////
+// senf::console::SyntaxErrorException
+
+prefix_ char const * senf::console::SyntaxErrorException::what()
+ const throw()
+{
+ return message().empty() ? "syntax error" : message().c_str();
+}
+
+///////////////////////////////////////////////////////////////////////////
// senf::console::SimpleCommandNode
prefix_ void senf::console::SimpleCommandNode::v_help(std::ostream & output)
output << doc_ << "\n";
}
+prefix_ void senf::console::SimpleCommandNode::v_execute(std::ostream & output,
+ ParseCommandInfo const & command)
+ const
+{
+ fn_(output, command);
+}
+
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
//#include "Node.mpp"