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


C++ String::utf8方法代码示例

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


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

示例1: load

void MediaPlayerPrivate::load(const WTF::String& url)
{
    WTF::String modifiedUrl(url);

    if (modifiedUrl.startsWith("local://")) {
        KURL kurl = KURL(KURL(), modifiedUrl);
        kurl.setProtocol("file");
        WTF::String tempPath(BlackBerry::Platform::Settings::instance()->applicationLocalDirectory().c_str());
        tempPath.append(kurl.path());
        kurl.setPath(tempPath);
        modifiedUrl = kurl.string();
    }
    if (modifiedUrl.startsWith("file://")) {
        // The QNX Multimedia Framework cannot handle filenames containing URL escape sequences.
        modifiedUrl = decodeURLEscapeSequences(modifiedUrl);
    }

    void* tabId = m_webCorePlayer->mediaPlayerClient()->mediaPlayerHostWindow()->platformPageClient();
    int playerID = m_webCorePlayer->mediaPlayerClient()->mediaPlayerHostWindow()->platformPageClient()->playerID();

    deleteGuardedObject(m_platformPlayer);
#if USE(ACCELERATED_COMPOSITING)
    m_platformPlayer = PlatformPlayer::create(this, tabId, true, modifiedUrl.utf8().data());
#else
    m_platformPlayer = PlatformPlayer::create(this, tabId, false, modifiedUrl.utf8().data());
#endif

    WTF::String cookiePairs;
    if (!url.isEmpty())
        cookiePairs = cookieManager().getCookie(KURL(ParsedURLString, url.utf8().data()), WithHttpOnlyCookies);
    if (!cookiePairs.isEmpty() && cookiePairs.utf8().data())
        m_platformPlayer->load(playerID, modifiedUrl.utf8().data(), m_webCorePlayer->userAgent().utf8().data(), cookiePairs.utf8().data());
    else
        m_platformPlayer->load(playerID, modifiedUrl.utf8().data(), m_webCorePlayer->userAgent().utf8().data(), 0);
}
开发者ID:kcomkar,项目名称:webkit,代码行数:35,代码来源:MediaPlayerPrivateBlackBerry.cpp

示例2: ewk_settings_web_database_path_set

/**
 * Sets the current path to the directory WebKit will write Web
 * Database databases.
 *
 * @path: the new database directory path
 *
 */
void ewk_settings_web_database_path_set(const char *path)
{
#if ENABLE(DATABASE)
    WTF::String corePath = WTF::String::fromUTF8(path);
    WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(corePath);
    if (!_ewk_default_web_database_path)
        _ewk_default_web_database_path = eina_stringshare_add(corePath.utf8().data());
    else
        eina_stringshare_replace(&_ewk_default_web_database_path, corePath.utf8().data());

#endif
}
开发者ID:,项目名称:,代码行数:19,代码来源:

示例3: start

bool NetscapePluginStream::start(const WTF::String& responseURLString, uint32_t streamLength, uint32_t lastModifiedTime, const String& mimeType, const String& headers)
{
    m_responseURL = responseURLString.utf8();
    m_mimeType = mimeType.utf8();
    m_headers = headers.utf8();

    m_npStream.ndata = this;
    m_npStream.url = m_responseURL.data();
    m_npStream.end = streamLength;
    m_npStream.lastmodified = lastModifiedTime;
    m_npStream.notifyData = m_notificationData;
    m_npStream.headers = m_headers.length() == 0 ? 0 : m_headers.data();

    NPError error = m_plugin->NPP_NewStream(const_cast<char*>(m_mimeType.data()), &m_npStream, false, &m_transferMode);
    if (error != NPERR_NO_ERROR) {
        // We failed to start the stream, cancel the load and destroy it.
        cancel();
        notifyAndDestroyStream(NPRES_NETWORK_ERR);
        return false;
    }

    // We successfully started the stream.
    m_isStarted = true;

    if (!isSupportedTransferMode(m_transferMode)) {
        // Cancel the load and stop the stream.
        cancel();
        stop(NPRES_NETWORK_ERR);
        return false;
    }

    return true;
}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例4: ewk_settings_default_user_agent_get

/**
 * @internal
 *
 * Gets the default user agent string.
 *
 * @return a pointer to an eina_stringshare containing the user agent string
 */
const char* ewk_settings_default_user_agent_get()
{
    WTF::String uaVersion = String::number(WEBKIT_MAJOR_VERSION) + '.' + String::number(WEBKIT_MINOR_VERSION) + '+';
    WTF::String staticUa = "Mozilla/5.0 (" + _ewk_settings_webkit_platform_get() + "; " + _ewk_settings_webkit_os_version_get() + ") AppleWebKit/" + uaVersion + " (KHTML, like Gecko) Version/5.0 Safari/" + uaVersion;

    return eina_stringshare_add(staticUa.utf8().data());
}
开发者ID:JefferyJeffery,项目名称:webkit,代码行数:14,代码来源:ewk_settings.cpp

示例5: ewk_settings_default_user_agent_get

/**
 * @internal
 *
 * Gets the default user agent string.
 *
 * @return a pointer to an eina_stringshare containing the user agent string
 */
