#include <stdio.h>
#include <vector>
#include "Byte.h"
#include "Int16.h"
#include "UInt16.h"
#include "Int32.h"
#include "UInt32.h"
#include "Float32.h"
#include "Float64.h"
#include "Str.h"
#include "Url.h"
#include "Array.h"
#include "Structure.h"
#include "Sequence.h"
#include "Grid.h"
#include "BaseType.h"
Go to the source code of this file.
Defines | ||||||||||
#define | _util_h 1 | |||||||||
Functions | ||||||||||
FILE * | compressor (FILE *output, int &childpid) | |||||||||
string | dap_version () | |||||||||
bool | deflate_exists () | |||||||||
void | delete_xdrstdio (XDR *xdr) | |||||||||
const char * | dods_progress () | |||||||||
void | downcase (string &s) | |||||||||
string | file_to_string (FILE *fp) | |||||||||
FILE * | get_temp_file (char *temp) | |||||||||
char * | get_tempfile_template (char *file_template) | |||||||||
const char * | libdap_name () | |||||||||
const char * | libdap_root () | |||||||||
const char * | libdap_version () | |||||||||
XDR * | new_xdrstdio (FILE *stream, enum xdr_op xop) | |||||||||
time_t | parse_time (const char *str, bool expand) | |||||||||
string | path_to_filename (string path) | |||||||||
string | prune_spaces (const string &) | |||||||||
XDR * | set_xdrstdio (XDR *xdr, FILE *stream, enum xdr_op xop) | |||||||||
string | systime () | |||||||||
FILE * | text_to_temp (string text) | |||||||||
bool | unique_names (vector< BaseType * > l, const string &var, const string &type, string &msg) | |||||||||
bool_t | xdr_str (XDR *xdrs, string &buf) | |||||||||
Double to string conversion functions | ||||||||||
Conversions from double to a character representation which gets appended to a string. This function depends on the standard routine sprintf to convert a double to a textual representation which gets appended to the string 'str'.
| ||||||||||
void | append_double_to_string (const double &num, string &str) | |||||||||
string | double_to_string (const double &num) | |||||||||
Interger to string conversion functions | ||||||||||
Fast, safe conversions from long to a character representation which gets appended to a string. This method will take a long value 'val' and it will recursively divide it by 'base' in order to "extract" one by one the digits which compose it; these digits will be appended to the string str_val which will become the textual representation of 'val'. Please notice that the digits ``extracted'' from `val' will vary depending on the base chosen for the conversion; for example val=15 converted to base 10 will yield the digits (1,5), converted to base 16 will yield (F) and converted to base 2 will yield (1,1,1,1).
| ||||||||||
void | append_long_to_string (long val, int base, string &str_val) | |||||||||
string | long_to_string (long val, int base=10) |
void append_double_to_string | ( | const double & | num, | |
string & | str | |||
) |
void append_long_to_string | ( | long | val, | |
int | base, | |||
string & | str_val | |||
) |
Definition at line 480 of file util.cc.
References append_long_to_string().
Referenced by append_long_to_string(), InternalErr::InternalErr(), long_to_string(), and parse_error().
FILE* compressor | ( | FILE * | output, | |
int & | childpid | |||
) |
Referenced by DODSFilter::send_data().
string dap_version | ( | ) |
Get the version of the DAP library.
Definition at line 539 of file util.cc.
References libdap_version().
bool deflate_exists | ( | ) |
Referenced by DODSFilter::send_blob(), and DODSFilter::send_data().
void delete_xdrstdio | ( | XDR * | xdr | ) |
Definition at line 195 of file util.cc.
Referenced by DODSFilter::dataset_constraint(), and DODSFilter::functional_constraint().
const char* dods_progress | ( | ) |
string double_to_string | ( | const double & | num | ) |
Definition at line 528 of file util.cc.
References append_double_to_string().
void downcase | ( | string & | s | ) |
string file_to_string | ( | FILE * | fp | ) |
FILE* get_temp_file | ( | char * | temp | ) |
char* get_tempfile_template | ( | char * | file_template | ) |
Build a template for a temporary file suitable for use with mkstemp. Look around for a reasonable place to put a temporary file. Check first the value of the TMPDIR env var. If that does not yeild a path that's writable (as defined by access(..., W_OK|R_OK)) then look at P_tmpdir (as defined in stdio.h. If both come up empty, then use `./'.
This function allocates storage using new. The caller must delete the char array.
file_template | A template suitable for use with mkstemp (so it has to have six extra chars at its end. This is combined with the path to some temporary directory (see above). |
Definition at line 576 of file util.cc.
Referenced by get_temp_file().
const char* libdap_name | ( | ) |
const char* libdap_root | ( | ) |
Definition at line 251 of file util.cc.
References LIBDAP_ROOT, and libdap_root().
Referenced by libdap_root().
const char* libdap_version | ( | ) |
Return the version string for this package.
Definition at line 259 of file util.cc.
References PACKAGE_VERSION.
Referenced by dap_version().
string long_to_string | ( | long | val, | |
int | base = 10 | |||
) |
Definition at line 509 of file util.cc.
References append_long_to_string().
Referenced by AISDatabaseParser::aisError(), AISDatabaseParser::aisWarning(), DDXParser::ddx_fatal_error(), RCReader::get_proxy_server_host_url(), SignalHandler::register_handler(), save_str(), and libdap::set_array_using_double().
XDR* new_xdrstdio | ( | FILE * | stream, | |
enum xdr_op | xop | |||
) |
Definition at line 174 of file util.cc.
Referenced by DODSFilter::dataset_constraint(), and DODSFilter::functional_constraint().
time_t parse_time | ( | const char * | str, | |
bool | expand | |||
) |
Parse a string in GMT format to a local time time_t representation Four formats are accepted: Wkd, 00 Mon 0000 00:00:00 GMT (rfc1123) Weekday, 00-Mon-00 00:00:00 GMT (rfc850) Wkd Mon 00 00:00:00 0000 GMT (ctime) 1*DIGIT (delta-seconds)
Copied from libwww. 09/19/02 jhrg
str | The time string. | |
expand | If the time is given in delta seconds, adjust it to seconds since midnight 1 Jan 1970 if this is true. If false, simply convert the string to a time_t and return. The default value is true. |
Definition at line 129 of file util_mit.cc.
Referenced by HTTPCache::get_always_validate().
string path_to_filename | ( | string | path | ) |
Get the filename part from a path. This function can be used to return a string that has the directory compnents stripped from a path. This is useful when building error message strings.
If WIN32 is defined, use '\' as the path separator, otherwise use '/' as the path separator.
string prune_spaces | ( | const string & | name | ) |
Removed spaces from the front of a URL and also from the front of the CE. This function assumes that there are no holes in both the URL and the CE. It will remove leading space, but not other spaces.
name | The URL to process |
Definition at line 94 of file util.cc.
Referenced by Connect::Connect(), and is_keyword().
XDR* set_xdrstdio | ( | XDR * | xdr, | |
FILE * | stream, | |||
enum xdr_op | xop | |||
) |
FILE* text_to_temp | ( | string | text | ) |
bool unique_names | ( | vector< BaseType * > | l, | |
const string & | var, | |||
const string & | type, | |||
string & | msg | |||
) |
Definition at line 117 of file util.cc.
References DBG.
Referenced by Structure::check_semantics(), Sequence::check_semantics(), Grid::check_semantics(), and DDS::check_semantics().
bool_t xdr_str | ( | XDR * | xdrs, | |
string & | buf | |||
) |
Definition at line 219 of file util.cc.
References DBG, and max_str_len.
Referenced by Vector::deserialize(), Str::deserialize(), Vector::serialize(), and Str::serialize().