• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ webcore::String类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中webcore::String的典型用法代码示例。如果您正苦于以下问题:C++ String类的具体用法?C++ String怎么用?C++ String使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: RedirectedToUrl

jstring WebCoreResourceLoader::RedirectedToUrl(JNIEnv* env, jobject obj,
        jstring baseUrl, jstring redirectTo, jint nativeResponse)
{
#ifdef ANDROID_INSTRUMENT
    TimeCounterAuto counter(TimeCounter::ResourceTimeCounter);
#endif
    LOGV("webcore_resourceloader redirectedToUrl");
    WebCore::ResourceHandle* handle = GET_NATIVE_HANDLE(env, obj);
    LOG_ASSERT(handle, "nativeRedirectedToUrl must take a valid handle!");
    // ResourceLoader::didFail() can set handle to be NULL, we need to check
    if (!handle)
        return NULL;

    LOG_ASSERT(handle->client(), "Why do we not have a client?");
    WebCore::ResourceRequest r = handle->request();
    WebCore::KURL url(WebCore::KURL(WebCore::ParsedURLString, to_string(env, baseUrl)),
            to_string(env, redirectTo));
    r.setURL(url);
    if (r.httpMethod() == "POST") {
        r.setHTTPMethod("GET");
        r.clearHTTPReferrer();
        r.setHTTPBody(0);
        r.setHTTPContentType("");
    }
    WebCore::ResourceResponse* response = (WebCore::ResourceResponse*)nativeResponse;
    // If the url fails to resolve the relative path, return null.
    if (url.protocol().isEmpty()) {
        delete response;
        return NULL;
    }
    handle->client()->willSendRequest(handle, r, *response);
    delete response;
    WebCore::String s = url.string();
    return env->NewString((unsigned short*)s.characters(), s.length());
}
开发者ID:Androtos,项目名称:toolchain_benchmark,代码行数:35,代码来源:WebCoreResourceLoader.cpp


示例2: malloc

