本文整理汇总了C++中prop_create函数的典型用法代码示例。如果您正苦于以下问题:C++ prop_create函数的具体用法?C++ prop_create怎么用?C++ prop_create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prop_create函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: glw_slideshow_set_roots
static void
glw_slideshow_set_roots(glw_t *w, prop_t *self, prop_t *parent, prop_t *clone)
{
glw_slideshow_t *s = (glw_slideshow_t *)w;
s->playstatus = prop_create(prop_create(self, "slideshow"), "playstatus");
}
示例2: 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--;
}
}
示例3: nav_create
static navigator_t *
nav_create(prop_t *prop)
{
navigator_t *nav = calloc(1, sizeof(navigator_t));
nav->nav_prop_root = prop;
TAILQ_INIT(&nav->nav_pages);
TAILQ_INIT(&nav->nav_history);
nav->nav_prop_pages = prop_create(nav->nav_prop_root, "pages");
nav->nav_prop_curpage = prop_create(nav->nav_prop_root, "currentpage");
nav->nav_prop_can_go_back = prop_create(nav->nav_prop_root, "canGoBack");
nav->nav_prop_can_go_fwd = prop_create(nav->nav_prop_root, "canGoForward");
nav->nav_prop_can_go_home = prop_create(nav->nav_prop_root, "canGoHome");
prop_set_int(nav->nav_prop_can_go_home, 1);
nav->nav_pc = prop_courier_create_thread(NULL, "navigator");
nav->nav_eventsink =
prop_subscribe(0,
PROP_TAG_NAME("nav", "eventsink"),
PROP_TAG_CALLBACK, nav_eventsink, nav,
PROP_TAG_COURIER, nav->nav_pc,
PROP_TAG_ROOT, nav->nav_prop_root,
NULL);
nav->nav_dtor_tracker =
prop_subscribe(PROP_SUB_TRACK_DESTROY,
PROP_TAG_CALLBACK, nav_dtor_tracker, nav,
PROP_TAG_COURIER, nav->nav_pc,
PROP_TAG_ROOT, nav->nav_prop_root,
NULL);
return nav;
}
示例4: audio_mastervol_init
static void
audio_mastervol_init(void)
{
htsmsg_t *m = htsmsg_store_load("audiomixer");
int32_t i32;
prop_t *pa, *mv, *mm;
pa = prop_create(prop_get_global(), "audio");
mv = prop_create(pa, "mastervolume");
mm = prop_create(pa, "mastermute");
prop_set_float_clipping_range(mv, -75, 12);
if(m != NULL && !htsmsg_get_s32(m, "master-volume", &i32))
prop_set_float(mv, (float)i32 / 1000);
prop_set_int(mm, 0);
htsmsg_release(m);
prop_subscribe(PROP_SUB_NO_INITIAL_UPDATE,
PROP_TAG_CALLBACK_FLOAT, save_matervol, NULL,
PROP_TAG_ROOT, mv,
NULL);
prop_subscribe(PROP_SUB_NO_INITIAL_UPDATE,
PROP_TAG_SET_INT, &audio_master_mute,
PROP_TAG_ROOT, mm,
NULL);
}
示例5: 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;
}
示例6: 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;
}
示例7: audio_mastervol_init
void
audio_mastervol_init(void)
{
htsmsg_t *m = htsmsg_store_load("audiomixer");
int32_t i32;
prop_t *prop_audio;
prop_audio = prop_create(prop_get_global(), "audio");
prop_mastervol = prop_create(prop_audio, "mastervolume");
prop_mastermute = prop_create(prop_audio, "mastermute");
prop_set_float_clipping_range(prop_mastervol, -75, 0);
prop_set_int(prop_mastermute, 0);
if(m != NULL && !htsmsg_get_s32(m, "master-volume", &i32))
prop_set_float(prop_mastervol, (float)i32 / 1000);
htsmsg_destroy(m);
prop_subscribe(PROP_SUB_NO_INITIAL_UPDATE,
PROP_TAG_CALLBACK_FLOAT, save_matervol, NULL,
PROP_TAG_ROOT, prop_mastervol,
NULL);
}
示例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: file_open_dir
static int
file_open_dir(prop_t *page, const char *url)
{
prop_t *model;
int type;
char parent[URL_MAX];
int r;
fa_handle_t *ref;
ref = fa_reference(url);
type = fa_probe_dir(NULL, url);
if(type == CONTENT_DVD) {
r = backend_open_video(page, url);
} else {
model = prop_create(page, "model");
prop_set_string(prop_create(model, "type"), "directory");
/* Find a meaningful page title (last component of URL) */
set_title_from_url(prop_create(model, "metadata"), url);
// Set parent
if(!fa_parent(parent, sizeof(parent), url))
prop_set_string(prop_create(page, "parent"), parent);
fa_scanner(url, model, NULL);
r = 0;
}
fa_unreference(ref);
return r;
}
示例10: file_open_audio
/**
* Try to open the given URL with a playqueue context
*/
static int
file_open_audio(prop_t *page, const char *url)
{
char parent[URL_MAX];
char parent2[URL_MAX];
struct fa_stat fs;
prop_t *model;
if(fa_parent(parent, sizeof(parent), url))
return 1;
if(fa_stat(parent, &fs, NULL, 0))
return 1;
model = prop_create(page, "model");
prop_set_string(prop_create(model, "type"), "directory");
/* Find a meaningful page title (last component of URL) */
rstr_t *title = title_from_url(parent);
prop_setv(model, "metadata", "title", NULL, PROP_SET_RSTRING, title);
// Set parent
if(!fa_parent(parent2, sizeof(parent2), parent))
prop_set_string(prop_create(page, "parent"), parent2);
fa_scanner_page(parent, fs.fs_mtime, model, url,
prop_create(page, "directClose"), title);
rstr_release(title);
return 0;
}
示例11: darwin_init_cpu_monitor
void
darwin_init_cpu_monitor(void)
{
kern_return_t r;
processor_info_t pinfo;
mach_msg_type_number_t msg_count;
p_sys = prop_create(prop_get_global(), "system");
r = host_processor_info(mach_host_self (),
PROCESSOR_CPU_LOAD_INFO,
&cpu_count,
(processor_info_array_t *)&pinfo,
&msg_count);
if(r != KERN_SUCCESS) {
TRACE(TRACE_ERROR, "darwin",
"host_processor_info(PROCESSOR_CPU_LOAD_INFO) failed %d", r);
return;
}
p_cpu = calloc(cpu_count, sizeof(prop_t *));
p_load = calloc(cpu_count, sizeof(prop_t *));
last_total = calloc(cpu_count, sizeof(unsigned int));
last_idle = calloc(cpu_count, sizeof(unsigned int));
prop_set_int(prop_create(prop_create(p_sys, "cpuinfo"), "available"), 1);
p_cpuroot = prop_create(prop_create(p_sys, "cpuinfo"), "cpus");
vm_deallocate(mach_task_self(),
(vm_address_t)pinfo,
(vm_size_t)sizeof(*pinfo) * msg_count);
cpu_monitor_do();
callout_arm(&timer, timercb, NULL, 1);
}
示例12: connman_init
void
connman_init(void)
{
TAILQ_INIT(&connman_services);
netconf_model = prop_create_root(NULL);
prop_concat_t *pc = prop_concat_create(prop_create(netconf_model, "nodes"));
net_state = prop_create(netconf_model, "status");
prop_set(netconf_model, "type", PROP_SET_STRING, "directory");
prop_t *m = prop_create(netconf_model, "metadata");
prop_set(m, "title", PROP_SET_RSTRING, _("Network connections"));
// service_nodes contains list of items we receive from connman
service_nodes = prop_create_root(NULL);
prop_concat_add_source(pc, service_nodes, NULL);
// settings
connman_settings = prop_create_root(NULL);
prop_t *delim = prop_create_root(NULL);
prop_set_string(prop_create(delim, "type"), "separator");
prop_concat_add_source(pc, prop_create(connman_settings, "nodes"), delim);
settings_add_url(gconf.settings_network,
_p("Network connections"), NULL, NULL, NULL, MYURL,
SETTINGS_FIRST);
hts_thread_create_detached("connman", connman_thread, NULL,
THREAD_PRIO_BGTASK);
}
示例13: bookmarks_init
void
bookmarks_init(void)
{
htsmsg_field_t *f;
htsmsg_t *m, *n, *o;
hts_mutex_init(&bookmark_mutex);
bookmarks = prop_create(settings_add_dir(NULL, "Bookmarks", "bookmark", NULL),
"model");
prop_set_int(prop_create(bookmarks, "mayadd"), 1);
prop_subscribe(0,
PROP_TAG_CALLBACK, bookmarks_callback, NULL,
PROP_TAG_ROOT, prop_create(bookmarks, "nodes"),
PROP_TAG_MUTEX, &bookmark_mutex,
NULL);
if((m = htsmsg_store_load("bookmarks")) != NULL) {
n = htsmsg_get_map(m, "nodes");
HTSMSG_FOREACH(f, n) {
if((o = htsmsg_get_map_by_field(f)) == NULL)
continue;
bookmark_load(o);
}
htsmsg_destroy(m);
}
示例14: nav_page_setup_prop
static void
nav_page_setup_prop(navigator_t *nav, nav_page_t *np, const char *view)
{
np->np_prop_root = prop_create_root("page");
if(view != NULL) {
np->np_view = strdup(view);
prop_set_string(prop_create(np->np_prop_root, "requestedView"), view);
}
// XXX Change this into event-style subscription
np->np_close_sub =
prop_subscribe(0,
PROP_TAG_ROOT, prop_create(np->np_prop_root, "close"),
PROP_TAG_CALLBACK_INT, nav_page_close_set, np,
PROP_TAG_COURIER, nav->nav_pc,
NULL);
prop_set_string(prop_create(np->np_prop_root, "url"), np->np_url);
np->np_direct_close_sub =
prop_subscribe(PROP_SUB_NO_INITIAL_UPDATE,
PROP_TAG_ROOT, prop_create(np->np_prop_root, "directClose"),
PROP_TAG_CALLBACK_INT, nav_page_direct_close_set, np,
PROP_TAG_COURIER, nav->nav_pc,
NULL);
}
示例15: bookmark_add
static void
bookmark_add(const char *title, const char *url, const char *type)
{
bookmark_t *bm = calloc(1, sizeof(bookmark_t));
prop_t *p = prop_create_root(NULL);
prop_t *src = prop_create(p, "model");
prop_set_string(prop_create(src, "type"), "bookmark");
bm->bm_title_sub = bookmark_add_prop(src, "title", title, bm, set_title);
bm->bm_url_sub = bookmark_add_prop(src, "url", url, bm, set_url);
bm->bm_type_sub = bookmark_add_prop(src, "svctype", type, bm, set_type);
bm->bm_service = service_create(title, url, type, NULL, 1, 1);
prop_link(service_get_status_prop(bm->bm_service),
prop_create(src, "status"));
prop_link(service_get_statustxt_prop(bm->bm_service),
prop_create(src, "statustxt"));
prop_subscribe(PROP_SUB_TRACK_DESTROY | PROP_SUB_NO_INITIAL_UPDATE,
PROP_TAG_CALLBACK, bookmark_destroyed, bm,
PROP_TAG_ROOT, p,
PROP_TAG_MUTEX, &bookmark_mutex,
NULL);
if(prop_set_parent(p, prop_create(bookmarks, "nodes")))
abort();
}