int ColorSquID::GetNextBranch(const db_compress::AttrValue* attr) const { double value = static_cast<const ColorAttr*>(attr)->Value(); if (first_step_) { if (fabs(value) < 1e-5) return 0; else return 1; } else { db_compress::DoubleAttrValue attr_(value); return tree_->GetNextBranch(&attr_); } }
Node& Node::concat(const std::string& name, const std::string& value, const std::string& separator){ pugi::xml_attribute attr = attr_(name); if(not attr.empty()){ std::string current = attr.as_string(); std::string future; if(current.length()>0) future = current + separator + value; else future = value; attr.set_value(future.c_str()); }else { pimpl_->append_attribute(name.c_str()) = value.c_str(); } return *this; }
Node& Node::erase(const std::string& name){ auto attr = attr_(name); if(attr) pimpl_->remove_attribute(attr); return *this; }