本文整理汇总了C++中rstr_get函数的典型用法代码示例。如果您正苦于以下问题:C++ rstr_get函数的具体用法?C++ rstr_get怎么用?C++ rstr_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rstr_get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: set_source
static void
set_source(glw_t *w, rstr_t *filename)
{
glw_image_t *gi = (glw_image_t *)w;
const rstr_t *curname;
if(gi->gi_pending_url != NULL)
curname = gi->gi_pending_url;
else if(gi->gi_pending != NULL)
curname = gi->gi_pending->glt_url;
else if(gi->gi_current != NULL)
curname = gi->gi_current->glt_url;
else
curname = NULL;
if(curname != NULL && filename != NULL && !strcmp(rstr_get(filename),
rstr_get(curname)))
return;
if(gi->gi_pending_url != NULL)
rstr_release(gi->gi_pending_url);
gi->gi_pending_url = filename ? rstr_dup(filename) : rstr_alloc("");
}
开发者ID:Daisho,项目名称:showtime,代码行数:25,代码来源:glw_image.c
示例2: hc_prop
static int
hc_prop(http_connection_t *hc, const char *remain, void *opaque,
http_cmd_t method)
{
htsbuf_queue_t out;
rstr_t *r;
int rval, i;
prop_t *p;
const char *action = http_arg_get_req(hc, "action");
if(remain == NULL)
return 404;
p = prop_from_path(remain);
if(p == NULL)
return 404;
htsbuf_queue_init(&out, 0);
switch(method) {
case HTTP_CMD_GET:
if(action != NULL) {
event_t *e = event_create_action_str(action);
prop_send_ext_event(p, e);
event_release(e);
rval = HTTP_STATUS_OK;
break;
}
r = prop_get_string(p, NULL);
if(r == NULL) {
char **childs = prop_get_name_of_childs(p);
if(childs == NULL) {
rval = HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE;
break;
}
for(i = 0; childs[i] != NULL; i++) {
htsbuf_qprintf(&out, "\t%s\n", childs[i]);
}
} else {
htsbuf_append(&out, rstr_get(r), strlen(rstr_get(r)));
htsbuf_append(&out, "\n", 1);
rstr_release(r);
}
rval = http_send_reply(hc, 0, "text/ascii", NULL, NULL, 0, &out);
break;
default:
rval = HTTP_STATUS_METHOD_NOT_ALLOWED;
break;
}
prop_ref_dec(p);
return rval;
}
开发者ID:Rautz,项目名称:showtime,代码行数:60,代码来源:httpcontrol.c
示例3: callback_opt
static void
callback_opt(void *opaque, prop_event_t event, ...)
{
setting_t *s = opaque;
prop_callback_string_t *cb;
prop_t *c;
rstr_t *name;
va_list ap;
va_start(ap, event);
cb = s->s_callback;
if(event != PROP_SELECT_CHILD)
return;
c = va_arg(ap, prop_t *);
name = c ? prop_get_name(c) : NULL;
va_end(ap);
if(cb != NULL)
cb(s->s_opaque, rstr_get(name));
if(s->s_store != NULL && s->s_saver != NULL) {
htsmsg_delete_field(s->s_store, s->s_id);
if(name != NULL)
htsmsg_add_str(s->s_store, s->s_id, rstr_get(name));
s->s_saver(s->s_saver_opaque, s->s_store);
}
rstr_release(name);
}
开发者ID:Rautz,项目名称:showtime,代码行数:31,代码来源:settings.c
示例4: glw_view_load1
/**
* Load a view file and do lexographical parsing
*
* Returns pointer to last token, or NULL if an error occured.
* If an error occured 'ei' will be filled with data
*/
token_t *
glw_view_load1(glw_root_t *gr, rstr_t *url, errorinfo_t *ei, token_t *prev,
int may_unlock)
{
token_t *last;
char errbuf[256];
rstr_t *p = fa_absolute_path(url, prev->file);
if(may_unlock)
glw_unlock(gr);
buf_t *b = fa_load(rstr_get(p),
FA_LOAD_VPATHS(gr->gr_vpaths),
FA_LOAD_ERRBUF(errbuf, sizeof(errbuf)),
NULL);
if(may_unlock)
glw_lock(gr);
if(b == NULL) {
snprintf(ei->error, sizeof(ei->error), "Unable to open \"%s\" -- %s",
rstr_get(p), errbuf);
snprintf(ei->file, sizeof(ei->file), "%s", rstr_get(prev->file));
ei->line = prev->line;
rstr_release(p);
return NULL;
}
last = glw_view_lexer(gr, buf_cstr(b), ei, p, prev);
buf_release(b);
rstr_release(p);
return last;
}
开发者ID:bguerreiro,项目名称:movian,代码行数:40,代码来源:glw_view_lexer.c
示例5: glw_view_seterr
int
glw_view_seterr(errorinfo_t *ei, token_t *b, const char *fmt, ...)
{
char buf[PATH_MAX];
va_list ap;
va_start(ap, fmt);
assert(b != NULL);
if(ei == NULL) {
#ifdef GLW_VIEW_ERRORINFO
snprintf(buf, sizeof(buf), "GLW: %s:%d", rstr_get(b->file), b->line);
#else
snprintf(buf, sizeof(buf), "GLW: file?:##");
#endif
tracev(TRACE_NO_PROP, TRACE_ERROR, buf, fmt, ap);
return -1;
}
vsnprintf(ei->error, sizeof(ei->error), fmt, ap);
va_end(ap);
#ifdef GLW_VIEW_ERRORINFO
snprintf(ei->file, sizeof(ei->file), "%s", rstr_get(b->file));
ei->line = b->line;
#else
snprintf(ei->file, sizeof(ei->file), "file?");
#endif
return -1;
}
开发者ID:CrashSerious,项目名称:showtime,代码行数:31,代码来源:glw_view_support.c
示例6: rstr_spn
rstr_t *
rstr_spn(rstr_t *s, const char *set, int offset)
{
size_t len = strlen(rstr_get(s));
if(offset >= len)
return rstr_dup(s);
size_t l = strcspn(rstr_get(s) + offset, set) + offset;
if(l == len)
return rstr_dup(s);
return rstr_allocl(rstr_get(s), l);
}
开发者ID:Bibamaru,项目名称:showtime,代码行数:11,代码来源:rstr.c
示例7: notify_add
void *
notify_add(prop_t *root, notify_type_t type, const char *icon, int delay,
rstr_t *fmt, ...)
{
char msg[256];
prop_t *p;
const char *typestr;
int tl;
va_list ap, apx;
switch(type) {
case NOTIFY_INFO: typestr = "info"; tl = TRACE_INFO; break;
case NOTIFY_WARNING: typestr = "warning"; tl = TRACE_INFO; break;
case NOTIFY_ERROR: typestr = "error"; tl = TRACE_ERROR; break;
default: return NULL;
}
va_start(ap, fmt);
va_copy(apx, ap);
tracev(0, tl, "notify", rstr_get(fmt), ap);
vsnprintf(msg, sizeof(msg), rstr_get(fmt), apx);
va_end(ap);
va_end(apx);
rstr_release(fmt);
p = prop_create_root(NULL);
prop_set_string(prop_create(p, "text"), msg);
prop_set_string(prop_create(p, "type"), typestr);
if(icon != NULL)
prop_set_string(prop_create(p, "icon"), icon);
p = prop_ref_inc(p);
if(prop_set_parent(p, root ?: notify_prop_entries))
prop_destroy(p);
if(delay != 0) {
prop_t *r = NULL;
if(delay < 0) {
r = prop_ref_inc(p);
delay = -delay;
}
callout_arm(NULL, notify_timeout, p, delay);
return r;
}
return p;
}
开发者ID:Cy-4AH,项目名称:showtime,代码行数:53,代码来源:notifications.c
示例8: 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
示例9: glw_quad_render
static void
glw_quad_render(glw_t *w, const glw_rctx_t *rc)
{
glw_quad_t *q = (glw_quad_t *)w;
if(q->recompile) {
glw_destroy_program(w->glw_root, q->prog);
q->prog = glw_make_program(w->glw_root, NULL, rstr_get(q->fs));
q->recompile = 0;
}
if(!glw_renderer_initialized(&q->r)) {
glw_renderer_init_quad(&q->r);
glw_renderer_vtx_pos(&q->r, 0, -1, -1, 0);
glw_renderer_vtx_pos(&q->r, 1, 1, -1, 0);
glw_renderer_vtx_pos(&q->r, 2, 1, 1, 0);
glw_renderer_vtx_pos(&q->r, 3, -1, 1, 0);
}
glw_renderer_draw(&q->r, w->glw_root, rc,
NULL,
&q->color, NULL, rc->rc_alpha * w->glw_alpha, 0,
q->prog);
}
开发者ID:Allba,项目名称:showtime,代码行数:25,代码来源:glw_primitives.c
示例10: is_plugin_blacklisted
static int
is_plugin_blacklisted(const char *id, const char *version, rstr_t **reason)
{
char tmp[512];
int verint = parse_version_int(version);
if(!strcmp(id, "custombg")) {
if(reason != NULL) {
*reason =
_("Custom backgrounds can now be set in Settings -> Look and Feel");
}
return 1;
}
for(int i = 0; i < ARRAYSIZE(blacklist); i++) {
if(strcmp(id, blacklist[i].id))
continue;
if(verint >= blacklist[i].version)
continue;
if(reason != NULL) {
rstr_t *f = _("Version %s is no longer compatible with Movian");
snprintf(tmp, sizeof(tmp), rstr_get(f), version);
rstr_release(f);
*reason = rstr_alloc(tmp);
}
return 1;
}
return 0;
}
开发者ID:RuralHunter,项目名称:showtime,代码行数:30,代码来源:plugins.c
示例11: be_prop_open
static int
be_prop_open(prop_t *page, const char *url)
{
proppage_t *pp;
openpage_t *op;
hts_mutex_lock(&pp_mutex);
LIST_FOREACH(pp, &proppages, pp_link)
if(!strcmp(rstr_get(pp->pp_url), url))
break;
if(pp == NULL) {
hts_mutex_unlock(&pp_mutex);
return 1;
}
op = calloc(1, sizeof(openpage_t));
LIST_INSERT_HEAD(&pp->pp_pages, op, op_link);
op->op_pp = pp;
op->op_root = prop_ref_inc(page);
op->op_page_sub =
prop_subscribe(PROP_SUB_TRACK_DESTROY,
PROP_TAG_CALLBACK, op_cb, op,
PROP_TAG_MUTEX, &pp_mutex,
PROP_TAG_ROOT, page,
NULL);
prop_link(pp->pp_model, prop_create(page, "model"));
hts_mutex_unlock(&pp_mutex);
return 0;
}
开发者ID:Allba,项目名称:showtime,代码行数:33,代码来源:backend_prop.c
示例12: get_identity
static const char *
get_identity(glw_t *w)
{
glw_image_t *gi = (glw_image_t *)w;
glw_loadable_texture_t *glt = gi->gi_current;
return glt ? rstr_get(glt->glt_url) : "unloaded";
}
开发者ID:Daisho,项目名称:showtime,代码行数:7,代码来源:glw_image.c
示例13: 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);
}
开发者ID:tajmouati,项目名称:showtime,代码行数:33,代码来源:notifications.c
示例14: notifications_update
static void
notifications_update(void *opaque, prop_event_t event, ...)
{
statusbar_t *sb = opaque;
prop_t *p, *txt;
statusbar_entry_t *sbe;
char *buf;
rstr_t *msg;
int i, l;
va_list ap;
va_start(ap, event);
switch(event) {
case PROP_ADD_CHILD:
p = va_arg(ap, prop_t *);
txt = prop_get_by_name(PNVEC("self", "text"), 1,
PROP_TAG_NAMED_ROOT, p, "self",
NULL);
if(txt != NULL) {
msg = prop_get_string(txt);
if(msg != NULL) {
buf = mystrdupa(rstr_get(msg));
l = strlen(buf);
for(i = 0; i < l; i++)
if(buf[i] < ' ')
buf[i] = ' ';
sbe = calloc(1, sizeof(statusbar_entry_t));
sbe->p = prop_ref_inc(p);
sbe->id = gtk_statusbar_push(GTK_STATUSBAR(sb->bar), sb->ctxid, buf);
LIST_INSERT_HEAD(&sb->entries, sbe, link);
rstr_release(msg);
}
prop_ref_dec(txt);
}
break;
case PROP_DEL_CHILD:
p = va_arg(ap, prop_t *);
LIST_FOREACH(sbe, &sb->entries, link)
if(sbe->p == p)
break;
if(sbe == NULL)
break;
prop_ref_dec(sbe->p);
gtk_statusbar_remove(GTK_STATUSBAR(sb->bar), sb->ctxid, sbe->id);
LIST_REMOVE(sbe, link);
free(sbe);
break;
default:
break;
}
}
开发者ID:CrashSerious,项目名称:showtime,代码行数:59,代码来源:gu_statusbar.c
示例15: set_float3
static int
set_float3(glw_view_eval_context_t *ec, const token_attrib_t *a,
struct token *t)
{
const float *vec3;
float v[3];
switch(t->type) {
case TOKEN_VECTOR_FLOAT:
switch(t->t_elements) {
case 3:
vec3 = t->t_float_vector_int;
break;
default:
return glw_view_seterr(ec->ei, t,
"Attribute '%s': invalid vector size %d",
a->name, t->t_elements);
}
break;
case TOKEN_FLOAT:
v[0] = v[1] = v[2] = t->t_float;
vec3 = v;
break;
case TOKEN_INT:
v[0] = v[1] = v[2] = t->t_int;
vec3 = v;
break;
case TOKEN_VOID:
v[0] = v[1] = v[2] = 0;
vec3 = v;
break;
default:
return glw_view_seterr(ec->ei, t, "Attribute '%s' expects a vec3, got %s",
a->name, token2name(t));
}
glw_t *w = ec->w;
const glw_class_t *gc = w->glw_class;
int r = gc->gc_set_float3 ? gc->gc_set_float3(w, a->attrib, vec3) : -1;
if(r == -1) {
TRACE(TRACE_DEBUG, "GLW",
"Widget %s at %s:%d does not respond to attribute %s",
gc->gc_name, rstr_get(t->file), t->line, a->name);
return 0;
}
if(r)
attr_need_refresh(w->glw_root, t, a, r);
return 0;
}
开发者ID:dreamcat4,项目名称:showtime,代码行数:58,代码来源:glw_view_attrib.c
示例16: bgloader_thread
static void *
bgloader_thread(void *aux)
{
bg_helper_t *bgh = aux;
rstr_t *current_bg = NULL;
float current_alpha = 0;
while(1) {
struct prop_notify_queue q;
float alpha = 1.0f;
int timo = alpha != current_alpha ? 16 : 0;
prop_courier_wait(bgh->pc, &q, timo);
prop_notify_dispatch(&q);
rstr_t *bg;
if(bgh->bg_url[0]) {
bg = bgh->bg_url[0];
if(bgh->bg_alpha[0])
alpha = bgh->bg_alpha[0];
} else if(bgh->bg_url[1]) {
bg = bgh->bg_url[1];
if(bgh->bg_alpha[1])
alpha = bgh->bg_alpha[1];
} else {
bg = bgh->bg_url[2];
}
if(bgh->fullwindow || bgh->screensaver)
alpha = 0;
if(alpha != current_alpha) {
if(current_alpha < alpha)
current_alpha = MIN(alpha, current_alpha + 0.1);
else if(current_alpha > alpha)
current_alpha = MAX(alpha, current_alpha - 0.1);
bgh->set_alpha(current_alpha, bgh->opaque);
}
if(!rstr_eq(current_bg, bg)) {
rstr_set(¤t_bg, bg);
const char *v[3];
v[0] = "skin";
v[1] = rstr_get(bgh->skin_path);
v[2] = NULL;
bgh->set_image(bg, v, bgh->opaque);
}
}
return NULL;
}
开发者ID:kshostak,项目名称:showtime,代码行数:58,代码来源:background.c
示例17: input_req_event
static void
input_req_event(void *opaque, event_t *e)
{
connman_service_t *cs = opaque;
if(cs->cs_input_req_inv == NULL)
return;
if(event_is_action(e, ACTION_OK)) {
rstr_t *username = prop_get_string(cs->cs_input_req_prop, "username", NULL);
rstr_t *password = prop_get_string(cs->cs_input_req_prop, "password", NULL);
GVariant *result;
GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
g_variant_builder_add(builder, "{sv}", "Passphrase",
g_variant_new_string(rstr_get(password)));
if(cs->cs_input_req_want_identity)
g_variant_builder_add(builder, "{sv}", "Identity",
g_variant_new_string(rstr_get(username)));
result = g_variant_new("(a{sv})", builder);
TRACE(TRACE_DEBUG, "CONNMAN", "Auth response: %s",
g_variant_print(result, TRUE));
g_dbus_method_invocation_return_value(cs->cs_input_req_inv, result);
g_variant_builder_unref(builder);
rstr_release(username);
rstr_release(password);
connman_stop_input_request(cs);
}
if(event_is_action(e, ACTION_CANCEL)) {
g_dbus_method_invocation_return_dbus_error(cs->cs_input_req_inv,
"net.connman.Agent.Error.Canceled",
"Canceled by user");
connman_stop_input_request(cs);
}
}
开发者ID:Ezio-PS,项目名称:movian,代码行数:43,代码来源:connman.c
示例18: glw_segway_set_rstr_unresolved
static int
glw_segway_set_rstr_unresolved(glw_t *w, const char *a, rstr_t *value,
glw_style_t *gs)
{
if(!strcmp(a, "direction")) {
glw_segway_t *s = (glw_segway_t *)w;
s->direction = str2val(rstr_get(value), segway_directions);
return GLW_SET_RERENDER_REQUIRED;
}
return GLW_SET_NOT_RESPONDING;
}
开发者ID:Ezio-PS,项目名称:movian,代码行数:11,代码来源:glw_segway.c
示例19: nav_open_errorf
int
nav_open_errorf(prop_t *root, rstr_t *fmt, ...)
{
va_list ap;
char buf[200];
va_start(ap, fmt);
vsnprintf(buf, sizeof(buf), rstr_get(fmt), ap);
va_end(ap);
rstr_release(fmt);
return nav_open_error(root, buf);
}
开发者ID:CrashSerious,项目名称:showtime,代码行数:12,代码来源:navigator.c
示例20: metadata_remove_postfix_rstr
rstr_t *
metadata_remove_postfix_rstr(rstr_t *name)
{
if(!gconf.show_filename_extensions) {
const char *str = rstr_get(name);
int len = strlen(str);
if(len > 4 && str[len - 4] == '.')
return rstr_allocl(str, len - 4);
if(len > 5 && !strcasecmp(str + len - 5, ".m2ts"))
return rstr_allocl(str, len - 5);
}
return rstr_dup(name);
}
开发者ID:StingerFG,项目名称:movian,代码行数:14,代码来源:metadata_str.c
注:本文中的rstr_get函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论