UserRelation User::relation () const { if (hasRelation()) { return UserRelation{_relation}; } BOOST_THROW_EXCEPTION(ErrorException{U("No relation")}); }
void User::removeRelation () { if (!hasRelation()) { BOOST_THROW_EXCEPTION(ErrorException{U("No relation to remove")}); } auto& user = Application::get().currentUser(); NetworkApi::deleteUserRelation(user.id(), id(), _relation->type).get(); // remove relation and cache. this->_relation = nullptr; this->_protected = boost::none; this->_private = boost::none; }
bool OsmDataMemory::hasEntity( const OsmStructures::EntityReference &ref) const { bool result; switch (ref.type) { case OsmStructures::EnumOsmNode: result = hasNode(ref.id); break; case OsmStructures::EnumOsmWay: result = hasWay(ref.id); break; case OsmStructures::EnumOsmRelation: result = hasRelation(ref.id); break; } return result; }
void User::removeRelation () { if (!hasRelation()) { BOOST_THROW_EXCEPTION(ErrorException{U("No relation to remove")}); } if (_app == nullptr) { BOOST_THROW_EXCEPTION(ErrorException{U("Application is null")}); } auto& user = _app->currentUser(); _app->api().network.deleteUserRelation(user.id(), id(), _relation->type).get(); // remove relation and cache. this->_relation = nullptr; this->_protected = boost::none; this->_private = boost::none; }