当前位置: 首页>>代码示例>>C++>>正文


C++ prop_create_root函数代码示例

本文整理汇总了C++中prop_create_root函数的典型用法代码示例。如果您正苦于以下问题:C++ prop_create_root函数的具体用法?C++ prop_create_root怎么用?C++ prop_create_root使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了prop_create_root函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: avt_SetAVTransportURI

static htsmsg_t *
avt_SetAVTransportURI(http_connection_t *hc, htsmsg_t *args,
		      const char *myhost, int myport)
{
  const char *uri = htsmsg_get_str(args, "CurrentURI");
  const char *metaxml = htsmsg_get_str(args, "CurrentURIMetaData");
  char errbuf[200];
  htsmsg_t *meta;

  if(uri == NULL)
    return NULL;

  if(metaxml == NULL) {
    playqueue_play(uri, prop_create_root(NULL), 1);
    return NULL;
  }

  meta = htsmsg_xml_deserialize_cstr(metaxml, errbuf, sizeof(errbuf));
  if(meta == NULL) {
    TRACE(TRACE_ERROR, "UPNP", 
	  "SetAVTransportURI: Unable to parse metadata -- %s", errbuf);
    return NULL;
  }
  
  if(play_with_context(uri, meta)) {
    // Failed to play from context
    // TODO: Fix metadata here
    playqueue_play(uri, prop_create_root(NULL), 1);
  }
  htsmsg_release(meta);
  return NULL;
}
开发者ID:Cy-4AH,项目名称:showtime,代码行数:32,代码来源:upnp_avtransport.c

示例2: 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);
}
开发者ID:Ezio-PS,项目名称:movian,代码行数:33,代码来源:connman.c

示例3: message_popup

int
message_popup(const char *message, int flags, const char **extra)
{
  prop_t *p;
  int rval;

  p = prop_ref_inc(prop_create_root(NULL));

  TRACE(TRACE_DEBUG, "Notification", "%s", message);

  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(extra) {
    int cnt = 1;
    prop_t *btns = prop_create(p, "buttons");
    while(*extra) {
      prop_t *b = prop_create_root(NULL);
      prop_set_string(prop_create(b, "title"), *extra);
      char action[10];
      snprintf(action, sizeof(action), "btn%d", cnt);
      prop_set_string(prop_create(b, "action"), action);
      if(prop_set_parent(b, btns))
	abort();
      cnt++;
      extra++;
    }
  }

  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);
  prop_ref_dec(p);

  const event_payload_t *ep = (const event_payload_t *)e;

  if(event_is_action(e, ACTION_OK))
    rval = MESSAGE_POPUP_OK;
  else if(event_is_action(e, ACTION_CANCEL))
    rval = MESSAGE_POPUP_CANCEL;
  else if(event_is_type(e, EVENT_DYNAMIC_ACTION) &&
	  !strncmp(ep->payload, "btn", 3))
    rval = atoi(ep->payload + 3);
  else
    rval = 0;

  event_release(e);
  return rval;
}
开发者ID:tajmouati,项目名称:showtime,代码行数:55,代码来源:notifications.c

示例4: js_addsubprovider

JSBool 
js_addsubprovider(JSContext *cx, JSObject *obj, uintN argc, 
		  jsval *argv, jsval *rval)
{
  js_subprovider_t *sp;
  js_plugin_t *jsp = JS_GetPrivate(cx, obj);

  if(!JS_ObjectIsFunction(cx, JSVAL_TO_OBJECT(argv[0]))) {
    JS_ReportError(cx, "Argument is not a function");
    return JS_FALSE;
  }

  sp = calloc(1, sizeof(js_subprovider_t));

  sp->super.sp_query        = js_sub_query;
  sp->super.sp_retain       = js_sub_retain;

  sp->sp_title = prop_create_root(NULL);
  prop_set_string(sp->sp_title, jsp->jsp_id);

  subtitle_provider_register(&sp->super,
                             jsp->jsp_id, sp->sp_title,
                             0, "plugin", 1, 1);

  sp->sp_jsp = jsp;
  LIST_INSERT_HEAD(&jsp->jsp_subproviders, sp, sp_plugin_link);

  sp->sp_func = argv[0];
  atomic_set(&sp->sp_refcnt, 1);
  JS_AddNamedRoot(cx, &sp->sp_func, "subprovider");

  *rval = JSVAL_VOID;
  return JS_TRUE;
}
开发者ID:Overx,项目名称:showtime,代码行数:34,代码来源:js_metaprovider.c

