2003-07-01 20:37:09 +00:00
|
|
|
// The contents of this file are subject to the BOINC Public License
|
2002-04-30 22:22:54 +00:00
|
|
|
// Version 1.0 (the "License"); you may not use this file except in
|
|
|
|
// compliance with the License. You may obtain a copy of the License at
|
2003-07-01 20:37:09 +00:00
|
|
|
// http://boinc.berkeley.edu/license_1.0.txt
|
2003-10-03 06:46:22 +00:00
|
|
|
//
|
2002-04-30 22:22:54 +00:00
|
|
|
// Software distributed under the License is distributed on an "AS IS"
|
|
|
|
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
|
|
// License for the specific language governing rights and limitations
|
2003-10-03 06:46:22 +00:00
|
|
|
// under the License.
|
|
|
|
//
|
|
|
|
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
|
|
|
//
|
2002-04-30 22:22:54 +00:00
|
|
|
// The Initial Developer of the Original Code is the SETI@home project.
|
|
|
|
// Portions created by the SETI@home project are Copyright (C) 2002
|
2003-10-03 06:46:22 +00:00
|
|
|
// University of California at Berkeley. All Rights Reserved.
|
|
|
|
//
|
2002-04-30 22:22:54 +00:00
|
|
|
// Contributor(s):
|
|
|
|
//
|
|
|
|
|
2003-10-03 06:46:22 +00:00
|
|
|
#include <cstdio>
|
|
|
|
#include <cstdlib>
|
2003-06-16 19:06:08 +00:00
|
|
|
#include <string>
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2003-10-03 06:46:22 +00:00
|
|
|
using std::string;
|
|
|
|
|
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);
|
2003-11-28 19:19:11 +00:00
|
|
|
extern bool parse_str(const char* buf, const char* tag, 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);
|
2003-11-28 19:19:11 +00:00
|
|
|
extern int copy_element_contents(FILE* in, const char* end_tag, string&);
|
2003-06-17 01:03:45 +00:00
|
|
|
extern int read_file_malloc(const char* pathname, char*& str);
|
2002-12-20 02:12:27 +00:00
|
|
|
extern void replace_element(char* buf, char* start, char* end, char* replacement);
|
2003-10-31 22:37:46 +00:00
|
|
|
//extern void extract_venue(const char* in, const char* venue_name, char* out);
|
2003-05-20 00:03:39 +00:00
|
|
|
extern char* sgets(char* buf, int len, char* &in);
|
2003-06-16 19:06:08 +00:00
|
|
|
extern bool extract_xml_record(const std::string &field, const char *tag, std::string &record);
|
|
|
|
|
2003-11-29 07:56:53 +00:00
|
|
|
class InvalidBase64Exception
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
string base64_encode (const char* from, size_t length) throw(InvalidBase64Exception);
|
|
|
|
string base64_decode (const char* from, size_t length) throw(InvalidBase64Exception);
|
2003-11-29 12:35:21 +00:00
|
|
|
inline string base64_decode (string const& from) throw(InvalidBase64Exception)
|
2003-11-29 12:33:24 +00:00
|
|
|
{
|
|
|
|
return base64_decode(from.c_str(), from.length());
|
|
|
|
}
|
2003-11-29 07:56:53 +00:00
|
|
|
|