const char* ewk_settings_default_user_agent_get()
{
    WTF::String uaVersion = makeString(String::number(WEBKIT_USER_AGENT_MAJOR_VERSION), '.', String::number(WEBKIT_USER_AGENT_MINOR_VERSION), '+');
    WTF::String staticUa = makeString("Mozilla/5.0 (", _ewk_settings_webkit_platform_get(), "; ", _ewk_settings_webkit_os_version_get(), ") AppleWebKit/", uaVersion) + makeString(" (KHTML, like Gecko) Version/5.0 Safari/", uaVersion);

    return eina_stringshare_add(staticUa.utf8().data());
}
开发者ID:yang-bo,项目名称:webkit,代码行数:14,代码来源:ewk_settings.cpp

示例6: showGraphicsLayerTree

void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer)
{
    if (!layer)
        return;

    WTF::String output = layer->layerTreeAsText(LayerTreeAsTextDebug);
    fprintf(stderr, "%s\n", output.utf8().data());
}
开发者ID:Moondee,项目名称:Artemis,代码行数:8,代码来源:GraphicsLayer.cpp

示例7: getOptionalConstraintValue

bool MediaConstraints::getOptionalConstraintValue(const char* name, std::string& value) const
{
    ASSERT(!isNull());
    WTF::String result;
    if (m_private->getOptionalConstraintValue(name, result)) {
        value = result.utf8().data();
        return true;
    }
    return false;
}
开发者ID:,项目名称:,代码行数:10,代码来源:

示例8: 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)
    WTF::String corePath = WTF::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:,项目名称:,代码行数:19,代码来源:

示例9: RegisterMockedUrl

 KURL RegisterMockedUrl(const std::string& urlRoot, const WTF::String& filename)
 {
     WebURLResponse response;
     response.initialize();
     response.setMIMEType("text/html");
     WTF::String localPath = m_baseFilePath;
     localPath.append(filename);
     KURL url = toKURL(urlRoot + filename.utf8().data());
     Platform::current()->unitTestSupport()->registerMockedURL(url, response, localPath);
     return url;
 }
开发者ID:smishenk,项目名称:chromium-crosswalk,代码行数:11,代码来源:AssociatedURLLoaderTest.cpp

示例10: webkit_security_origin_get_host

/**
 * webkit_security_origin_get_host:
 * @securityOrigin: 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;
    WTF::String host =  priv->coreOrigin->host();

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

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

示例11: replaceCharactersForResults

static gchar* replaceCharactersForResults(gchar* str)
{
    WTF::String uString = WTF::String::fromUTF8(str);

    // The object replacement character is passed along to ATs so we need to be
    // able to test for their presence and do so without causing test failures.
    uString.replace(objectReplacementCharacter, "<obj>");

    // The presence of newline characters in accessible text of a single object
    // is appropriate, but it makes test results (especially the accessible tree)
    // harder to read.
    uString.replace("\n", "<\\n>");

    return g_strdup(uString.utf8().data());
}
开发者ID:,项目名称:,代码行数:15,代码来源:

示例12: 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)
    WTF::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:,项目名称:,代码行数:26,代码来源:

示例13: strdup

char*
DumpRenderTreeWKC::dumpRenderTree(WKC::WKCWebFrame* frame)
{
    WKC::Frame* wkcframe = frame->core();
    WebCore::Frame* core_frame= wkcframe->priv().webcore();
    if (!core_frame)
        return strdup("");

    WebCore::FrameView* view = core_frame->view();

    if (view && view->layoutPending())
        view->layout();

    WTF::String string = WebCore::externalRepresentation(core_frame);
    return strdup(string.utf8().data());
}
开发者ID:biddyweb,项目名称:switch-oss,代码行数:16,代码来源:DumpRenderTree.cpp

示例14: ewk_web_database_filename_get

const char* ewk_web_database_filename_get(Ewk_Web_Database* database)
{
#if ENABLE(SQL_DATABASE)
    if (database->filename)
        return database->filename;

    WebCore::SecurityOrigin* origin = database->securityOrigin.get();
    WTF::String path = WebCore::DatabaseManager::manager().fullPathForDatabase(origin, database->coreName);
    database->filename = eina_stringshare_add(path.utf8().data());

    return database->filename;
#else
    UNUSED_PARAM(database);
    return 0;
#endif
}
开发者ID:harlanlewis,项目名称:webkit,代码行数:16,代码来源:ewk_web_database.cpp

示例15: webkit_web_database_get_display_name

/**
 * webkit_web_database_get_display_name:
 * @webDatabase: a #WebKitWebDatabase
 *
 * Returns the name of the #WebKitWebDatabase as seen by the user.
 *
 * Returns: the name of the database as seen by the user.
 *
 * Since: 1.1.14
 **/
G_CONST_RETURN gchar* webkit_web_database_get_display_name(WebKitWebDatabase* webDatabase)
{
    g_return_val_if_fail(WEBKIT_IS_WEB_DATABASE(webDatabase), NULL);

#if ENABLE(DATABASE)
    WebKitWebDatabasePrivate* priv = webDatabase->priv;
    WebCore::DatabaseDetails details = WebCore::DatabaseTracker::tracker().detailsForNameAndOrigin(priv->name, core(priv->origin));
    WTF::String displayName =  details.displayName();

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

    g_free(priv->displayName);
    priv->displayName = g_strdup(displayName.utf8().data());
    return priv->displayName;
#else
    return "";
#endif
}
开发者ID:,项目名称:,代码行数:29,代码来源:


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