本文整理汇总了C++中webcore::HistoryItem类的典型用法代码示例。如果您正苦于以下问题:C++ HistoryItem类的具体用法?C++ HistoryItem怎么用?C++ HistoryItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HistoryItem类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: webkit_web_history_item_get_target
gchar* webkit_web_history_item_get_target(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);
WTF::CString t = item->target().utf8();
return g_strdup(t.data());
}
示例2: webkit_web_history_item_dispose
static void webkit_web_history_item_dispose(GObject* object)
{
WebKitWebHistoryItem* webHistoryItem = WEBKIT_WEB_HISTORY_ITEM(object);
WebKitWebHistoryItemPrivate* priv = webHistoryItem->priv;
if (!priv->disposed) {
WebCore::HistoryItem* item = core(webHistoryItem);
item->deref();
priv->disposed = true;
}
G_OBJECT_CLASS(webkit_web_history_item_parent_class)->dispose(object);
}
示例3: webkit_web_history_item_get_original_uri
/**
* webkit_web_history_item_get_original_uri:
* @web_history_item: a #WebKitWebHistoryItem
*
* Returns the original URI of @web_history_item.
*
* Return value: the original URI of @web_history_item
*/
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);
WebKitWebHistoryItemPrivate* priv = webHistoryItem->priv;
priv->originalUri = item->originalURLString().utf8();
return webHistoryItem->priv->originalUri.data();
}
示例4: webkit_web_history_item_get_alternate_title
/**
* webkit_web_history_item_get_alternate_title:
* @web_history_item: a #WebKitWebHistoryItem
*
* Returns the alternate title of @web_history_item
*
* Return value: the alternate title of @web_history_item
*/
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);
WebKitWebHistoryItemPrivate* priv = webHistoryItem->priv;
priv->alternateTitle = item->alternateTitle().utf8();
return priv->alternateTitle.data();
}
示例5: webkit_web_history_item_get_uri
/**
* webkit_web_history_item_get_uri:
* @web_history_item: a #WebKitWebHistoryItem
*
* Returns the URI of @this
*
* Return value: the URI of @web_history_item
*/
const gchar* webkit_web_history_item_get_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);
WebKitWebHistoryItemPrivate* priv = webHistoryItem->priv;
priv->uri = item->urlString().utf8();
return priv->uri.data();
}
示例6: webkit_web_history_item_get_uri
/**
* webkit_web_history_item_get_uri:
* @webHistoryItem: a #WebKitWebHistoryItem
*
* Returns the URI of @this
*
* Return value: the URI of @webHistoryItem
*/
G_CONST_RETURN gchar* webkit_web_history_item_get_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 uri = item->urlString();
WebKitWebHistoryItemPrivate* priv = webHistoryItem->priv;
g_free(priv->uri);
priv->uri = g_strdup(uri.utf8().data());
return priv->uri;
}
示例7: webkit_web_history_item_get_title
/**
* webkit_web_history_item_get_title:
* @webHistoryItem: a #WebKitWebHistoryItem
*
* Returns the page title of @webHistoryItem
*/
G_CONST_RETURN gchar* webkit_web_history_item_get_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 title = item->title();
g_free(priv->title);
priv->title = g_strdup(title.utf8().data());
return priv->title;
}
示例8: toPageState
PageState toPageState(const WebCore::HistoryItem& historyItem)
{
PageState pageState;
pageState.title = historyItem.title();
pageState.mainFrameState = toFrameState(historyItem);
return pageState;
}
示例9: webkit_web_history_item_get_children
GList* webkit_web_history_item_get_children(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);
const WebCore::HistoryItemVector& children = item->children();
if (!children.size())
return NULL;
unsigned size = children.size();
GList* kids = NULL;
for (unsigned i = 0; i < size; ++i)
kids = g_list_prepend(kids, kit(children[i].get()));
return g_list_reverse(kids);
}
示例10: unit_test
static void unit_test()
{
LOGD("Entering history unit test!");
const char* test1 = new char[0];
WTF::RefPtr<WebCore::HistoryItem> item = WebCore::HistoryItem::create();
WebCore::HistoryItem* testItem = item.get();
testItem->setBridge(new WebHistoryItem(0));
LOG_ASSERT(!read_item_recursive(testItem, &test1, 0), "0 length array should fail!");
delete[] test1;
const char* test2 = new char[2];
LOG_ASSERT(!read_item_recursive(testItem, &test2, 2), "Small array should fail!");
delete[] test2;
LOG_ASSERT(!read_item_recursive(testItem, NULL, HISTORY_MIN_SIZE), "Null data should fail!");
// Original Url
char* test3 = new char[HISTORY_MIN_SIZE];
const char* ptr = (const char*)test3;
memset(test3, 0, HISTORY_MIN_SIZE);
*(int*)test3 = 4000;
LOG_ASSERT(!read_item_recursive(testItem, &ptr, HISTORY_MIN_SIZE), "4000 length originalUrl should fail!");
// Url
int offset = 4;
memset(test3, 0, HISTORY_MIN_SIZE);
ptr = (const char*)test3;
*(int*)(test3 + offset) = 4000;
LOG_ASSERT(!read_item_recursive(testItem, &ptr, HISTORY_MIN_SIZE), "4000 length url should fail!");
// Title
offset += 4;
memset(test3, 0, HISTORY_MIN_SIZE);
ptr = (const char*)test3;
*(int*)(test3 + offset) = 4000;
LOG_ASSERT(!read_item_recursive(testItem, &ptr, HISTORY_MIN_SIZE), "4000 length title should fail!");
// Form content type
offset += 4;
memset(test3, 0, HISTORY_MIN_SIZE);
ptr = (const char*)test3;
*(int*)(test3 + offset) = 4000;
LOG_ASSERT(!read_item_recursive(testItem, &ptr, HISTORY_MIN_SIZE), "4000 length contentType should fail!");
// Form data
offset += 4;
memset(test3, 0, HISTORY_MIN_SIZE);
ptr = (const char*)test3;
*(int*)(test3 + offset) = 4000;
LOG_ASSERT(!read_item_recursive(testItem, &ptr, HISTORY_MIN_SIZE), "4000 length form data should fail!");
// Target
offset += 4;
memset(test3, 0, HISTORY_MIN_SIZE);
ptr = (const char*)test3;
*(int*)(test3 + offset) = 4000;
LOG_ASSERT(!read_item_recursive(testItem, &ptr, HISTORY_MIN_SIZE), "4000 length target should fail!");
offset += 4; // Scale
// Document state
offset += 4;
memset(test3, 0, HISTORY_MIN_SIZE);
ptr = (const char*)test3;
*(int*)(test3 + offset) = 4000;
LOG_ASSERT(!read_item_recursive(testItem, &ptr, HISTORY_MIN_SIZE), "4000 length document state should fail!");
// Is target item
offset += 1;
memset(test3, 0, HISTORY_MIN_SIZE);
ptr = (const char*)test3;
*(char*)(test3 + offset) = '!';
LOG_ASSERT(!read_item_recursive(testItem, &ptr, HISTORY_MIN_SIZE), "IsTargetItem should fail with ! as the value!");
// Child count
offset += 4;
memset(test3, 0, HISTORY_MIN_SIZE);
ptr = (const char*)test3;
*(int*)(test3 + offset) = 4000;
LOG_ASSERT(!read_item_recursive(testItem, &ptr, HISTORY_MIN_SIZE), "4000 kids should fail!");
offset = 36;
// Test document state
delete[] test3;
test3 = new char[HISTORY_MIN_SIZE + sizeof(unsigned)];
memset(test3, 0, HISTORY_MIN_SIZE + sizeof(unsigned));
ptr = (const char*)test3;
*(int*)(test3 + offset) = 1;
*(int*)(test3 + offset + 4) = 20;
LOG_ASSERT(!read_item_recursive(testItem, &ptr, HISTORY_MIN_SIZE + sizeof(unsigned)), "1 20 length document state string should fail!");
delete[] test3;
test3 = new char[HISTORY_MIN_SIZE + 2 * sizeof(unsigned)];
memset(test3, 0, HISTORY_MIN_SIZE + 2 * sizeof(unsigned));
ptr = (const char*)test3;
*(int*)(test3 + offset) = 2;
*(int*)(test3 + offset + 4) = 0;
*(int*)(test3 + offset + 8) = 20;
LOG_ASSERT(!read_item_recursive(testItem, &ptr, HISTORY_MIN_SIZE + 2 * sizeof(unsigned) ), "2 20 length document state string should fail!");
delete[] test3;
}