本文整理汇总了C++中FV_View::cmdUpdateEmbed方法的典型用法代码示例。如果您正苦于以下问题:C++ FV_View::cmdUpdateEmbed方法的具体用法?C++ FV_View::cmdUpdateEmbed怎么用?C++ FV_View::cmdUpdateEmbed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FV_View
的用法示例。
在下文中一共展示了FV_View::cmdUpdateEmbed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void GOComponentView::update ()
{
UT_return_if_fail (component);
UT_Byte *buf;
int length;
void (*clearfunc) (gpointer);
gpointer user_data = NULL;
FV_View *pView = m_pRun->getBlock ()->getView ();
if (go_component_get_data (component, (void**) &buf, &length, &clearfunc, &user_data)) {
if (buf && length) {
UT_ByteBufPtr myByteBuf(new UT_ByteBuf);
myByteBuf->append(buf, length);
mime_type = component->mime_type;
UT_String Props="embed-type: GOComponent";
guint i, nbprops;
GType prop_type;
GValue value = G_VALUE_INIT;
char *prop = NULL;
GParamSpec **specs = g_object_class_list_properties (
G_OBJECT_GET_CLASS (component), &nbprops);
for (i = 0; i < nbprops; i++) {
if (specs[i]->flags & GO_PARAM_PERSISTENT) {
prop_type = G_PARAM_SPEC_VALUE_TYPE (specs[i]);
g_value_init (&value, prop_type);
g_object_get_property (G_OBJECT (component), specs[i]->name, &value);
if (!g_param_value_defaults (specs[i], &value))
switch (G_TYPE_FUNDAMENTAL (prop_type)) {
case G_TYPE_CHAR:
case G_TYPE_UCHAR:
case G_TYPE_BOOLEAN:
case G_TYPE_INT:
case G_TYPE_UINT:
case G_TYPE_LONG:
case G_TYPE_ULONG:
case G_TYPE_FLOAT:
case G_TYPE_DOUBLE: {
GValue str = G_VALUE_INIT;
g_value_init (&str, G_TYPE_STRING);
g_value_transform (&value, &str);
prop = g_strdup (g_value_get_string (&str));
g_value_unset (&str);
break;
}
case G_TYPE_STRING: {
prop = g_strdup (g_value_get_string (&value));
break;
}
default:
prop = NULL;
break;
}
g_value_unset (&value);
if (prop) {
Props += UT_String_sprintf("; %s:%s", specs[i]->name, prop);
g_free (prop);
prop = NULL;
}
}
}
pView->cmdUpdateEmbed(m_pRun, myByteBuf, mime_type.c_str(), Props.c_str());
} else
pView->cmdDeleteEmbed(m_pRun);
if (clearfunc)
clearfunc ((user_data)? user_data: buf);
}
}