Exiv2
utils.hpp
1 // ***************************************************************** -*- C++ -*-
2 /*
3  * Copyright (C) 2004-2021 Exiv2 authors
4  * This program is part of the Exiv2 distribution.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
19  */
20 #ifndef UTILS_HPP_
21 #define UTILS_HPP_
22 
23 // *********************************************************************
24 // included header files
25 
26 // + standard includes
27 #include <string>
28 
29 // *********************************************************************
30 // namespace extensions
36 namespace Util {
37 
38 // *********************************************************************
39 // free functions
40 
48  std::string dirname(const std::string& path);
49 
58  std::string basename(const std::string& path, bool delsuffix =false);
59 
65  std::string suffix(const std::string& path);
66 
72  bool strtol(const char* nptr, long& n);
73 
78  void replace(std::string& text, const std::string& searchText, const std::string& replaceText);
79 
80 } // namespace Util
81 
82 #endif // #ifndef UTILS_HPP_
Contains utility classes and functions. Most of these are wrappers for common C functions that do not...
Definition: utils.cpp:45
std::string basename(const std::string &path, bool delsuffix)
Get the filename component from the path string. See basename(3). If the delsuffix parameter is true,...
Definition: utils.cpp:72
std::string dirname(const std::string &path)
Get the directory component from the path string. See dirname(3).
Definition: utils.cpp:50
std::string suffix(const std::string &path)
Get the suffix from the path string. Normally, the suffix is the substring of the basename of path fr...
Definition: utils.cpp:89
void replace(std::string &text, const std::string &searchText, const std::string &replaceText)
Replaces all occurrences of searchText in the text string by replaceText.
Definition: utils.cpp:110
bool strtol(const char *nptr, long &n)
Convert a C string to a long value, which is returned in n. Returns true if the conversion is success...
Definition: utils.cpp:99