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


C++ List::fromLast方法代码示例

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


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

示例1: slaveProtocol

QString KProtocolManager::slaveProtocol(const KURL &url, QString &proxy)
{
    if(url.hasSubURL()) // We don't want the suburl's protocol
    {
        KURL::List list = KURL::split(url);
        KURL::List::Iterator it = list.fromLast();
        return slaveProtocol(*it, proxy);
    }

    if(!d)
        d = new KProtocolManagerPrivate;

    if(d->url == url)
    {
        proxy = d->proxy;
        return d->protocol;
    }

    if(useProxy())
    {
        proxy = proxyForURL(url);
        if((proxy != "DIRECT") && (!proxy.isEmpty()))
        {
            bool isRevMatch = false;
            KProtocolManager::ProxyType type = proxyType();
            bool useRevProxy = ((type == ManualProxy) && useReverseProxy());

            QString noProxy;
            // Check no proxy information iff the proxy type is either
            // ManualProxy or EnvVarProxy
            if((type == ManualProxy) || (type == EnvVarProxy))
                noProxy = noProxyFor();

            if(!noProxy.isEmpty())
            {
                QString qhost = url.host().lower();
                const char *host = qhost.latin1();
                QString qno_proxy = noProxy.stripWhiteSpace().lower();
                const char *no_proxy = qno_proxy.latin1();
                isRevMatch = revmatch(host, no_proxy);

                // If no match is found and the request url has a port
                // number, try the combination of "host:port". This allows
                // users to enter host:port in the No-proxy-For list.
                if(!isRevMatch && url.port() > 0)
                {
                    qhost += ':' + QString::number(url.port());
                    host = qhost.latin1();
                    isRevMatch = revmatch(host, no_proxy);
                }

                // If the hostname does not contain a dot, check if
                // <local> is part of noProxy.
                if(!isRevMatch && host && (strchr(host, '.') == NULL))
                    isRevMatch = revmatch("<local>", no_proxy);
            }

            if((!useRevProxy && !isRevMatch) || (useRevProxy && isRevMatch))
            {
                d->url = proxy;
                if(d->url.isValid())
                {
                    // The idea behind slave protocols is not applicable to http
                    // and webdav protocols.
                    QString protocol = url.protocol().lower();
                    if(protocol.startsWith("http") || protocol.startsWith("webdav"))
                        d->protocol = protocol;
                    else
                    {
                        d->protocol = d->url.protocol();
                        kdDebug() << "slaveProtocol: " << d->protocol << endl;
                    }

                    d->url = url;
                    d->proxy = proxy;
                    return d->protocol;
                }
            }
        }
    }

    d->url = url;
    d->proxy = proxy = QString::null;
    d->protocol = url.protocol();
    return d->protocol;
}
开发者ID:,项目名称:,代码行数:86,代码来源:


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