utils are in Internal namespace

main
Luis Díaz Más 3 years ago
parent cc79051b79
commit d4ffcb9497

@ -29,7 +29,7 @@
// ***************************************************************************** // *****************************************************************************
namespace { namespace {
using namespace Exiv2; using namespace Exiv2;
using Exiv2::byte; using namespace Exiv2::Internal;
// signature of DOS EPS // signature of DOS EPS
constexpr auto dosEpsSignature = std::string_view("\xC5\xD0\xD3\xC6"); constexpr auto dosEpsSignature = std::string_view("\xC5\xD0\xD3\xC6");

@ -4,7 +4,7 @@
#include <cctype> #include <cctype>
#include <iterator> #include <iterator>
namespace Exiv2 { namespace Exiv2::Internal {
std::string upper(const std::string& str) { std::string upper(const std::string& str) {
std::string result; std::string result;
@ -18,4 +18,4 @@ std::string lower(const std::string& a) {
return b; return b;
} }
} // namespace Exiv2 } // namespace Exiv2::Internal

@ -4,7 +4,8 @@
#include <string> #include <string>
#include <string_view> #include <string_view>
namespace Exiv2 { namespace Exiv2::Internal {
constexpr bool startsWith(std::string_view s, std::string_view start) { constexpr bool startsWith(std::string_view s, std::string_view start) {
return s.find(start) == 0; return s.find(start) == 0;
} }
@ -15,6 +16,6 @@ std::string upper(const std::string& str);
/// @brief Returns the lowercase version of \b str /// @brief Returns the lowercase version of \b str
std::string lower(const std::string& str); std::string lower(const std::string& str);
} // namespace Exiv2 } // namespace Exiv2::Internal
#endif // EXIV2_UTILS_HPP #endif // EXIV2_UTILS_HPP

@ -84,7 +84,7 @@ void XmpSidecar::readMetadata() {
} // XmpSidecar::readMetadata } // XmpSidecar::readMetadata
static bool matchi(const std::string& key, const char* substr) { static bool matchi(const std::string& key, const char* substr) {
return lower(key).find(substr) != std::string::npos; return Internal::lower(key).find(substr) != std::string::npos;
} }
void XmpSidecar::writeMetadata() { void XmpSidecar::writeMetadata() {

@ -4,7 +4,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
using namespace Exiv2; using namespace Exiv2::Internal;
TEST(stringUtils, startsWithReturnsTrue) { TEST(stringUtils, startsWithReturnsTrue) {
ASSERT_TRUE(startsWith("Exiv2 rocks", "Exiv2")); ASSERT_TRUE(startsWith("Exiv2 rocks", "Exiv2"));

Loading…
Cancel
Save