本文整理汇总了C++中parse_tag函数的典型用法代码示例。如果您正苦于以下问题:C++ parse_tag函数的具体用法?C++ parse_tag怎么用?C++ parse_tag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse_tag函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: make_parameters_from_xml
ALPS_DECL params make_parameters_from_xml(boost::filesystem::path const & arg) {
Parameters par;
boost::filesystem::ifstream infile(arg.string());
// read outermost tag (e.g. <SIMULATION>)
XMLTag tag = parse_tag(infile, true);
std::string closingtag = "/" + tag.name;
// scan for <PARAMETERS> and read them
tag = parse_tag(infile, true);
while (tag.name != "PARAMETERS" && tag.name != closingtag) {
std::cerr << "skipping tag with name " << tag.name << "\n";
skip_element(infile, tag);
tag = parse_tag(infile, true);
}
par.read_xml(tag, infile, true);
if (!par.defined("SEED"))
par["SEED"] = 0;
params res;
for (Parameters::const_iterator it = par.begin(); it != par.end(); ++it)
res[it->key()] = it->value();
return res;
}
示例2: replace_name
static int replace_name(struct commit_name *e,
int prio,
const unsigned char *sha1,
struct tag **tag)
{
if (!e || e->prio < prio)
return 1;
if (e->prio == 2 && prio == 2) {
/* Multiple annotated tags point to the same commit.
* Select one to keep based upon their tagger date.
*/
struct tag *t;
if (!e->tag) {
t = lookup_tag(e->sha1);
if (!t || parse_tag(t))
return 1;
e->tag = t;
}
t = lookup_tag(sha1);
if (!t || parse_tag(t))
return 0;
*tag = t;
if (e->tag->date < t->date)
return 1;
}
return 0;
}
示例3: xmms_html_browse
static gboolean
xmms_html_browse (xmms_xform_t *xform, const gchar *url,
xmms_error_t *error)
{
gchar buffer[XMMS_XFORM_MAX_LINE_SIZE];
const gchar *plsurl;
gchar *tagbeg, *aurl, *full;
xmms_error_reset (error);
plsurl = xmms_xform_get_url (xform);
while (xmms_xform_read_line (xform, buffer, error)) {
tagbeg = buffer;
while ((tagbeg = strchr (tagbeg, '<'))) {
if ((aurl = parse_tag (++tagbeg, plsurl))) {
full = xmms_build_playlist_url (plsurl,
aurl);
xmms_xform_browse_add_symlink (xform,
NULL, full);
g_free (full);
g_free (aurl);
}
}
}
return TRUE;
}
示例4: section
Section* Parser::parse_section(){
if(!maybe_char(OPEN_SECTION)){
return NULL;
}
SafePointer<Section> section(new Section());
//These aren't safe pointers because the moment they have a value,
//they're immediately handed to another owner.
Text* text;
Tag* tag;
do{
if(text=parse_section_text()){
section->add(text);
}
if(tag=parse_tag()){
section->add(tag);
}
}while(text or tag);
if(!maybe_char(CLOSE_SECTION)){
if(it==end){
throw ParseError(SECTION_EOF,line,col);
}
throw ParseError(EXPECTED_CLOSE_SECTION,line,col);
}
return section.yield();
}
示例5: read_tag
xml::Tag read_tag(std::istream& stream) {
std::string line;
std::getline(stream, line);
xml::Tag st;
CHECK(parse_tag(line, &st));
return st;
}
示例6: map_sha1_file
struct object *parse_object(unsigned char *sha1)
{
unsigned long mapsize;
void *map = map_sha1_file(sha1, &mapsize);
if (map) {
char type[100];
unsigned long size;
void *buffer = unpack_sha1_file(map, mapsize, type, &size);
if (!buffer)
return NULL;
if (check_sha1_signature(sha1, buffer, size, type) < 0)
printf("sha1 mismatch %s\n", sha1_to_hex(sha1));
munmap(map, mapsize);
if (!strcmp(type, "blob")) {
struct blob *ret = lookup_blob(sha1);
parse_blob(ret);
return &ret->object;
} else if (!strcmp(type, "tree")) {
struct tree *ret = lookup_tree(sha1);
parse_tree(ret);
return &ret->object;
} else if (!strcmp(type, "commit")) {
struct commit *ret = lookup_commit(sha1);
parse_commit(ret);
return &ret->object;
} else if (!strcmp(type, "tag")) {
struct tag *ret = lookup_tag(sha1);
parse_tag(ret);
return &ret->object;
} else {
return NULL;
}
}
return NULL;
}
示例7: parse_tags
/*
* Parse all tags in the list, checking both the global and architecture
* specific tag tables.
*/
static void __init parse_tags(const struct tag *t)
{
for (; t->hdr.size; t = tag_next(t))
if (!parse_tag(t))
pr_warn("Ignoring unrecognised tag 0x%08x\n",
t->hdr.tag);
}
示例8: parse_hsc
/*
** parse_hsc
**
** parse input chars with full hsc support
**
** params: inpf...input file
**
** result: TRUE, if no error
*/
BOOL parse_hsc( INFILE *inpf )
{
if ( !fatal_error ) {
char *nxtwd;
nxtwd = infgetw( inpf );
if ( nxtwd ) {
if ( !strcmp(nxtwd, "<") ) /* parse tag */
parse_tag( inpf );
else if ( !strcmp(nxtwd, "&") ) /* parse entity */
parse_amp( inpf );
else { /* handle text */
if ( !strcmp(nxtwd, ">") ) { /* unmatched ">"? */
message( ERROR_UNMA_GT, inpf ); /* Y->error message */
errstr( "unmatched \">\"\n" );
}
outstr( infgetcws( inpf ) ); /* output word */
if (!infeof(inpf))
outstr( infgetcw( inpf ) );
}
}
}
return (BOOL)( !fatal_error );
}
示例9: parse_format
static int parse_format(const char *format, va_list *args)
{
int count;
char c;
char *ptr;
int tag_length;
ptr = (char *)format;
count = 0;
while (*ptr)
{
c = *ptr++;
if (c == '%')
{
if ((tag_length = parse_tag(&ptr, args)) == -1)
return (-1);
count += tag_length;
}
else
{
count++;
ft_putchar(c);
}
}
return (count);
}
示例10: blkid_parse_line
/*
* Parse a single line of data, and return a newly allocated dev struct.
* Add the new device to the cache struct, if one was read.
*
* Lines are of the form <device [TAG="value" ...]>/dev/foo</device>
*
* Returns -ve value on error.
* Returns 0 otherwise.
* If a valid device was read, *dev_p is non-NULL, otherwise it is NULL
* (e.g. comment lines, unknown XML content, etc).
*/
static int blkid_parse_line(blkid_cache cache, blkid_dev *dev_p, char *cp)
{
blkid_dev dev;
int ret;
if (!cache || !dev_p)
return -BLKID_ERR_PARAM;
*dev_p = NULL;
DBG(READ, ul_debug("line: %s", cp));
if ((ret = parse_dev(cache, dev_p, &cp)) <= 0)
return ret;
dev = *dev_p;
while ((ret = parse_tag(cache, dev, &cp)) > 0) {
;
}
if (dev->bid_type == NULL) {
DBG(READ, ul_debug("blkid: device %s has no TYPE",dev->bid_name));
blkid_free_dev(dev);
goto done;
}
done:
return ret;
}
示例11: map_collect_data_osm
int
map_collect_data_osm(FILE *in, struct maptool_osm *osm)
{
int size=BUFFER_SIZE;
char buffer[BUFFER_SIZE];
char *p;
sig_alrm(0);
if (!fgets(buffer, size, in) || !xml_declaration_in_line(buffer)){
fprintf(stderr,"FATAL: First line does not start with XML declaration;\n"
"this does not look like a valid OSM file.\n");
exit(EXIT_FAILURE);
}
while (fgets(buffer, size, in)) {
p=strchr(buffer,'<');
if (! p) {
fprintf(stderr,"FATAL: wrong line in input data (does not start with '<'): %s\n", buffer);
fprintf(stderr,"This does not look like a valid OSM file.\n"
"Note that maptool can only process OSM files without wrapped or empty lines.\n");
exit(EXIT_FAILURE);
}
if (!strncmp(p, "<osm ",5)) {
} else if (!strncmp(p, "<bound ",7)) {
} else if (!strncmp(p, "<node ",6)) {
if (!parse_node(p))
fprintf(stderr,"WARNING: failed to parse %s\n", buffer);
processed_nodes++;
} else if (!strncmp(p, "<tag ",5)) {
if (!parse_tag(p))
fprintf(stderr,"WARNING: failed to parse %s\n", buffer);
} else if (!strncmp(p, "<way ",5)) {
if (!parse_way(p))
fprintf(stderr,"WARNING: failed to parse %s\n", buffer);
processed_ways++;
} else if (!strncmp(p, "<nd ",4)) {
if (!parse_nd(p))
fprintf(stderr,"WARNING: failed to parse %s\n", buffer);
} else if (!strncmp(p, "<relation ",10)) {
if (!parse_relation(p))
fprintf(stderr,"WARNING: failed to parse %s\n", buffer);
processed_relations++;
} else if (!strncmp(p, "<member ",8)) {
if (!parse_member(p))
fprintf(stderr,"WARNING: failed to parse %s\n", buffer);
} else if (!strncmp(p, "</node>",7)) {
osm_end_node(osm);
} else if (!strncmp(p, "</way>",6)) {
osm_end_way(osm);
} else if (!strncmp(p, "</relation>",11)) {
osm_end_relation(osm);
} else if (!strncmp(p, "</osm>",6)) {
} else {
fprintf(stderr,"WARNING: unknown tag in %s\n", buffer);
}
}
sig_alrm(0);
sig_alrm_end();
return 1;
}
示例12: html_parse_tag
enum html_tag
html_parse_tag(const struct array *tag)
{
if (tag && tag->data) {
return parse_tag(*tag);
} else {
return HTML_TAG_UNKNOWN;
}
}
示例13: parse_value
static const char *parse_field(struct buffer *self, int tag)
{
if (parse_tag(self) != tag) {
next_tag(self);
return NULL;
}
return parse_value(self);
}
示例14: fsck_walk_tag
static int fsck_walk_tag(struct tag *tag, void *data, struct fsck_options *options)
{
char *name = get_object_name(options, &tag->object);
if (parse_tag(tag))
return -1;
if (name)
put_object_name(options, tag->tagged, "%s", name);
return options->walk(tag->tagged, OBJ_ANY, data, options);
}
示例15: html_render_tag
static void
html_render_tag(struct render_context *ctx, const struct array tag)
{
if (tag.size > 0) {
ctx->closing = html_tag_is_closing(&tag);
html_output_tag(ctx->output, tag);
if (HTML_TAG_PRE == parse_tag(tag)) {
ctx->preformatted = !ctx->closing;
}
}
}