本文整理汇总了C++中parse_value函数的典型用法代码示例。如果您正苦于以下问题:C++ parse_value函数的具体用法?C++ parse_value怎么用?C++ parse_value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse_value函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: SWITCH_DECLARE
/* Parse an object - create a new root, and populate. */
SWITCH_DECLARE(cJSON *)cJSON_Parse(const char *value)
{
cJSON *c=cJSON_New_Item();
ep=0;
if (!c) return 0; /* memory fail */
if (!parse_value(c,skip(value))) {cJSON_Delete(c);return 0;}
return c;
}
开发者ID:bodji,项目名称:freeswitch,代码行数:10,代码来源:switch_json.c
示例2:
/* Parse an object - create a new root, and populate. */
CSON *CSON_Parse(const char *value)
{
CSON *c=CSON_New_Item();
ep=0;
if (!c) return 0; /* memory fail */
if (!parse_value(c,skip(value))) {CSON_Delete(c);return 0;}
return c;
}
开发者ID:AlanZheng,项目名称:cson,代码行数:10,代码来源:cson.c
示例3: CHECK
Status ComplexQuery::parse_expression(const string& exp) {
static const string OPCHAR = "=!<>";
CHECK(!exp.empty());
size_t op_pos = exp.find_first_of(OPCHAR);
if (op_pos == string::npos) {
return Status(-1, "Bad expression.");
}
size_t value_pos = exp.find_first_not_of(OPCHAR, op_pos);
if (value_pos == string::npos) {
return Status(-1, "Bad expression.");
}
string field = trim_copy(exp.substr(0, op_pos));
string opstr = exp.substr(op_pos, value_pos - op_pos);
string value = trim_copy(exp.substr(value_pos));
int op = parse_cond_op(opstr);
if (op < 0) {
return Status(-1, "Bad operation.");
}
string tmp(value);
Status status = parse_value(field, tmp, &value);
if (!status.ok()) {
LOG(ERROR) << status.message() << ":" << tmp;
return status;
}
switch (op) {
case LE:
range_query_map_[field].upper = value;
range_query_map_[field].upper_closed = true;
break;
case LT:
range_query_map_[field].upper = value;
range_query_map_[field].upper_closed = false;
break;
case GE:
range_query_map_[field].lower = value;
range_query_map_[field].lower_closed = true;
break;
case GT:
range_query_map_[field].lower = value;
range_query_map_[field].lower_closed = false;
break;
case EQ:
range_query_map_[field].upper = value;
range_query_map_[field].upper_closed = true;
range_query_map_[field].lower = value;
range_query_map_[field].lower_closed = true;
break;
default:
LOG(ERROR) << "Unknown op code: " << opstr;
return Status(-1, "Unknown op code.");
}
return Status::OK;
}
开发者ID:vsfs,项目名称:vsfs,代码行数:57,代码来源:complex_query.cpp
示例4: next_tag
static const char *parse_field(struct buffer *self, int tag)
{
if (parse_tag(self) != tag) {
next_tag(self);
return NULL;
}
return parse_value(self);
}
开发者ID:weixu8,项目名称:libtrading,代码行数:9,代码来源:fix_message.c
示例5:
const nx_json *nx_json_parse(char *text, nx_json_unicode_encoder encoder) {
nx_json js = { 0 };
if (!parse_value(&js, 0, text, encoder)) {
if (js.child)
nx_json_free(js.child);
return 0;
}
return js.child;
}
开发者ID:debosvi,项目名称:bozHMI,代码行数:9,代码来源:nxjson.c
示例6: json_object
static json_t *parse_dict(stream_t *stream, size_t flags,
json_error_t *error)
{
int c;
char *key;
json_t *value;
json_t *object = json_object();
if(!object)
return NULL;
c = stream_getc(stream);
assert(c == 'd');
while (1) {
c = stream_peek(stream);
if (c == EOF) {
error_set(error, stream, "unterminated dictionary");
goto error;
}
if (c == 'e')
break;
key = parse_string(stream, flags, error);
if (!key)
goto error;
if(flags & JSON_REJECT_DUPLICATES) {
if(json_object_get(object, key)) {
jsonp_free(key);
error_set(error, stream, "duplicate object key");
goto error;
}
}
value = parse_value(stream, flags, error);
if (!value) {
jsonp_free(key);
goto error;
}
if(json_object_set_nocheck(object, key, value)) {
jsonp_free(key);
json_decref(value);
goto error;
}
json_decref(value);
jsonp_free(key);
}
stream_getc(stream);
return object;
error:
json_decref(object);
return NULL;
}
开发者ID:japeq,项目名称:jansson-bencode,代码行数:56,代码来源:bencode.c
示例7: drbd_submit_fields
static int drbd_submit_fields (long int resource,
char **fields, size_t fields_num)
{
char plugin_instance[DATA_MAX_NAME_LEN];
value_t values[fields_num];
value_list_t vl = VALUE_LIST_INIT;
size_t i;
if (resource < 0)
{
WARNING ("drbd plugin: Unable to parse resource");
return (EINVAL);
}
if (fields_num != drbd_names_num)
{
WARNING ("drbd plugin: Wrong number of fields for "
"r%ld statistics. Expected %zu, got %zu.",
resource, drbd_names_num, fields_num);
return (EINVAL);
}
ssnprintf (plugin_instance, sizeof (plugin_instance), "r%ld",
resource);
for (i = 0; i < drbd_names_num; i++)
{
char *data;
/* skip non numeric wo */
if (strncmp(fields[i], "wo", 2) == 0)
continue;
data = strchr(fields[i], ':');
if (data == NULL)
return (EINVAL);
(void) parse_value (++data, &values[i], DS_TYPE_DERIVE);
}
vl.values_len = 1;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "drbd", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, plugin_instance,
sizeof (vl.plugin_instance));
sstrncpy (vl.type, "drbd_resource", sizeof (vl.type));
for (i = 0; i < fields_num; i++)
{
if (drbd_names[i] == NULL)
continue;
vl.values = values + i;
sstrncpy (vl.type_instance, drbd_names[i],
sizeof (vl.type_instance));
plugin_dispatch_values (&vl);
}
return (0);
} /* drbd_submit_fields */
开发者ID:Mindera,项目名称:collectd,代码行数:56,代码来源:drbd.c
示例8: parse_struct_sig
Value *Parser::parse_struct() {
StructSig *sig = parse_struct_sig();
Struct *value = new Struct(sig);
for (size_t i = 0; i < sig->num_members; ++i) {
value->members[i] = parse_value();
}
return value;
}
开发者ID:netconstructor,项目名称:apitrace,代码行数:10,代码来源:trace_parser.cpp
示例9: read_uint
void Parser::parse_arg(Call *call, Mode mode) {
unsigned index = read_uint();
Value *value = parse_value(mode);
if (value) {
if (index >= call->args.size()) {
call->args.resize(index + 1);
}
call->args[index].value = value;
}
}
开发者ID:netconstructor,项目名称:apitrace,代码行数:10,代码来源:trace_parser.cpp
示例10:
/* Parse an object - create a new root, and populate. */
cJSON *cJSON_Parse(const char *value)
{
cJSON *c=cJSON_New_Item();
ep=0;
if (!c) return 0; /* memory fail */
if (!parse_value(c,skip(value))) {cJSON_Delete(c);return 0;}
//printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 264 \n");
return c;
}
开发者ID:sguotao,项目名称:DVB_F865_JYSX,代码行数:11,代码来源:cJSON.c
示例11: lex_scan
static json_t *parse_json(lex_t *lex, json_error_t *error)
{
lex_scan(lex, error);
if(lex->token != '[' && lex->token != '{') {
error_set(error, lex, "'[' or '{' expected");
return NULL;
}
return parse_value(lex, error);
}
开发者ID:derdewey,项目名称:jansson,代码行数:10,代码来源:load.c
示例12: parse_parameter
// parameter = attribute "=" value
// attribute = token
const char* parse_parameter(unsigned char** p)
{
if (parse_token(p))
return ERR;
if (parse_char(p, '='))
return ERR;
if (parse_value(p))
return ERR;
return NULL;
}
开发者ID:ruslanti,项目名称:rubicon,代码行数:12,代码来源:http_rules.c
示例13: strchr
bool LogFileOutput::parse_options(const char* options, outputStream* errstream) {
if (options == NULL || strlen(options) == 0) {
return true;
}
bool success = true;
char* opts = os::strdup_check_oom(options, mtLogging);
char* comma_pos;
char* pos = opts;
do {
comma_pos = strchr(pos, ',');
if (comma_pos != NULL) {
*comma_pos = '\0';
}
char* equals_pos = strchr(pos, '=');
if (equals_pos == NULL) {
success = false;
break;
}
char* key = pos;
char* value_str = equals_pos + 1;
*equals_pos = '\0';
if (strcmp(FileCountOptionKey, key) == 0) {
size_t value = parse_value(value_str);
if (value > MaxRotationFileCount) {
errstream->print_cr("Invalid option: %s must be in range [0, %u]",
FileCountOptionKey,
MaxRotationFileCount);
success = false;
break;
}
_file_count = static_cast<uint>(value);
} else if (strcmp(FileSizeOptionKey, key) == 0) {
julong value;
success = Arguments::atojulong(value_str, &value);
if (!success || (value > SIZE_MAX)) {
errstream->print_cr("Invalid option: %s must be in range [0, "
SIZE_FORMAT "]", FileSizeOptionKey, SIZE_MAX);
success = false;
break;
}
_rotate_size = static_cast<size_t>(value);
} else {
errstream->print_cr("Invalid option '%s' for log file output.", key);
success = false;
break;
}
pos = comma_pos + 1;
} while (comma_pos != NULL);
os::free(opts);
return success;
}
开发者ID:netroby,项目名称:jdk9-dev,代码行数:55,代码来源:logFileOutput.cpp
示例14: while
/* Build an array from input text. */
static const char *parse_array(cJSON *item,const char *value) {
cJSON *child;
if (*value!='[') {
ep=value; /* not an array! */
return 0;
}
item->type=cJSON_Array;
value=skip(value+1);
if (*value==']') {
return value+1; /* empty array. */
}
item->child=child=cJSON_New_Item();
if (!item->child) {
return 0; /* memory fail */
}
value=skip(parse_value(child,skip(value))); /* skip any spacing, get the value. */
if (!value) {
return 0;
}
while (*value==',') {
cJSON *new_item;
if (!(new_item=cJSON_New_Item())) {
return 0; /* memory fail */
}
child->next=new_item;
new_item->prev=child;
child=new_item;
value=skip(parse_value(child,skip(value+1)));
if (!value) {
return 0; /* memory fail */
}
}
if (*value==']') {
return value+1; /* end of array */
}
ep=value;
return 0; /* malformed. */
}
开发者ID:JasonYSU,项目名称:VETH3000Switch,代码行数:43,代码来源:cJSON.c
示例15: v_lisu_lisl
static void v_lisu_lisl(char *str, MNEMONIC *mne) {
unsigned long operand;
programlabel();
parse_value(str, &operand);
if (operand > 7) {
f8err(ERROR_VALUE_MUST_BE_LT_8, mne->name, str, false);
}
emit_opcode1(mne->opcode[0] | (operand & 7));
}
开发者ID:sparkiedk,项目名称:Toyota-PCM-hacking,代码行数:11,代码来源:mnef8.c
示例16: parse_values
void parse_values(char *buf, size_t buflen, int *pos, hash *h)
{
value_descriptor d;
void *v;
size_t vl;
while (parse_value(buf, buflen, pos, &d, &v, &vl))
{
struct hash_item i={d.f, d.t, v};
(*h)[d.k]=i;
};
}
开发者ID:kergma,项目名称:lascar,代码行数:11,代码来源:protocol.c
示例17: tbl_result_dispatch
static int tbl_result_dispatch(tbl_t *tbl, tbl_result_t *res, char **fields,
size_t fields_num) {
value_list_t vl = VALUE_LIST_INIT;
value_t values[res->values_num];
assert(res->ds);
assert(res->values_num == res->ds->ds_num);
for (size_t i = 0; i < res->values_num; ++i) {
assert(res->values[i] < fields_num);
char *value = fields[res->values[i]];
if (parse_value(value, &values[i], res->ds->ds[i].type) != 0)
return -1;
}
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE(values);
sstrncpy(vl.plugin, (tbl->plugin_name != NULL) ? tbl->plugin_name : "table",
sizeof(vl.plugin));
sstrncpy(vl.plugin_instance, tbl->instance, sizeof(vl.plugin_instance));
sstrncpy(vl.type, res->type, sizeof(vl.type));
if (res->instances_num == 0) {
if (res->instance_prefix)
sstrncpy(vl.type_instance, res->instance_prefix,
sizeof(vl.type_instance));
} else {
char *instances[res->instances_num];
char instances_str[DATA_MAX_NAME_LEN];
for (size_t i = 0; i < res->instances_num; ++i) {
assert(res->instances[i] < fields_num);
instances[i] = fields[res->instances[i]];
}
strjoin(instances_str, sizeof(instances_str), instances,
STATIC_ARRAY_SIZE(instances), "-");
instances_str[sizeof(instances_str) - 1] = '\0';
int r;
if (res->instance_prefix == NULL)
r = snprintf(vl.type_instance, sizeof(vl.type_instance), "%s",
instances_str);
else
r = snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%s",
res->instance_prefix, instances_str);
if ((size_t)r >= sizeof(vl.type_instance))
log_warn("Truncated type instance: %s.", vl.type_instance);
}
plugin_dispatch_values(&vl);
return 0;
} /* tbl_result_dispatch */
开发者ID:collectd,项目名称:collectd,代码行数:54,代码来源:table.c
示例18: v_lis
static void v_lis(char *str, MNEMONIC *mne) {
unsigned long operand;
programlabel();
parse_value(str, &operand);
if (operand > 15) {
f8err(ERROR_VALUE_MUST_BE_LT_10, mne->name, str, false);
}
emit_opcode1(0x70 | (operand & 15));
}
开发者ID:sparkiedk,项目名称:Toyota-PCM-hacking,代码行数:11,代码来源:mnef8.c
示例19: v_wordop
/*
* handles instructions that take a word operand:
* dci, jmp, pi
*/
static void v_wordop(char *str, MNEMONIC *mne) {
unsigned long value;
programlabel();
parse_value(str, &value);
if (value > 0xffff) {
f8err(ERROR_VALUE_MUST_BE_LT_10000, mne->name, str, false);
}
emit_opcode3(mne->opcode[0], (value >> 8) & 0xff, value & 0xff);
}
开发者ID:sparkiedk,项目名称:Toyota-PCM-hacking,代码行数:15,代码来源:mnef8.c
示例20: v_byteop
/*
* handles instructions that take a byte operand:
* ai, ci, in, li, ni, oi, out, xi
*/
static void v_byteop(char *str, MNEMONIC *mne) {
unsigned long value;
programlabel();
parse_value(str, &value);
if (value > 0xff) {
f8err(ERROR_ADDRESS_MUST_BE_LT_100, mne->name, str, false);
}
emit_opcode2(mne->opcode[0], value & 0xff);
}
开发者ID:sparkiedk,项目名称:Toyota-PCM-hacking,代码行数:15,代码来源:mnef8.c
注:本文中的parse_value函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论