当前位置: 首页>>代码示例>>C++>>正文


C++ ItemLocation::IsValid方法代码示例

本文整理汇总了C++中ItemLocation::IsValid方法的典型用法代码示例。如果您正苦于以下问题:C++ ItemLocation::IsValid方法的具体用法?C++ ItemLocation::IsValid怎么用?C++ ItemLocation::IsValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ItemLocation的用法示例。


在下文中一共展示了ItemLocation::IsValid方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MakeCharacterRequest

QNetworkRequest ItemsManagerWorker::MakeCharacterRequest(const std::string &name, const ItemLocation &location) {
    QUrlQuery query;
    query.addQueryItem("character", name.c_str());
    query.addQueryItem("accountName", account_name_.c_str());

    QUrl url(kCharacterItemsUrl);
    url.setQuery(query);

    TabCache::Flags flags;
    if (!location.IsValid() || bo_manager_.GetRefreshChecked(location))
        flags |= TabCache::Refresh;

    return Request(url, location, flags);
}
开发者ID:Gloorf,项目名称:acquisition,代码行数:14,代码来源:itemsmanagerworker.cpp

示例2: MakeTabRequest

QNetworkRequest ItemsManagerWorker::MakeTabRequest(int tab_index, const ItemLocation &location, bool tabs) {
    QUrlQuery query;
    query.addQueryItem("league", league_.c_str());
    query.addQueryItem("tabs", tabs ? "1" : "0");
    query.addQueryItem("tabIndex", QString::number(tab_index));
    query.addQueryItem("accountName", account_name_.c_str());

    QUrl url(kStashItemsUrl);
    url.setQuery(query);

    TabCache::Flags flags;
    if (tabs) flags |= TabCache::Refresh;

    if (!location.IsValid() || bo_manager_.GetRefreshChecked(location))
        flags |= TabCache::Refresh;

    return Request(url, location, flags);
}
开发者ID:Gloorf,项目名称:acquisition,代码行数:18,代码来源:itemsmanagerworker.cpp

示例3: Request

QNetworkRequest TabCache::Request(const QUrl &url, const ItemLocation &location, Flags flags) {
    QNetworkRequest request{url};

    // The cache policy exists so it can override normal behavior for a given refresh.
    // Based on the current policy we may ignore refresh requests, or force refreshes
    // even if none was specifed with 'flags'.
    switch (cache_policy_) {
    case DefaultCache:
        // This is the default policy, where we honor cache policy as specified by 'flags'
        // Evict this request from the cache if refresh is requested
        if (flags.testFlag(Refresh))
            remove(url);
        break;
    case AlwaysCache:
        // By default we always try to hit in the cache, so this policy just allows
        // the normal cache mechanism to do its job and it will basically grab everything
        // from the cache that is available for all network requests
        break;
    case NeverCache:
        // We've already fully flushed the cache in OnPolicyUpdate, so nothing to do here.
        break;
    case ManualCache:
        // The case involves refreshing only an explicitily specified set of named tabs, customers
        // use AddManualRefresh to indicate what set of tabs to refresh before triggering a refresh
        // all other network requests will come from the cache if available
        if (location.IsValid() && manual_refresh_.count(location.GetUniqueHash()))
            remove(url);
        break;
    default:
        QLOG_ERROR() << "TabCache::Request Failed to handle all cache policy cases";
        break;
    };

    // At this point we've evicted any request that should be refreshed, so we always
    // tell the 'real' request to prefer but not require the entry be in the cache.
    // If it is not in the cache it will be fetched from the network regardless.
    request.setAttribute(QNetworkRequest::CacheSaveControlAttribute, QNetworkRequest::PreferCache);

    return request;
}
开发者ID:Kahany,项目名称:acquisition,代码行数:40,代码来源:tabcache.cpp

示例4: AddManualRefresh

void TabCache::AddManualRefresh( const ItemLocation &location) {
    if (location.IsValid())
        manual_refresh_.insert(location.GetUniqueHash());
}
开发者ID:Kahany,项目名称:acquisition,代码行数:4,代码来源:tabcache.cpp


注:本文中的ItemLocation::IsValid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。