示例5: 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;
}
开发者ID:Bibamaru,项目名称:showtime,代码行数:25,代码来源:js_page.c

示例6: 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;
}
开发者ID:CrashSerious,项目名称:showtime,代码行数:31,代码来源:search.c

示例7: 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--;
  }
}
开发者ID:CrashSerious,项目名称:showtime,代码行数:26,代码来源:trace.c

示例8: 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();

}
开发者ID:MatChung,项目名称:showtime,代码行数:31,代码来源:bookmarks.c

示例9: 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);
}
开发者ID:CrashSerious,项目名称:showtime,代码行数:26,代码来源:navigator.c

示例10: nls_string_find

static nls_string_t *
nls_string_find(const char *key)
{
  nls_string_t *ns;

  unsigned int hash = mystrhash(key) % NLS_STRING_HASH_WIDTH;

  hts_mutex_lock(&nls_mutex);

  LIST_FOREACH(ns, &nls_strings[hash], ns_link)
    if(!strcmp(rstr_get(ns->ns_key), key))
      break;

  if(ns == NULL) {
    ns = calloc(1, sizeof(nls_string_t));
    ns->ns_key = rstr_alloc(key);
    ns->ns_prop = prop_create_root(NULL);
    prop_set_rstring(ns->ns_prop, ns->ns_key);

  } else {
    LIST_REMOVE(ns, ns_link);
  }
  LIST_INSERT_HEAD(&nls_strings[hash], ns, ns_link);

  hts_mutex_unlock(&nls_mutex);
  return ns;
}
开发者ID:bguerreiro,项目名称:movian,代码行数:27,代码来源:i18n.c

示例11: 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;
}
开发者ID:dev-life,项目名称:showtime,代码行数:33,代码来源:notifications.c

示例12: 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;
}
开发者ID:Sinster,项目名称:showtime,代码行数:30,代码来源:notifications.c

示例13: 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;
}
开发者ID:tajmouati,项目名称:showtime,代码行数:33,代码来源:notifications.c

示例14: htsp_channel_get

static htsp_channel_t *
htsp_channel_get(htsp_connection_t *hc, int id, int create)
{
  htsp_channel_t *ch;
  char txt[256];
  LIST_FOREACH(ch, &hc->hc_channels, ch_link)
    if(ch->ch_id == id)
      return ch;

  if(!create)
    return NULL;

  ch = calloc(1, sizeof(htsp_channel_t));

  snprintf(txt, sizeof(txt), "%d", id);
  prop_t *p = ch->ch_root = prop_create_root(txt);
  
  snprintf(txt, sizeof(txt), "htsp://%s:%d/channel/%d",
	   hc->hc_hostname, hc->hc_port, id);
  prop_set_string(prop_create(ch->ch_root, "url"), txt);

  prop_t *m = prop_create(p, "metadata");
  ch->ch_prop_icon = prop_create(m, "icon");
  ch->ch_prop_title = prop_create(m, "title");
  ch->ch_prop_channelNumber = prop_create(m, "channelNumber");
  ch->ch_prop_events = prop_create(m, "events");

  prop_set_string(prop_create(ch->ch_root, "type"), "tvchannel");
  
  LIST_INSERT_HEAD(&hc->hc_channels, ch, ch_link);
  ch->ch_id = id;
  return ch;
}
开发者ID:PeteGashek,项目名称:showtime,代码行数:33,代码来源:htsp.c

示例15: makesep

prop_t *
makesep(prop_t *title)
{
  prop_t *d = prop_create_root(NULL);
  prop_link(title, prop_create(prop_create(d, "metadata"), "title"));
  prop_set_string(prop_create(d, "type"), "separator");
  return d;

}
开发者ID:copernic-us,项目名称:showtime-1,代码行数:9,代码来源:settings.c


注:本文中的prop_create_root函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。