libdap  Updated for version 3.20.6
libdap4 is an implementation of OPeNDAP's DAP protocol.
escaping.h
1 
2 // -*- mode: c++; c-basic-offset:4 -*-
3 
4 // This file is part of libdap, A C++ implementation of the OPeNDAP Data
5 // Access Protocol.
6 
7 // Copyright (c) 2002,2003 OPeNDAP, Inc.
8 // Author: James Gallagher <jgallagher@opendap.org>
9 //
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Lesser General Public
12 // License as published by the Free Software Foundation; either
13 // version 2.1 of the License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 //
24 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
25 
26 // (c) COPYRIGHT URI/MIT 1999
27 // Please read the full copyright statement in the file COPYRIGHT_URI.
28 //
29 // Authors:
30 // jhrg,jimg James Gallagher <jgallagher@gso.uri.edu>
31 
32 // Declarations for identifier escaping and un-escaping functions.
33 
34 #ifndef _escaping_h
35 #define _escaping_h
36 
37 #include <string>
38 
39 using std::string;
40 
41 namespace libdap
42 {
43 
44 string hexstring(unsigned char val);
45 string unhexstring(string s);
46 string octstring(unsigned char val);
47 string unoctstring(string s);
48 
49 // The original set of allowed characters was: [0-9a-zA-Z_%]
50 // The characters accepted in DAP2 ids: [-+a-zA-Z0-9_/%.\\#*]; everything
51 // else must be escaped. Note that for some inscrutable reason, we've been
52 // escaping '*'.
53 
54 // The characters allowable in an id in a URI (see RFC 2396):
55 // [-A-Za-z0-9_.!~*'()].
56 
57 string id2www(string s, const string &allowable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+_/.\\*");
58 
59 // This is what DAP2 allows in a ce: [-+a-zA-Z0-9_/%.\\#]
60 string id2www_ce(string s, const string &allowable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+_/.\\");
61 
62 string www2id(const string &in, const string &escape = "%",
63  const string &except = "");
64 
65 // Include these for compatibility with the old names. 7/19/2001 jhrg
66 #define id2dods id2www
67 #define dods2id www2id
68 
69 string octal_to_hex(const string &octal_digits);
70 
71 string id2xml(string in, const string &not_allowed = "><&'\"");
72 string xml2id(string in);
73 
74 string esc2underscore(string s);
75 string char2ASCII(string s, const string escape = "%[0-7][0-9a-fA-F]");
76 string escattr(string s);
77 string unescattr(string s);
78 
79 string munge_error_message(string msg);
80 
81 string unescape_double_quotes(string source);
82 string escape_double_quotes(string source);
83 
84 } // namespace libdap
85 
86 #endif // _escaping_h
87 
string id2www_ce(string in, const string &allowable)
Definition: escaping.cc:178
string id2xml(string in, const string &not_allowed)
Definition: escaping.cc:272
string escape_double_quotes(string source)
Definition: escaping.cc:470
top level DAP object to house generic methods
Definition: AISConnect.cc:30
string xml2id(string in)
Definition: escaping.cc:322
string www2id(const string &in, const string &escape, const string &except)
Definition: escaping.cc:220
string esc2underscore(string s)
Definition: escaping.cc:354
string unescattr(string s)
Definition: escaping.cc:407
string id2www(string in, const string &allowable)
Definition: escaping.cc:153
string unescape_double_quotes(string source)
Definition: escaping.cc:487
string escattr(string s)
Definition: escaping.cc:368