libdap++ Updated for version 3.8.2

util.h

Go to the documentation of this file.
00001 
00002 // -*- mode: c++; c-basic-offset:4 -*-
00003 
00004 // This file is part of libdap, A C++ implementation of the OPeNDAP Data
00005 // Access Protocol.
00006 
00007 // Copyright (c) 2002,2003 OPeNDAP, Inc.
00008 // Author: James Gallagher <jgallagher@opendap.org>
00009 //
00010 // This library is free software; you can redistribute it and/or
00011 // modify it under the terms of the GNU Lesser General Public
00012 // License as published by the Free Software Foundation; either
00013 // version 2.1 of the License, or (at your option) any later version.
00014 //
00015 // This library is distributed in the hope that it will be useful,
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023 //
00024 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
00025 
00026 // (c) COPYRIGHT URI/MIT 1994-1999
00027 // Please read the full copyright statement in the file COPYRIGHT.
00028 //
00029 // Authors:
00030 //      jhrg,jimg       James Gallagher (jgallagher@gso.uri.edu)
00031 
00032 // declarations for utility functions
00033 //
00034 // jhrg 9/21/94
00035 
00036 #ifndef _util_h
00037 #define _util_h 1
00038 
00039 #include <cstdio>
00040 #include <vector>
00041 
00042 #ifndef _basetype_h
00043 #include "BaseType.h"
00044 #endif
00045 
00046 using std::iostream;
00047 
00048 namespace libdap
00049 {
00050 
00051 string prune_spaces(const string &);
00052 bool unique_names(vector<BaseType *> l, const string &var, const string &type,
00053                   string &msg);
00054 FILE *text_to_temp(string text);
00055 string systime();
00056 FILE *compressor(FILE *output, int &childpid);
00057 bool deflate_exists();
00058 const char *libdap_root();
00063 extern "C" const char *libdap_version();
00064 extern "C" const char *libdap_name();
00065 const char *dods_progress();
00066 #ifdef WIN32
00067 void flush_stream(iostream ios, FILE *out);
00068 #endif
00069 
00070 void downcase(string &s);
00071 bool is_quoted(const string &s);
00072 string remove_quotes(const string &s);
00073 
00074 // Jose Garcia
00105 void append_long_to_string(long val, int base, string &str_val);
00106 string long_to_string(long val, int base = 10);
00108 
00109 // Jose Garcia
00123 void append_double_to_string(const double &num, string &str);
00124 string double_to_string(const double &num);
00126 
00128 string dap_version();
00129 
00138 string path_to_filename(string path);
00139 
00140 string file_to_string(FILE *fp);
00141 
00142 time_t parse_time(const char * str, bool expand);
00143 
00144 bool size_ok(unsigned int sz, unsigned int nelem);
00145 bool pathname_ok(const string &path, bool strict = true);
00146 
00147 } // namespace libdap
00148 
00149 #endif