本文整理汇总了C++中prop_destroy函数的典型用法代码示例。如果您正苦于以下问题:C++ prop_destroy函数的具体用法?C++ prop_destroy怎么用?C++ prop_destroy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prop_destroy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: playtrack_dtor
static void
playtrack_dtor(event_t *e)
{
event_playtrack_t *ep = (event_playtrack_t *)e;
prop_destroy(ep->track);
if(ep->source != NULL)
prop_destroy(ep->source);
}
示例2: js_appendItem0
static JSBool
js_appendItem0(JSContext *cx, js_model_t *model, prop_t *parent,
const char *url, const char *type, JSObject *metaobj,
jsval *data, jsval *rval, int enabled,
const char *metabind)
{
prop_t *item = prop_create_root(NULL);
if(url != NULL)
prop_set_string(prop_create(item, "url"), url);
if(data != NULL)
js_prop_set_from_jsval(cx, prop_create(item, "data"), *data);
*rval = JSVAL_VOID;
if(metabind != NULL)
metadb_bind_url_to_prop(NULL, metabind, item);
if(type != NULL) {
prop_set_string(prop_create(item, "type"), type);
if(metaobj)
js_prop_from_object(cx, metaobj, prop_create(item, "metadata"));
} else if(url != NULL) {
if(backend_resolve_item(url, item)) {
prop_destroy(item);
return JS_TRUE;
}
}
prop_set_int(prop_create(item, "enabled"), enabled);
prop_t *p = prop_ref_inc(item);
if(prop_set_parent(item, parent)) {
prop_destroy(item);
prop_ref_dec(p);
} else {
JSObject *robj =
JS_NewObjectWithGivenProto(cx, &item_class,
JSVAL_TO_OBJECT(model->jm_item_proto), NULL);
*rval = OBJECT_TO_JSVAL(robj);
js_item_t *ji = calloc(1, sizeof(js_item_t));
ji->ji_model = model;
ji->ji_root = p;
LIST_INSERT_HEAD(&model->jm_items, ji, ji_link);
JS_SetPrivate(cx, robj, ji);
ji->ji_enable_set_property = 1;
}
return JS_TRUE;
}
示例3: news_sink
static void
news_sink(void *opaque, prop_event_t event, ...)
{
prop_t *p = opaque;
event_t *e;
va_list ap;
va_start(ap, event);
switch(event) {
case PROP_DESTROYED:
prop_unsubscribe(va_arg(ap, prop_sub_t *));
prop_ref_dec(p);
break;
case PROP_EXT_EVENT:
e = va_arg(ap, event_t *);
if(event_is_type(e, EVENT_DYNAMIC_ACTION)) {
const event_payload_t *ep = (const event_payload_t *)e;
if(!strcmp(ep->payload, "dismiss")) {
rstr_t *id = prop_get_string(p, "id", NULL);
dismis_news(rstr_get(id));
rstr_release(id);
prop_destroy(opaque);
}
}
break;
default:
break;
}
va_end(ap);
}
示例4: js_item_addOptAction
static JSBool
js_item_addOptAction(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
js_item_t *ji = JS_GetPrivate(cx, obj);
const char *title;
const char *action;
if (!JS_ConvertArguments(cx, argc, argv, "ss", &title, &action))
return JS_FALSE;
prop_t *p = prop_create_root(NULL);
prop_set_string(prop_create(p, "type"), "action");
prop_set_string(prop_create(prop_create(p, "metadata"), "title"), title);
prop_set_int(prop_create(p, "enabled"), 1);
prop_set_string(prop_create(p, "action"), action);
prop_t *opts = prop_create_r(ji->ji_root, "options");
if(prop_set_parent(p, opts))
prop_destroy(p);
prop_ref_dec(opts);
*rval = JSVAL_VOID;
return JS_TRUE;
}
示例5: trace_prop
static void
trace_prop(int l, const char *pfx, const char *msg, const char *sev)
{
trace_entry_t *te = malloc(sizeof(trace_entry_t));
te->p = prop_create_root(NULL);
prop_set_string(prop_create(te->p, "prefix"), pfx);
prop_set_string(prop_create(te->p, "message"), msg);
prop_set_string(prop_create(te->p, "severity"), sev);
TAILQ_INSERT_TAIL(&traces, te, link);
if(prop_set_parent(te->p, log_root))
abort();
entries++;
if(entries > 50) {
te = TAILQ_FIRST(&traces);
TAILQ_REMOVE(&traces, te, link);
prop_destroy(te->p);
free(te);
entries--;
}
}
示例6: add_news_locked
static prop_t *
add_news_locked(const char *id, const char *message,
const char *location, const char *caption,
const char *action)
{
prop_t *p, *ret = NULL;
prop_t *root = prop_create(prop_get_global(), "news");
if(dismissed_news_out != NULL) {
if(htsmsg_get_u32_or_default(dismissed_news_in, id, 0)) {
dismis_news(id);
} else {
p = prop_create_root(id);
prop_set(p, "message", PROP_SET_STRING, message);
prop_set(p, "id", PROP_SET_STRING, id);
prop_set(p, "location", PROP_SET_STRING, location);
prop_set(p, "caption", PROP_SET_STRING, caption);
prop_set(p, "action", PROP_SET_STRING, action);
prop_subscribe(PROP_SUB_TRACK_DESTROY,
PROP_TAG_CALLBACK, news_sink, prop_ref_inc(p),
PROP_TAG_ROOT, prop_create(p, "eventSink"),
PROP_TAG_MUTEX, &news_mutex,
NULL);
ret = prop_ref_inc(p);
if(prop_set_parent(p, root))
prop_destroy(p);
}
}
return ret;
}
示例7: nav_reload_current
static void
nav_reload_current(navigator_t *nav)
{
nav_page_t *np;
if((np = nav->nav_page_current) == NULL)
return;
plugins_reload_dev_plugin();
TRACE(TRACE_INFO, "navigator", "Reloading %s", np->np_url);
prop_unsubscribe(np->np_close_sub);
prop_unsubscribe(np->np_direct_close_sub);
prop_destroy(np->np_prop_root);
nav_page_setup_prop(nav, np, NULL);
if(prop_set_parent(np->np_prop_root, nav->nav_prop_pages)) {
/* nav->nav_prop_pages is a zombie, this is an error */
abort();
}
nav_select(nav, np, NULL);
if(backend_open(np->np_prop_root, np->np_url))
nav_open_errorf(np->np_prop_root, _("No handler for URL"));
}
示例8: message_popup
int
message_popup(const char *message, int flags)
{
prop_t *p;
int rval;
p = prop_create_root(NULL);
prop_set_string(prop_create(p, "type"), "message");
prop_set_string_ex(prop_create(p, "message"), NULL, message,
flags & MESSAGE_POPUP_RICH_TEXT ?
PROP_STR_RICH : PROP_STR_UTF8);
if(flags & MESSAGE_POPUP_CANCEL)
prop_set_int(prop_create(p, "cancel"), 1);
if(flags & MESSAGE_POPUP_OK)
prop_set_int(prop_create(p, "ok"), 1);
event_t *e = popup_display(p);
prop_destroy(p);
if(event_is_action(e, ACTION_OK))
rval = MESSAGE_POPUP_OK;
else if(event_is_action(e, ACTION_CANCEL))
rval = MESSAGE_POPUP_CANCEL;
else
rval = 0;
event_release(e);
return rval;
}
示例9: add_news
prop_t *
add_news(const char *message, const char *location, const char *caption)
{
prop_t *p, *ret = NULL;
prop_t *root = prop_create(prop_get_global(), "news");
hts_mutex_lock(&news_mutex);
if(dismissed_news_out != NULL) {
if(htsmsg_get_u32_or_default(dismissed_news_in, message, 0)) {
dismis_news(message);
} else {
p = prop_create_root(NULL);
prop_set_string(prop_create(p, "message"), message);
prop_set_string(prop_create(p, "location"), location);
prop_set_string(prop_create(p, "caption"), caption);
prop_subscribe(PROP_SUB_TRACK_DESTROY,
PROP_TAG_CALLBACK, news_sink, prop_ref_inc(p),
PROP_TAG_ROOT, prop_create(p, "eventSink"),
PROP_TAG_MUTEX, &news_mutex,
NULL);
ret = prop_ref_inc(p);
if(prop_set_parent(p, root))
prop_destroy(p);
}
}
hts_mutex_unlock(&news_mutex);
return ret;
}
示例10: nav_close
static void
nav_close(nav_page_t *np, int with_prop)
{
navigator_t *nav = np->np_nav;
prop_unsubscribe(np->np_close_sub);
prop_unsubscribe(np->np_url_sub);
prop_unsubscribe(np->np_direct_close_sub);
if(nav->nav_page_current == np)
nav->nav_page_current = NULL;
if(np->np_inhistory)
nav_remove_from_history(nav, np);
TAILQ_REMOVE(&nav->nav_pages, np, np_global_link);
if(with_prop) {
prop_destroy(np->np_prop_root);
nav_update_cango(nav);
}
free(np->np_url);
free(np->np_view);
free(np);
}
示例11: search_class_create
int
search_class_create(prop_t *parent, prop_t **nodesp, prop_t **entriesp,
const char *title, const char *icon)
{
prop_t *p = prop_create_root(NULL);
prop_t *m = prop_create(p, "metadata");
prop_t *n, *e;
char url[URL_MAX];
backend_prop_make(p, url, sizeof(url));
prop_set_string(prop_create(p, "url"), url);
prop_set_string(prop_create(m, "title"), title);
if(icon != NULL)
prop_set_string(prop_create(m, "icon"), icon);
prop_set_string(prop_create(p, "type"), "directory");
n = prop_create(p, "nodes");
e = prop_create(p, "entries");
prop_set_int(e, 0);
*nodesp = prop_ref_inc(n);
*entriesp = prop_ref_inc(e);
if(prop_set_parent(p, parent)) {
prop_destroy(p);
return 1;
}
return 0;
}
示例12: mp_final_release
static void
mp_final_release(void *aux)
{
media_pipe_t *mp = aux;
prop_destroy(mp->mp_prop_root);
free(mp);
}
示例13: prop_vec_destroy_entries
void
prop_vec_destroy_entries(prop_vec_t *pv)
{
int i;
for(i = 0; i < pv->pv_length; i++)
prop_destroy(pv->pv_vec[i]);
}
示例14: notify_timeout
static void
notify_timeout(callout_t *c, void *aux)
{
prop_t *p = aux;
prop_destroy(p);
prop_ref_dec(p);
free(c);
}
示例15: channel_destroy
static void
channel_destroy(htsp_connection_t *hc, htsp_channel_t *ch)
{
prop_destroy(ch->ch_root);
TAILQ_REMOVE(&hc->hc_channels, ch, ch_link);
free(ch->ch_title);
free(ch);
}