int status;
- map<string, tree_node> childs;
+ map<string, tree_node> children;
tree_node* find(const string& name);
string::size_type pos = name.find('/');
if (pos == string::npos)
{
- iterator it = childs.find(name);
- if (it == childs.end())
+ iterator it = children.find(name);
+ if (it == children.end())
return NULL;
return &it->second;
else
{
string a = name.substr(0, pos);
- iterator it = childs.find(a);
- if (it == childs.end())
+ iterator it = children.find(a);
+ if (it == children.end())
return NULL;
string b = name.substr(pos + 1);
string::size_type pos = name.find('/');
if (pos == string::npos)
{
- iterator it = childs.find(name);
- if (it == childs.end())
- it = childs.insert(childs.end(), make_pair(name, tree_node()));
+ iterator it = children.find(name);
+ if (it == children.end())
+ it = children.insert(children.end(), make_pair(name, tree_node()));
return &it->second;
}
else
{
string a = name.substr(0, pos);
- iterator it = childs.find(a);
- if (it == childs.end())
- it = childs.insert(childs.end(), make_pair(a, tree_node()));
+ iterator it = children.find(a);
+ if (it == children.end())
+ it = children.insert(children.end(), make_pair(a, tree_node()));
string b = name.substr(pos + 1);
return it->second.insert(b);
string::size_type pos = name.find('/');
if (pos == string::npos)
{
- iterator it = childs.find(name);
- if (it == childs.end())
+ iterator it = children.find(name);
+ if (it == children.end())
return false;
- if (it->second.childs.empty())
- childs.erase(it);
+ if (it->second.children.empty())
+ children.erase(it);
else
it->second.status = 0;
else
{
string a = name.substr(0, pos);
- iterator it = childs.find(a);
- if (it == childs.end())
+ iterator it = children.find(a);
+ if (it == children.end())
return false;
string b = name.substr(pos + 1);
it->second.erase(b);
- if (it->second.status == 0 && it->second.childs.empty())
- childs.erase(it);
+ if (it->second.status == 0 && it->second.children.empty())
+ children.erase(it);
return true;
}
return false;
nn = insert(n);
- swap(nn->childs, oo->childs);
+ swap(nn->children, oo->children);
nn->status = oo->status;
erase(o);
void
tree_node::dump(const string& prefix) const
{
- for (const_iterator it = childs.begin(); it != childs.end(); ++it)
+ for (const_iterator it = children.begin(); it != children.end(); ++it)
{
if (prefix.empty())
{
void
tree_node::check(StreamProcessor* processor, const string& prefix)
{
- for (iterator it = childs.begin(); it != childs.end(); ++it)
+ for (iterator it = children.begin(); it != children.end(); ++it)
{
if (prefix.empty())
{
void
tree_node::result(cmpdirs_cb_t cb, const string& prefix) const
{
- for (const_iterator it = childs.begin(); it != childs.end(); ++it)
+ for (const_iterator it = children.begin(); it != children.end(); ++it)
{
if (prefix.empty())
{
merge(StreamProcessor* processor, tree_node* tmp, const string& from, const string& to,
const string& prefix = "")
{
- for (tree_node::iterator it = tmp->childs.begin(); it != tmp->childs.end(); ++it)
+ for (tree_node::iterator it = tmp->children.begin(); it != tmp->children.end(); ++it)
{
if (prefix.empty())
{
else
{
tree_node tmp;
- swap(it1->childs, tmp.childs);
+ swap(it1->children, tmp.children);
processor->deleted(from);
processor->created(to);
virtual Message dispatch(const Message&) override;
private:
string child_program;
- bp::ipstream childs_out; // we read this
- // bp::ipstream childs_err; // we read this
- bp::opstream childs_in; // we write this
+ bp::ipstream child_out; // we read this
+ bp::opstream child_in; // we write this
};
ForwardingZyppPlugin::main()
{
bp::child c(child_program,
- bp::std_out > childs_out,
- // bp::std_err > childs_err,
- bp::std_in < childs_in);
+ bp::std_out > child_out,
+ bp::std_in < child_in);
- int result = ZyppPlugin::main();
-
- // c.wait();
- return result;
+ return ZyppPlugin::main();
}
ZyppPlugin::Message
ForwardingZyppPlugin::dispatch(const Message& msg)
{
- write_message(childs_in, msg);
- return read_message(childs_out);
+ write_message(child_in, msg);
+ return read_message(child_out);
}