本文整理汇总了C++中yajl_gen类的典型用法代码示例。如果您正苦于以下问题:C++ yajl_gen类的具体用法?C++ yajl_gen怎么用?C++ yajl_gen使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了yajl_gen类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: yajl_gen_array_open
yajl_gen_status
yajl_gen_array_open(yajl_gen g)
{
ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE;
INCREMENT_DEPTH;
g->state[g->depth] = yajl_gen_array_start;
g->print(g->ctx, "[", 1);
if (g->pretty) g->print(g->ctx, "\n", 1);
FINAL_NEWLINE;
return yajl_gen_status_ok;
}
开发者ID:Epictetus,项目名称:yajl-ruby,代码行数:11,代码来源:yajl_gen.c
示例2: yajl_gen_array_close
yajl_gen_status
yajl_gen_array_close(yajl_gen g)
{
ENSURE_VALID_STATE;
if (g->pretty) g->print(g->ctx, "\n", 1);
(g->depth)--;
APPENDED_ATOM;
INSERT_WHITESPACE;
g->print(g->ctx, "]", 1);
FINAL_NEWLINE;
return yajl_gen_status_ok;
}
开发者ID:Epictetus,项目名称:yajl-ruby,代码行数:12,代码来源:yajl_gen.c
示例3: yajl_gen_string
yajl_gen_status
yajl_gen_string(yajl_gen g, const unsigned char * str,
unsigned int len)
{
ENSURE_VALID_STATE; INSERT_SEP; INSERT_WHITESPACE;
g->print(g->ctx, "\"", 1);
yajl_string_encode2(g->print, g->ctx, str, len, g->htmlSafe);
g->print(g->ctx, "\"", 1);
APPENDED_ATOM;
FINAL_NEWLINE;
return yajl_gen_status_ok;
}
开发者ID:Epictetus,项目名称:yajl-ruby,代码行数:12,代码来源:yajl_gen.c
示例4: yajl_gen_map_close
yajl_gen_status
yajl_gen_map_close(yajl_gen g)
{
ENSURE_VALID_STATE;
DECREMENT_DEPTH;
if (g->pretty) g->print(g->ctx, "\n", 1);
APPENDED_ATOM;
INSERT_WHITESPACE;
g->print(g->ctx, "}", 1);
FINAL_NEWLINE;
return yajl_gen_status_ok;
}
开发者ID:LiquidAnalytics,项目名称:ld-api-examples,代码行数:13,代码来源:yajl_gen.c
示例5: yajl_gen_null
yajl_gen_status
yajl_gen_null(yajl_gen g)
{
ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE;
g->print(g->ctx, "null", strlen("null"));
APPENDED_ATOM;
FINAL_NEWLINE;
return yajl_gen_status_ok;
}
开发者ID:Epictetus,项目名称:yajl-ruby,代码行数:9,代码来源:yajl_gen.c
示例6: yajl_gen_number
yajl_gen_status
yajl_gen_number(yajl_gen g, const char * s, unsigned int l)
{
ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE;
g->print(g->ctx, s, l);
APPENDED_ATOM;
FINAL_NEWLINE;
return yajl_gen_status_ok;
}
开发者ID:Epictetus,项目名称:yajl-ruby,代码行数:9,代码来源:yajl_gen.c
示例7: yajl_gen_bool
yajl_gen_status
yajl_gen_bool(yajl_gen g, int boolean)
{
const char * val = boolean ? "true" : "false";
ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE;
g->print(g->ctx, val, strlen(val));
APPENDED_ATOM;
FINAL_NEWLINE;
return yajl_gen_status_ok;
}
开发者ID:Epictetus,项目名称:yajl-ruby,代码行数:11,代码来源:yajl_gen.c
示例8: yajl_gen_integer
yajl_gen_status
yajl_gen_integer(yajl_gen g, long int number)
{
char i[32];
ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE;
sprintf(i, "%ld", number);
g->print(g->ctx, i, strlen(i));
APPENDED_ATOM;
FINAL_NEWLINE;
return yajl_gen_status_ok;
}
开发者ID:Epictetus,项目名称:yajl-ruby,代码行数:11,代码来源:yajl_gen.c
示例9: yajl_gen_double
yajl_gen_status
yajl_gen_double(yajl_gen g, double number)
{
char i[32];
ENSURE_VALID_STATE; ENSURE_NOT_KEY;
if (isnan(number) || isinf(number)) return yajl_gen_invalid_number;
INSERT_SEP; INSERT_WHITESPACE;
sprintf(i, "%.20g", number);
g->print(g->ctx, i, strlen(i));
APPENDED_ATOM;
FINAL_NEWLINE;
return yajl_gen_status_ok;
}
开发者ID:Epictetus,项目名称:yajl-ruby,代码行数:13,代码来源:yajl_gen.c
注:本文中的yajl_gen类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论