Tag Parser  6.4.0
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 CASEINSENSITIVECOMPARER
2 #define CASEINSENSITIVECOMPARER
3 
4 #include "./global.h"
5 
6 #include <string>
7 
8 #include <iostream>
9 
10 namespace Media {
11 
16 {
17  static constexpr unsigned char toLower(const unsigned char c)
18  {
19  return (c >= 'A' && c <= 'Z') ? (c + ('a' - 'A')) : c;
20  }
21 
22  bool operator()(const unsigned char lhs, const unsigned char rhs) const
23  {
24  return toLower(lhs) < toLower(rhs);
25  }
26 };
27 
32 {
33  bool operator()(const std::string &lhs, const std::string &rhs) const
34  {
35  return std::lexicographical_compare(lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend(), CaseInsensitiveCharComparer());
36  }
37 };
38 
39 }
40 
41 #endif // CASEINSENSITIVECOMPARER
42 
bool operator()(const std::string &lhs, const std::string &rhs) const
The CaseInsensitiveStringComparer struct defines a method for case-insensivive string comparsion (les...
bool operator()(const unsigned char lhs, const unsigned char rhs) const
static constexpr unsigned char toLower(const unsigned char c)
The CaseInsensitiveCharComparer struct defines a method for case-insensivive character comparsion (le...
Contains all classes and functions of the TagInfo library.
Definition: exceptions.h:9
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.