Tag Parser  7.0.1
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
caseinsensitivecomparer.h
Go to the documentation of this file.
1 #ifndef TAG_PARSER_CASEINSENSITIVECOMPARER
2 #define TAG_PARSER_CASEINSENSITIVECOMPARER
3 
4 #include "./global.h"
5 
6 #include <string>
7 
8 #include <iostream>
9 
10 namespace TagParser {
11 
16  static constexpr unsigned char toLower(const unsigned char c)
17  {
18  return (c >= 'A' && c <= 'Z') ? (c + ('a' - 'A')) : c;
19  }
20 
21  bool operator()(const unsigned char lhs, const unsigned char rhs) const
22  {
23  return toLower(lhs) < toLower(rhs);
24  }
25 };
26 
31  bool operator()(const std::string &lhs, const std::string &rhs) const
32  {
33  return std::lexicographical_compare(lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend(), CaseInsensitiveCharComparer());
34  }
35 };
36 
37 } // namespace TagParser
38 
39 #endif // TAG_PARSER_CASEINSENSITIVECOMPARER
bool operator()(const unsigned char lhs, const unsigned char rhs) const
The CaseInsensitiveStringComparer struct defines a method for case-insensivive string comparsion (les...
The CaseInsensitiveCharComparer struct defines a method for case-insensivive character comparsion (le...
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
bool operator()(const std::string &lhs, const std::string &rhs) const
static constexpr unsigned char toLower(const unsigned char c)