本文整理汇总了C++中parse_tag函数的典型用法代码示例。如果您正苦于以下问题:C++ parse_tag函数的具体用法?C++ parse_tag怎么用?C++ parse_tag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse_tag函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:wangleiphy,项目名称:ALPSCore,代码行数:25,代码来源:make_parameters_from_xml.cpp
示例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;
}
开发者ID:OpenSpan,项目名称:git,代码行数:32,代码来源:describe.c
示例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;
}
开发者ID:randalboyle,项目名称:xmms2-devel,代码行数:27,代码来源:html.c
示例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();
}
开发者ID:ConsciousCode,项目名称:Snow,代码行数:29,代码来源:parser.cpp
示例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;
}
开发者ID:ibaned,项目名称:omega_h2,代码行数:7,代码来源:xml.cpp
示例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;
}
开发者ID:ahappyforest,项目名称:git,代码行数:35,代码来源:object.c
示例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);
}
开发者ID:0-T-0,项目名称:ps4-linux,代码行数:11,代码来源:atags_parse.c
示例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 );
}
开发者ID:BackupTheBerlios,项目名称:hsc-svn,代码行数:43,代码来源:parse.c
示例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);
}
开发者ID:Qpaq,项目名称:42Projects,代码行数:26,代码来源:recursive.c
示例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;
}
开发者ID:Webster-WXH,项目名称:util-linux,代码行数:41,代码来源:read.c
示例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;
}
开发者ID:PDXostc,项目名称:navit,代码行数:58,代码来源:osm_xml.c
示例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;
}
}
开发者ID:Eppo791906066,项目名称:gtk-gnutella,代码行数:9,代码来源:html.c
示例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);
}
开发者ID:weixu8,项目名称:libtrading,代码行数:9,代码来源:fix_message.c
示例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);
}
开发者ID:PEPE-coin,项目名称:git,代码行数:10,代码来源:fsck.c
示例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;
}
}
}
开发者ID:Eppo791906066,项目名称:gtk-gnutella,代码行数:11,代码来源:html.c
示例16: infile
/* astreich, 06/17 */
Parameters Task::parse_ext_task_file(std::string infilename)
{
Parameters res;
boost::filesystem::ifstream infile(infilename);
// 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);
}
res.read_xml(tag,infile,true);
if (!res.defined("SEED"))
res["SEED"]=0;
return res;
}
开发者ID:wangleiphy,项目名称:ALPSCore,代码行数:22,代码来源:task.C
示例17: parse_value
Flake* Parser::parse_value(){
Flake* f;
if(f=parse_text()){
return f;
}
if(f=parse_tag()){
return f;
}
if(f=parse_section()){
return f;
}
//Error checking
/*
Snow errors are very predictable, so check for common
mistakes. By this point, we know the next character is
one of the quote characters, ], }, whitespace, a control
character, or EOF (if not, something is HORRIBLY wrong)
*/
if(it==end){
throw ParseError(TAG_EOF,line,col);
}
char c=*it;
if(c==CLOSE_SECTION){
throw ParseError(UNEXPECTED_CLOSE_SECTION,line,col-1);
}
if(c==CLOSE_TAG){
throw ParseError(UNNAMED_ATTR,colonline,coloncol);
}
if(c==NAMED_ATTR){
throw ParseError(ILLEGAL_NAMED,line,col-1);
}
if(isspace(c)){
//This should NEVER happen. Guarantees a problem with the parser.
throw ParseError(UNEXPECTED_SPACE,line,col);
}
//Reserved for cosmic ray errors
throw ParseError(COSMIC_RAY_ERR,line,col);
}
开发者ID:ConsciousCode,项目名称:Snow,代码行数:49,代码来源:parser.cpp
示例18: display_name
static void display_name(struct commit_name *n)
{
if (n->prio == 2 && !n->tag) {
n->tag = lookup_tag(n->sha1);
if (!n->tag || parse_tag(n->tag) || !n->tag->tag)
die("annotated tag %s not available", n->path);
if (strcmp(n->tag->tag, n->path))
warning("tag '%s' is really '%s' here", n->tag->tag, n->path);
}
if (n->tag)
printf("%s", n->tag->tag);
else
printf("%s", n->path);
}
开发者ID:Pistos,项目名称:git,代码行数:15,代码来源:builtin-describe.c
示例19: parse_field_promisc
static int parse_field_promisc(struct buffer *self, int *tag, const char **value)
{
int ret;
ret = parse_tag(self, tag);
if (ret)
goto fail;
return parse_value(self, value);
fail:
next_tag(self);
return ret;
}
开发者ID:bjoto,项目名称:libtrading,代码行数:15,代码来源:fix_message.c
示例20: cgit_print_tag
void cgit_print_tag(char *revname)
{
unsigned char sha1[20];
struct object *obj;
struct tag *tag;
struct taginfo *info;
if (get_sha1(revname, sha1)) {
cgit_print_error(fmt("Bad tag reference: %s", revname));
return;
}
obj = parse_object(sha1);
if (!obj) {
cgit_print_error(fmt("Bad object id: %s", sha1_to_hex(sha1)));
return;
}
if (obj->type == OBJ_TAG) {
tag = lookup_tag(sha1);
if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) {
cgit_print_error(fmt("Bad tag object: %s", revname));
return;
}
html("<table class='commit-info'>\n");
htmlf("<tr><td>Tag name</td><td>%s (%s)</td></tr>\n",
revname, sha1_to_hex(sha1));
if (info->tagger_date > 0) {
html("<tr><td>Tag date</td><td>");
cgit_print_date(info->tagger_date, FMT_LONGDATE, ctx.cfg.local_time);
html("</td></tr>\n");
}
if (info->tagger) {
html("<tr><td>Tagged by</td><td>");
html_txt(info->tagger);
if (info->tagger_email) {
html(" ");
html_txt(info->tagger_email);
}
html("</td></tr>\n");
}
html("<tr><td>Tagged object</td><td>");
cgit_object_link(tag->tagged);
html("</td></tr>\n");
html("</table>\n");
print_tag_content(info->msg);
}
return;
}
开发者ID:metajack,项目名称:cgit,代码行数:47,代码来源:ui-tag.c
注:本文中的parse_tag函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论