utils.hpp
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
#ifndef UTILS_HPP_
#define UTILS_HPP_
// *********************************************************************
// included header files
// + standard includes
#include <string>
// *********************************************************************
// namespace extensions
namespace Util {
// *********************************************************************
// free functions
std::string dirname(const std::string& path);
std::string basename(const std::string& path, bool delsuffix =false);
std::string suffix(const std::string& path);
bool strtol(const char* nptr, long& n);
void replace(std::string& text, const std::string& searchText, const std::string& replaceText);
} // namespace Util
#endif // #ifndef UTILS_HPP_
Util
Contains utility classes and functions. Most of these are wrappers for common C functions that do not...
Definition: utils.cpp:45
Util::basename
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
Util::dirname
std::string dirname(const std::string &path)
Get the directory component from the path string. See dirname(3).
Definition: utils.cpp:50
Util::suffix
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
Util::replace
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
Util::strtol
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