static const char* anp_getApplicationDataDirectory() {
    if (NULL == gApplicationDataDir) {
        PluginClient* client = JavaSharedClient::GetPluginClient();
        if (!client)
            return NULL;

        WebCore::String path = client->getPluginSharedDataDirectory();
        int length = path.length();
        if (length == 0)
            return NULL;

        char* storage = (char*) malloc(length + 1);
        if (NULL == storage)
            return NULL;

        memcpy(storage, path.utf8().data(), length);
        storage[length] = '\0';

        // save this assignment for last, so that if multiple threads call us
        // (which should never happen), we never return an incomplete global.
        // At worst, we would allocate storage for the path twice.
        gApplicationDataDir = storage;
    }
    return gApplicationDataDir;
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:25,代码来源:ANPSystemInterface.cpp


示例3: sendResponseIfNeeded

void QNetworkReplyHandler::sendResponseIfNeeded()
{
    m_shouldSendResponse = (m_loadMode != LoadNormal);
    if (m_shouldSendResponse)
        return;

    if (m_reply->error())
        return;

    if (m_responseSent || !m_resourceHandle)
        return;
    m_responseSent = true;

    ResourceHandleClient* client = m_resourceHandle->client();
    if (!client)
        return;

    WebCore::String contentType = m_reply->header(QNetworkRequest::ContentTypeHeader).toString();
    WebCore::String encoding = extractCharsetFromMediaType(contentType);
    WebCore::String mimeType = extractMIMETypeFromMediaType(contentType);

    if (mimeType.isEmpty()) {
        // let's try to guess from the extension
        QString extension = m_reply->url().path();
        int index = extension.lastIndexOf(QLatin1Char('.'));
        if (index > 0) {
            extension = extension.mid(index + 1);
            mimeType = MIMETypeRegistry::getMIMETypeForExtension(extension);
        }
    }

    KURL url(m_reply->url());
    ResourceResponse response(url, mimeType,
                              m_reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(),
                              encoding, String());

    if (url.isLocalFile()) {
        client->didReceiveResponse(m_resourceHandle, response);
        return;
    }

    // The status code is equal to 0 for protocols not in the HTTP family.
    int statusCode = m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();

    if (url.protocolInHTTPFamily()) {
        String suggestedFilename = filenameFromHTTPContentDisposition(QString::fromAscii(m_reply->rawHeader("Content-Disposition")));

        if (!suggestedFilename.isEmpty())
            response.setSuggestedFilename(suggestedFilename);
        else
            response.setSuggestedFilename(url.lastPathComponent());

        response.setHTTPStatusCode(statusCode);
        response.setHTTPStatusText(m_reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray().constData());

        // Add remaining headers.
        foreach (const QByteArray& headerName, m_reply->rawHeaderList()) {
            response.setHTTPHeaderField(QString::fromAscii(headerName), QString::fromAscii(m_reply->rawHeader(headerName)));
        }
    }
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:60,代码来源:BCQNetworkReplyHandlerQt.cpp


示例4: aText

// Keep this in sync with the other platform event constructors
// TODO: m_balEventKey should be refcounted
PlatformKeyboardEvent::PlatformKeyboardEvent(BalEventKey* event)
    : m_type((event->state == SDL_RELEASED) ? KeyUp : KeyDown)
    , m_autoRepeat(false)
    , m_windowsVirtualKeyCode(ConvertSDLKeyToVirtualKey(event->keysym.sym, event->keysym.mod))
    , m_isKeypad(event->keysym.sym >= SDLK_KP0 && event->keysym.sym <= SDLK_KP_EQUALS)
    , m_shiftKey(event->keysym.mod & KMOD_SHIFT)
    , m_ctrlKey(event->keysym.mod & KMOD_CTRL)
    , m_altKey(event->keysym.mod & KMOD_ALT)
    , m_metaKey(event->keysym.mod & KMOD_META)
    , m_balEventKey(event)
{
    UChar aSrc[2];
    aSrc[0] = event->keysym.unicode;
    aSrc[1] = 0;

    WebCore::String aText(aSrc);
    WebCore::String aUnmodifiedText(aSrc);
    WebCore::String aKeyIdentifier = keyIdentifierForSDLKeyCode(event->keysym.sym);

    m_text = aText;
    m_unmodifiedText = aUnmodifiedText;
    m_keyIdentifier = aKeyIdentifier;

#if ENABLE(CEHTML)
    bool isVKKey = event->keysym.scancode == 0xFF && event->keysym.sym == event->keysym.unicode;
    if (UNLIKELY(isVKKey)) {
        WebCore::String vkKey = convertVKKeyToString(event->keysym.sym);
        ASSERT(!vkKey.isNull());
        m_keyIdentifier = vkKey;
        m_unmodifiedText = vkKey;
        m_windowsVirtualKeyCode = event->keysym.sym;
    }
#endif
}
开发者ID:ezrec,项目名称:owb-mirror,代码行数:36,代码来源:BCPlatformKeyboardEventSDL.cpp


示例5: write_string

static void write_string(WTF::Vector<char>& v, const WebCore::String& str)
{
    unsigned strLen = str.length();
    // Only do work if the string has data.
    if (strLen) {
        // Determine how much to grow the vector. Use the worst case for utf8 to
        // avoid reading the string twice. Add sizeof(unsigned) to hold the
        // string length in utf8.
        unsigned vectorLen = v.size() + sizeof(unsigned);
        unsigned length = (strLen << 2) + vectorLen;
        // Grow the vector. This will change the value of v.size() but we
        // remember the original size above.
        v.grow(length);
        // Grab the position to write to.
        char* data = v.begin() + vectorLen;
        // Write the actual string
        int l = SkUTF16_ToUTF8(str.characters(), strLen, data);
        LOGV("Writing string       %d %.*s", l, l, data);
        // Go back and write the utf8 length. Subtract sizeof(unsigned) from
        // data to get the position to write the length.
        memcpy(data - sizeof(unsigned), (char*)&l, sizeof(unsigned));
        // Shrink the internal state of the vector so we match what was
        // actually written.
        v.shrink(vectorLen + l);
    } else
        v.append((char*)&strLen, sizeof(unsigned));
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:27,代码来源:WebHistory.cpp


示例6: GetOrigins

static jobject GetOrigins(JNIEnv* env, jobject obj)
{
    Vector<RefPtr<WebCore::SecurityOrigin> > coreOrigins;
    WebCore::DatabaseTracker::tracker().origins(coreOrigins);
    Vector<WebCore::KURL> manifestUrls;
    if (WebCore::cacheStorage().manifestURLs(&manifestUrls)) {
        int size = manifestUrls.size();
        for (int i = 0; i < size; ++i) {
            RefPtr<WebCore::SecurityOrigin> manifestOrigin = WebCore::SecurityOrigin::create(manifestUrls[i]);
            if (manifestOrigin.get() == 0)
                continue;
            coreOrigins.append(manifestOrigin);
        }
    }

    jclass setClass = env->FindClass("java/util/HashSet");
    jmethodID cid = env->GetMethodID(setClass, "<init>", "()V");
    jmethodID mid = env->GetMethodID(setClass, "add", "(Ljava/lang/Object;)Z");
    jobject set = env->NewObject(setClass, cid);

    for (unsigned i = 0; i < coreOrigins.size(); ++i) {
        WebCore::SecurityOrigin* origin = coreOrigins[i].get();
        WebCore::String url = origin->toString();
        jstring jUrl = env->NewString(url.characters(), url.length());
        env->CallBooleanMethod(set, mid, jUrl);
        env->DeleteLocalRef(jUrl);
    }

    return set;
}
开发者ID:halfkiss,项目名称:ComponentSuperAccessor,代码行数:30,代码来源:WebStorage.cpp


示例7: method

HRESULT STDMETHODCALLTYPE DOMHTMLFormElement::method( 
        /* [retval][out] */ BSTR* result)
{
    ASSERT(m_element && m_element->hasTagName(formTag));
    WebCore::String methodString = static_cast<HTMLFormElement*>(m_element)->method();
    *result = BString(methodString.characters(), methodString.length()).release();
    return S_OK;
}
开发者ID:halfkiss,项目名称:ComponentSuperAccessor,代码行数:8,代码来源:DOMHTMLClasses.cpp


示例8: innerText

HRESULT STDMETHODCALLTYPE DOMHTMLElement::innerText( 
        /* [retval][out] */ BSTR* result)
{
    ASSERT(m_element && m_element->isHTMLElement());
    WebCore::String innerTextString = static_cast<HTMLElement*>(m_element)->innerText();
    *result = BString(innerTextString.characters(), innerTextString.length()).release();
    return S_OK;
}
开发者ID:halfkiss,项目名称:ComponentSuperAccessor,代码行数:8,代码来源:DOMHTMLClasses.cpp


示例9: strdup

/**
 * Return directory path where web database is stored.
 *
 * @return newly allocated string with database path. Note that return must be
 * freed with free() as it's a strdup()ed copy of the string due reference
 * counting.
 */
const char *ewk_settings_web_database_path_get()
{
#if ENABLE(DATABASE)
    WebCore::String path = WebCore::DatabaseTracker::tracker().databaseDirectoryPath();
    return strdup(path.utf8().data());
#else
    return 0;
#endif
}
开发者ID:mikedougherty,项目名称:webkit,代码行数:16,代码来源:ewk_settings.cpp


示例10: webkit_set_web_database_directory_path

/**
 * webkit_set_web_database_directory_path:
 * @path: the new database directory path
 *
 * Sets the current path to the directory WebKit will write Web 
 * Database databases. 
 *
 * Since: 1.1.14
 **/
void webkit_set_web_database_directory_path(const gchar* path)
{
#if ENABLE(DATABASE)
    WebCore::String corePath = WebCore::String::fromUTF8(path);
    WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(corePath);

    g_free(webkit_database_directory_path);
    webkit_database_directory_path = g_strdup(corePath.utf8().data());
#endif
}
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:19,代码来源:webkitwebdatabase.cpp


示例11: getPropertyValue

HRESULT STDMETHODCALLTYPE DOMCSSStyleDeclaration::getPropertyValue( 
    /* [in] */ BSTR propertyName,
    /* [retval][out] */ BSTR* result)
{
    WebCore::String propertyNameString(propertyName);
    WebCore::String value = m_style->getPropertyValue(propertyNameString);
    *result = SysAllocStringLen(value.characters(), value.length());
    if (value.length() && !*result)
        return E_OUTOFMEMORY;
    return S_OK;
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:11,代码来源:DOMCSSClasses.cpp


示例12: value

HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::value( 
        /* [retval][out] */ BSTR* result)
{
    ASSERT(m_element && m_element->hasTagName(textareaTag));
    HTMLTextAreaElement* textareaElement = static_cast<HTMLTextAreaElement*>(m_element);
    WebCore::String valueString = textareaElement->value();
    *result = BString(valueString.characters(), valueString.length()).release();
    if (valueString.length() && !*result)
        return E_OUTOFMEMORY;
    return S_OK;
}
开发者ID:halfkiss,项目名称:ComponentSuperAccessor,代码行数:11,代码来源:DOMHTMLClasses.cpp


示例13: ewk_settings_icon_database_path_get

/**
 * Return directory path where icon database is stored.
 *
 * @return newly allocated string with database path or @c NULL if
 *         none is set or database is closed. Note that return must be
 *         freed with free() as it's a strdup()ed copy of the string
 *         due reference counting.
 */
char* ewk_settings_icon_database_path_get(void)
{
    if (!WebCore::iconDatabase()->isEnabled())
        return 0;
    if (!WebCore::iconDatabase()->isOpen())
        return 0;

    WebCore::String path = WebCore::iconDatabase()->databasePath();
    if (path.isEmpty())
        return 0;
    return strdup(path.utf8().data());
}
开发者ID:mikedougherty,项目名称:webkit,代码行数:20,代码来源:ewk_settings.cpp


示例14: webkit_security_origin_get_host

/**
 * webkit_security_origin_get_host:
 * @security_origin: a #WebKitSecurityOrigin
 *
 * Returns the hostname for the security origin.
 *
 * Returns: the hostname for the security origin
 *
 * Since: 1.1.14
 **/
G_CONST_RETURN gchar* webkit_security_origin_get_host(WebKitSecurityOrigin* securityOrigin)
{
    g_return_val_if_fail(WEBKIT_IS_SECURITY_ORIGIN(securityOrigin), NULL);

    WebKitSecurityOriginPrivate* priv = securityOrigin->priv;
    WebCore::String host =  priv->coreOrigin->host();

    if (!priv->host)
        priv->host = g_strdup(host.utf8().data());

    return priv->host;
}
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:22,代码来源:webkitsecurityorigin.cpp


示例15: isValidProtocolString

static bool isValidProtocolString(const WebCore::String& protocol)
{
    if (protocol.isNull())
        return true;
    if (protocol.isEmpty())
        return false;
    const UChar* characters = protocol.characters();
    for (size_t i = 0; i < protocol.length(); i++) {
        if (characters[i] < 0x21 || characters[i] > 0x7E)
            return false;
    }
    return true;
}
开发者ID:dzip,项目名称:webkit,代码行数:13,代码来源:WebSocket.cpp


示例16: supportsMIMEType

bool PlugInInfoStore::supportsMIMEType(WebCore::String const& mimetype)
{
    logm(MODULE_FACILITIES, mimetype.deprecatedString().ascii());
    if (mimetype == "application/x-origyn-mediaplayer") {
        logm(MODULE_FACILITIES, make_message("mime-type '%s' is supported",
             mimetype.deprecatedString().ascii()));
        return true;
    } else {
        logm(MODULE_FACILITIES, make_message("mime-type '%s' is not supported",
             mimetype.deprecatedString().ascii()));
        return false;
    }
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:13,代码来源:BTPlugInInfoStore.cpp


示例17: willLoadFromCache

/*
* This static method is called to check to see if a POST response is in
* the cache. This may be slow, but is only used during a navigation to
* a POST response.
*/
bool WebCoreResourceLoader::willLoadFromCache(const WebCore::KURL& url, int64_t identifier)
{
    JNIEnv* env = JSC::Bindings::getJNIEnv();
    WebCore::String urlStr = url.string();
    jstring jUrlStr = env->NewString(urlStr.characters(), urlStr.length());
    jclass resourceLoader = env->FindClass("android/webkit/LoadListener");
    bool val = env->CallStaticBooleanMethod(resourceLoader, 
            gResourceLoader.mWillLoadFromCacheMethodID, jUrlStr, identifier);
    checkException(env);
    env->DeleteLocalRef(jUrlStr);

    return val;
}
开发者ID:Androtos,项目名称:toolchain_benchmark,代码行数:18,代码来源:WebCoreResourceLoader.cpp


示例18: webkit_get_web_database_directory_path

/**
 * webkit_get_web_database_directory_path:
 *
 * Returns the current path to the directory WebKit will write Web 
 * Database databases. By default this path will be in the user data
 * directory.
 *
 * Returns: the current database directory path
 *
 * Since: 1.1.14
 **/
G_CONST_RETURN gchar* webkit_get_web_database_directory_path()
{
#if ENABLE(DATABASE)
    WebCore::String path = WebCore::DatabaseTracker::tracker().databaseDirectoryPath();

    if (path.isEmpty())
        return "";

    g_free(webkit_database_directory_path);
    webkit_database_directory_path = g_strdup(path.utf8().data());
    return webkit_database_directory_path;
#else
    return "";
#endif
}
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:26,代码来源:webkitwebdatabase.cpp


示例19: webkit_web_history_item_get_original_uri

/**
 * webkit_web_history_item_get_original_uri:
 * @webHistoryItem: a #WebKitWebHistoryItem
 *
 * Returns the original URI of @webHistoryItem.
 *
 * Return value: the original URI of @webHistoryITem
 */
G_CONST_RETURN gchar* webkit_web_history_item_get_original_uri(WebKitWebHistoryItem* webHistoryItem)
{
    g_return_val_if_fail(WEBKIT_IS_WEB_HISTORY_ITEM(webHistoryItem), NULL);

    WebCore::HistoryItem* item = core(WEBKIT_WEB_HISTORY_ITEM(webHistoryItem));

    g_return_val_if_fail(item != NULL, NULL);

    WebCore::String originalUri = item->originalURLString();
    WebKitWebHistoryItemPrivate* priv = webHistoryItem->priv;
    g_free(priv->originalUri);
    priv->originalUri = g_strdup(originalUri.utf8().data());

    return webHistoryItem->priv->originalUri;
}
开发者ID:acss,项目名称:owb-mirror,代码行数:23,代码来源:webkitwebhistoryitem.cpp


示例20: webkit_web_history_item_get_alternate_title

/**
 * webkit_web_history_item_get_alternate_title:
 * @webHistoryItem: a #WebKitWebHistoryItem
 *
 * Returns the alternate title of @webHistoryItem
 *
 * Return value: the alternate title of @webHistoryItem
 */
G_CONST_RETURN gchar* webkit_web_history_item_get_alternate_title(WebKitWebHistoryItem* webHistoryItem)
{
    g_return_val_if_fail(WEBKIT_IS_WEB_HISTORY_ITEM(webHistoryItem), NULL);

    WebCore::HistoryItem* item = core(webHistoryItem);

    g_return_val_if_fail(item != NULL, NULL);

    WebKitWebHistoryItemPrivate* priv = webHistoryItem->priv;
    WebCore::String alternateTitle = item->alternateTitle();
    g_free(priv->alternateTitle);
    priv->alternateTitle = g_strdup(alternateTitle.utf8().data());

    return priv->alternateTitle;
}
开发者ID:acss,项目名称:owb-mirror,代码行数:23,代码来源:webkitwebhistoryitem.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ webcore::TestCallback类代码示例发布时间:2022-05-31
下一篇:
C++ webcore::Settings类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap