Exiv2
utils.hpp
1 #ifndef EXIV2_UTILS_HPP
2 #define EXIV2_UTILS_HPP
3 
4 #include <string>
5 #include <string_view>
6 
7 namespace Exiv2::Internal {
8 
9 template <typename T>
10 constexpr bool startsWith(std::string_view s, T start) {
11 #ifdef __cpp_lib_starts_ends_with
12  return s.starts_with(start);
13 #else
14  return s.find(start) == 0;
15 #endif
16 }
17 
18 template <typename T>
19 constexpr bool contains(std::string_view s, T c) {
20 #ifdef __cpp_lib_string_contains
21  return s.contains(c);
22 #else
23  return s.find(c) != std::string_view::npos;
24 #endif
25 }
26 
28 std::string upper(const std::string& str);
29 
31 std::string lower(const std::string& a);
32 
33 } // namespace Exiv2::Internal
34 
35 #endif // EXIV2_UTILS_HPP
Helper structure for the Matroska tags lookup table.
Definition: matroskavideo.hpp:39
std::string lower(const std::string &a)
Returns the lowercase version of str.
Definition: utils.cpp:14
std::string upper(const std::string &str)
Returns the uppercase version of str.
Definition: utils.cpp:8