示例#1
0
文件: User.cpp 项目: tguyard/GiGaSdk
UserRelation
User::relation () const
{
    if (hasRelation()) {
        return UserRelation{_relation};
    }
    BOOST_THROW_EXCEPTION(ErrorException{U("No relation")});
}
示例#2
0
文件: User.cpp 项目: tguyard/GiGaSdk
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;
}
示例#3
0
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;
}
示例#4
0
文件: User.cpp 项目: Robien/GiGaSdk
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;
}