Exiv2
Loading...
Searching...
No Matches
utils.hpp
Go to the documentation of this file.
1// ********************************************************* -*- C++ -*-
2/*
3 * Copyright (C) 2004-2018 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 */
27#ifndef UTILS_HPP_
28#define UTILS_HPP_
29
30// *********************************************************************
31// included header files
32
33// + standard includes
34#include <string>
35
36// *********************************************************************
37// namespace extensions
43namespace Util {
44
45// *********************************************************************
46// free functions
47
55 std::string dirname(const std::string& path);
56
65 std::string basename(const std::string& path, bool delsuffix =false);
66
72 std::string suffix(const std::string& path);
73
79 bool strtol(const char* nptr, long& n);
80
85 void replace(std::string& text, const std::string& searchText, const std::string& replaceText);
86
87} // namespace Util
88
89#endif // #ifndef UTILS_HPP_
Contains utility classes and functions. Most of these are wrappers for common C functions that do not...
Definition utils.cpp:50
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:77
std::string dirname(const std::string &path)
Get the directory component from the path string. See dirname(3).
Definition utils.cpp:55
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:94
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:115
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:104