2005-01-20 23:22:22 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2005 University of California
|
2004-11-14 08:29:32 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation;
|
|
|
|
// either version 2.1 of the License, or (at your option) any later version.
|
2003-10-03 06:46:22 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This software is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
2002-04-30 22:22:54 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// To view the GNU Lesser General Public License visit
|
|
|
|
// http://www.gnu.org/copyleft/lesser.html
|
|
|
|
// or write to the Free Software Foundation, Inc.,
|
|
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2004-06-12 18:44:53 +00:00
|
|
|
#ifndef PARSE_H
|
|
|
|
#define PARSE_H
|
|
|
|
|
2004-06-10 07:49:50 +00:00
|
|
|
#ifndef _WIN32
|
2003-10-03 06:46:22 +00:00
|
|
|
#include <cstdio>
|
|
|
|
#include <cstdlib>
|
2003-06-16 19:06:08 +00:00
|
|
|
#include <string>
|
2004-06-10 07:49:50 +00:00
|
|
|
#endif
|
2003-10-03 06:46:22 +00:00
|
|
|
|
2003-06-17 01:03:45 +00:00
|
|
|
extern bool parse(char* , char* );
|
|
|
|
extern bool parse_int(const char* buf, const char*tag, int&);
|
|
|
|
extern bool parse_double(const char*, const char*, double&);
|
|
|
|
extern bool parse_str(const char*, const char*, char*, int);
|
2004-06-30 18:17:21 +00:00
|
|
|
extern bool parse_str(const char* buf, const char* tag, std::string& dest);
|
2003-06-17 18:43:13 +00:00
|
|
|
extern void parse_attr(const char* buf, const char* attrname, char* out, int len);
|
2003-06-17 01:03:45 +00:00
|
|
|
extern bool match_tag(const char*, const char*);
|
|
|
|
extern bool match_tag(const std::string &, const char*);
|
2002-04-30 22:22:54 +00:00
|
|
|
extern void copy_stream(FILE* in, FILE* out);
|
2002-07-05 05:33:40 +00:00
|
|
|
extern void strcatdup(char*& p, char* buf);
|
2003-06-17 01:03:45 +00:00
|
|
|
extern int dup_element_contents(FILE* in, const char* end_tag, char** pp);
|
|
|
|
extern int copy_element_contents(FILE* in, const char* end_tag, char* p, int len);
|
2004-06-30 18:17:21 +00:00
|
|
|
extern int copy_element_contents(FILE* in, const char* end_tag, std::string&);
|
2003-06-17 01:03:45 +00:00
|
|
|
extern int read_file_malloc(const char* pathname, char*& str);
|
2004-09-13 18:05:54 +00:00
|
|
|
extern void replace_element_contents(
|
2005-02-16 23:17:43 +00:00
|
|
|
char* buf, const char* start, const char* end, const char* replacement
|
2004-09-13 18:05:54 +00:00
|
|
|
);
|
2005-02-16 23:17:43 +00:00
|
|
|
extern bool remove_element(char* buf, const char* start, const char* end);
|
|
|
|
extern bool str_replace(char* str, const char* old, const char* neww);
|
2003-05-20 00:03:39 +00:00
|
|
|
extern char* sgets(char* buf, int len, char* &in);
|
2004-06-30 18:17:21 +00:00
|
|
|
extern void xml_escape(std::string&, std::string&);
|
2004-07-15 18:54:17 +00:00
|
|
|
extern void xml_escape(char*, std::string&);
|
2004-06-30 18:17:21 +00:00
|
|
|
extern void xml_unescape(std::string&, std::string&);
|
2004-03-31 06:07:17 +00:00
|
|
|
extern void extract_venue(char*, char*, char*);
|
2004-06-12 18:44:53 +00:00
|
|
|
|
|
|
|
#endif
|