43 const string dosettrue =
"true";
44 const string dosetyes =
"yes";
49 if( dosettrue == doset || dosetyes == doset )
59 const string printable =
" ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789~`!@#$%^&*()_-+={[}]|\\:;<,>.?/'\"\n\t\r";
60 const string ESC =
"\\";
61 const string DOUBLE_ESC = ESC + ESC;
62 const string QUOTE =
"\"";
63 const string ESCQUOTE = ESC + QUOTE;
66 string::size_type ind = 0;
67 while ((ind = s.find(ESC, ind)) != s.npos) {
68 s.replace(ind, 1, DOUBLE_ESC);
69 ind += DOUBLE_ESC.length();
74 while ((ind = s.find_first_not_of(printable, ind)) != s.npos)
75 s.replace(ind, 1, ESC +
octstring(s[ind]));
80 while ((ind = s.find(QUOTE, ind)) != s.npos) {
81 s.replace(ind, 1, ESCQUOTE);
82 ind += ESCQUOTE.length();
92 buf << oct << setw(3) << setfill(
'0')
93 <<
static_cast<unsigned int>(val);
101 const string offend_char =
"\"";
102 const string replace_str =
""e";
103 size_t found_quote = 0;
104 size_t start_pos = 0;
105 while (found_quote != string::npos) {
106 found_quote = str.find(offend_char,start_pos);
107 if (found_quote!= string::npos){
108 str.replace(found_quote,offend_char.size(),replace_str);
109 start_pos = found_quote+1;
118 string DAPUNSUPPORTED =
"Unsupported";
119 string DAPBYTE =
"Byte";
120 string DAPINT16 =
"Int16";
121 string DAPUINT16 =
"Uint16";
122 string DAPINT32 =
"Int32";
123 string DAPUINT32 =
"Uint32";
124 string DAPFLOAT32 =
"Float32";
125 string DAPFLOAT64 =
"Float64";
126 string DAPSTRING =
"String";
162 return DAPUNSUPPORTED;
165 return DAPUNSUPPORTED;
175 return ((
H5INT16 == dtype) && (1 == mem_dtype_size))?
H5CHAR:dtype;
200 gp.ucp = (
unsigned char *) vals;
210 gp.cp = (
char *) vals;
224 gp.sp = (
short *) vals;
232 gp.usp = (
unsigned short *) vals;
233 rep << *(gp.usp+loc);
240 gp.ip = (
int *) vals;
247 gp.uip = (
unsigned int *) vals;
248 rep << *(gp.uip+loc);
255 gp.fp = (
float *) vals;
257 rep << setprecision(10);
259 if (rep.str().find(
'.') == string::npos
260 && rep.str().find(
'e') == string::npos)
267 gp.dp = (
double *) vals;
268 rep << std::showpoint;
269 rep << std::setprecision(17);
271 if (rep.str().find(
'.') == string::npos
272 && rep.str().find(
'e') == string::npos)
278 return string(
"UNKNOWN");
static string lowercase(const string &s)
Convert a string to all lower case.
static void replace_double_quote(string &str)
static bool check_beskeys(const string key)
static H5DataType get_mem_dtype(H5DataType, size_t)
static string print_attr(H5DataType h5type, int loc, void *vals)
static string print_type(H5DataType h5type)
static string escattr(string s)
A customized escaping function to escape special characters following OPeNDAP's escattr function that...
Helper functions for generating DAS attributes and a function to check BES Key.
void get_value(const string &s, string &val, bool &found)
Retrieve the value of a given key, if set.
static string octstring(unsigned char val)
Helper function for escattr.
static BESKeys * TheKeys()