nidas  v1.2-1520
util.h
Go to the documentation of this file.
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4; -*-
2 // vim: set shiftwidth=4 softtabstop=4 expandtab:
3 /*
4  ********************************************************************
5  ** NIDAS: NCAR In-situ Data Acquistion Software
6  **
7  ** 2006, Copyright University Corporation for Atmospheric Research
8  **
9  ** This program is free software; you can redistribute it and/or modify
10  ** it under the terms of the GNU General Public License as published by
11  ** the Free Software Foundation; either version 2 of the License, or
12  ** (at your option) any later version.
13  **
14  ** This program is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  ** GNU General Public License for more details.
18  **
19  ** The LICENSE.txt file accompanying this software contains
20  ** a copy of the GNU General Public License. If it is not found,
21  ** write to the Free Software Foundation, Inc.,
22  ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  **
24  ********************************************************************
25 */
26 
35 #ifndef NIDAS_UTIL_UTIL_H
36 #define NIDAS_UTIL_UTIL_H
37 
38 #include <string>
39 
40 #include "IOException.h"
41 
42 namespace nidas { namespace util {
43 
50 extern std::string replaceBackslashSequences(const std::string& str);
51 
52 /* note that the above back slashes above are doubled so that
53  * doxygen displays them as one back slash. One does
54  * not double them in the parameter string.
55  */
56 
61 extern std::string addBackslashSequences(const std::string& str);
62 
66 extern void trimString(std::string& str);
67 
71 extern void replaceCharsIn(std::string& in,const std::string& pat, const std::string& rep);
72 
73 extern std::string replaceChars(const std::string& in,const std::string& pat, const std::string& rep);
74 
79 extern std::string svnStatus(const std::string& path) throw (IOException);
80 
85 extern float dirFromUV(float u, float v);
86 
87 }} // namespace nidas namespace core
88 
89 #endif
std::string replaceChars(const std::string &in, const std::string &pat, const std::string &rep)
Definition: util.cc:160
void replaceCharsIn(std::string &in, const std::string &pat, const std::string &rep)
Replace all occurences of pat in string in with rep.
Definition: util.cc:153
std::string svnStatus(const std::string &path)
Run &quot;svn status -v --depth empty&quot; on a path and return a concatentated string of revision + flags...
Definition: util.cc:167
float dirFromUV(float u, float v)
Calculate wind direction in degrees from U and V wind components, or if U and V are both zero return ...
Definition: util.cc:218
std::string addBackslashSequences(const std::string &str)
Utility function for substituting backslash sequences back into a string.
Definition: util.cc:102
std::string replaceBackslashSequences(const std::string &str)
Utility function for replacing backslash sequences in a string.
Definition: util.cc:36
void trimString(std::string &str)
Utility to remove white space characters (matching isspace()) from end of string. ...
Definition: util.cc:144