#include <ctype.h>
#include <iomanip>
#include <string>
#include <sstream>
#include "GNURegex.h"
#include "Error.h"
#include "InternalErr.h"
#include "debug.h"
Include dependency graph for escaping.cc:
Go to the source code of this file.
Functions | |
string | esc2underscore (string s) |
string | escattr (string s) |
string | hexstring (unsigned char val) |
string | id2www (string in, const string &allowable) |
string | id2www_ce (string in, const string &allowable) |
string | id2xml (string in, const string ¬_allowed) |
string | munge_error_message (string msg) |
string | octstring (unsigned char val) |
string | unescattr (string s) |
string | unhexstring (string s) |
string | unoctstring (string s) |
string | www2id (const string &in, const string &escape, const string &except) |
string | xml2id (string in) |
string esc2underscore | ( | string | s | ) |
Return a string that has all the %<hex
digit><hex digit> sequences replaced with underscores (`_').
s | The string to transform |
Definition at line 293 of file escaping.cc.
string escattr | ( | string | s | ) |
Escape non-printable characters and quotes from an HDF attribute.
s | The attribute to modify. |
Definition at line 307 of file escaping.cc.
References octstring().
Referenced by Str::print_val().
Here is the call graph for this function:
string hexstring | ( | unsigned char | val | ) |
string id2www | ( | string | in, | |
const string & | allowable | |||
) |
Replace characters that are not allowed in DAP2 identifiers.
-In the DAP itself, id2www() is called in:
-In the client code:
in | The string in which to replace characters. | |
allowable | The set of characters that are allowed in a URI. default: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+_/.\\*" |
Definition at line 150 of file escaping.cc.
References hexstring().
Referenced by id2www_ce(), DDS::print(), AttrTable::print(), DDS::print_constrained(), Grid::print_decl(), Constructor::print_decl(), BaseType::print_decl(), Array::print_decl(), and AttrTable::simple_print().
Here is the call graph for this function:
string id2www_ce | ( | string | in, | |
const string & | allowable | |||
) |
Replace characters that are not allowed in WWW URLs using rules specific to Constraint Expressions. This has canged over time and now the only difference is that '*' is escaped by this function while it is not escaped by id2www().
in | The string in which to replace characters. | |
allowable | The set of characters that are allowed in a URI. default: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+_/.\\" |
Definition at line 173 of file escaping.cc.
References id2www().
Referenced by Connect::request_das(), Connect::request_data(), Connect::request_dds(), Connect::request_ddx(), Connect::request_protocol(), and Connect::request_version().
Here is the call graph for this function:
string id2xml | ( | string | in, | |
const string & | not_allowed | |||
) |
Replace characters that are not allowed in XML
in | The string in which to replace characters. | |
not_allowed | The set of characters that are not allowed in XML. default: ><&'(single quote)"(double quote) |
Definition at line 243 of file escaping.cc.
Referenced by Grid::print_xml(), DDS::print_xml(), Constructor::print_xml(), BaseType::print_xml(), AttrTable::print_xml(), and Array::print_xml_core().
string munge_error_message | ( | string | msg | ) |
Definition at line 388 of file escaping.cc.
string octstring | ( | unsigned char | val | ) |
string unescattr | ( | string | s | ) |
Un-escape special characters, quotes and backslashes from an HDF attribute.
Note: A regex to match one \ must be defined as: Regex foo = "\\\\"; because both C++ strings and GNU's Regex also employ \ as an escape character!
s | The escaped attribute. |
Definition at line 346 of file escaping.cc.
References DBG, and unoctstring().
Here is the call graph for this function:
string unhexstring | ( | string | s | ) |
string unoctstring | ( | string | s | ) |
string www2id | ( | const string & | in, | |
const string & | escape, | |||
const string & | except | |||
) |
Given a string that contains WWW escape sequences, translate those escape sequences back into ASCII characters. Return the modified string.
-Places in the dap code where www2id() is called:
-In the server code:
in | The string to modify. | |
escape | The character used to signal the begining of an escape sequence. default: "%" | |
except | If there is some escape code that should not be removed by this call (e.g., you might not want to remove spaces, 20) use this parameter to specify that code. The function will then transform all escapes except that one. default: "" |
Definition at line 207 of file escaping.cc.
References unhexstring().
Referenced by AttrTable::add_container_alias(), AttrTable::add_value_alias(), AttrTable::append_attr(), AttrTable::append_container(), Array::append_dim(), DAS::DAS(), AttrTable::del_attr(), DODSFilter::initialize(), DODSFilter::set_ce(), DODSFilter::set_dataset_name(), BaseType::set_name(), AttrTable::set_name(), Vector::var(), Structure::var(), Sequence::var(), Grid::var(), and DDS::var().
Here is the call graph for this function:
string xml2id | ( | string | in | ) |
Given a string that contains XML escape sequences (i.e., entities), translate those back into ASCII characters. Return the modified string.
in | The string to modify. |
Definition at line 261 of file escaping.cc.