本文整理汇总了C++中webcore::String::utf8方法的典型用法代码示例。如果您正苦于以下问题:C++ String::utf8方法的具体用法?C++ String::utf8怎么用?C++ String::utf8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webcore::String
的用法示例。
在下文中一共展示了String::utf8方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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
}
示例3: 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
}
示例4: 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());
}
示例5: 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;
}
示例6: 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
}
示例7: 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;
}
示例8: 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;
}
示例9: webkit_web_database_get_display_name
/**
* webkit_web_database_get_display_name:
* @web_database: 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));
WebCore::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
}
示例10: webkit_web_database_get_filename
/**
* webkit_web_database_get_filename:
* @web_database: a #WebKitWebDatabase
*
* Returns the absolute filename to the #WebKitWebDatabase file on disk.
*
* Returns: the absolute filename of the database
*
* Since: 1.1.14
**/
G_CONST_RETURN gchar* webkit_web_database_get_filename(WebKitWebDatabase* webDatabase)
{
g_return_val_if_fail(WEBKIT_IS_WEB_DATABASE(webDatabase), NULL);
#if ENABLE(DATABASE)
WebKitWebDatabasePrivate* priv = webDatabase->priv;
WebCore::String coreName = WebCore::String::fromUTF8(priv->name);
WebCore::String corePath = WebCore::DatabaseTracker::tracker().fullPathForDatabase(core(priv->origin), coreName);
if (corePath.isEmpty())
return"";
g_free(priv->filename);
priv->filename = g_strdup(corePath.utf8().data());
return priv->filename;
#else
return "";
#endif
}
示例11: addMessageToConsole
void ChromeClient::addMessageToConsole(WebCore::MessageSource source, WebCore::MessageType type, WebCore::MessageLevel level, const WebCore::String& message, unsigned int lineNumber, const WebCore::String& sourceId)
{
gboolean retval;
g_signal_emit_by_name(m_webView, "console-message", message.utf8().data(), lineNumber, sourceId.utf8().data(), &retval);
}
示例12: Sync
//.........这里部分代码省略.........
#ifdef ANDROID_BLOCK_NETWORK_IMAGE
flag = env->GetBooleanField(obj, gFieldIds->mBlockNetworkImage);
s->setBlockNetworkImage(flag);
if(!flag)
docLoader->setBlockNetworkImage(false);
#endif
flag = env->GetBooleanField(obj, gFieldIds->mJavaScriptEnabled);
s->setJavaScriptEnabled(flag);
// ON = 0
// ON_DEMAND = 1
// OFF = 2
jobject pluginState = env->GetObjectField(obj, gFieldIds->mPluginState);
int state = env->CallIntMethod(pluginState, gFieldIds->mOrdinal);
s->setPluginsEnabled(state < 2);
#ifdef ANDROID_PLUGINS
s->setPluginsOnDemand(state == 1);
#endif
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
flag = env->GetBooleanField(obj, gFieldIds->mAppCacheEnabled);
s->setOfflineWebApplicationCacheEnabled(flag);
str = (jstring)env->GetObjectField(obj, gFieldIds->mAppCachePath);
if (str) {
WebCore::String path = to_string(env, str);
if (path.length() && WebCore::cacheStorage().cacheDirectory().isNull()) {
WebCore::cacheStorage().setCacheDirectory(path);
// This database is created on the first load. If the file
// doesn't exist, we create it and set its permissions. The
// filename must match that in ApplicationCacheStorage.cpp.
String filename = pathByAppendingComponent(path, "ApplicationCache.db");
int fd = open(filename.utf8().data(), O_CREAT | O_EXCL, permissionFlags660);
if (fd >= 0)
close(fd);
}
}
jlong maxsize = env->GetIntField(obj, gFieldIds->mAppCacheMaxSize);
WebCore::cacheStorage().setMaximumSize(maxsize);
#endif
flag = env->GetBooleanField(obj, gFieldIds->mJavaScriptCanOpenWindowsAutomatically);
s->setJavaScriptCanOpenWindowsAutomatically(flag);
#ifdef ANDROID_LAYOUT
flag = env->GetBooleanField(obj, gFieldIds->mUseWideViewport);
s->setUseWideViewport(flag);
#endif
#ifdef ANDROID_MULTIPLE_WINDOWS
flag = env->GetBooleanField(obj, gFieldIds->mSupportMultipleWindows);
s->setSupportMultipleWindows(flag);
#endif
flag = env->GetBooleanField(obj, gFieldIds->mShrinksStandaloneImagesToFit);
s->setShrinksStandaloneImagesToFit(flag);
#if ENABLE(DATABASE)
flag = env->GetBooleanField(obj, gFieldIds->mDatabaseEnabled);
s->setDatabasesEnabled(flag);
flag = env->GetBooleanField(obj, gFieldIds->mDatabasePathHasBeenSet);
if (flag) {
// If the user has set the database path, sync it to the DatabaseTracker.
str = (jstring)env->GetObjectField(obj, gFieldIds->mDatabasePath);
if (str) {
String path = to_string(env, str);