Tag Parser 12.4.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
10namespace 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 bool operator()(std::string_view lhs, std::string_view rhs) const
36 {
37 return std::lexicographical_compare(lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend(), CaseInsensitiveCharComparer());
38 }
39};
40
41} // namespace TagParser
42
43#endif // TAG_PARSER_CASEINSENSITIVECOMPARER
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Definition global.h:14
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10
The CaseInsensitiveCharComparer struct defines a method for case-insensivive character comparison (le...
static constexpr unsigned char toLower(const unsigned char c)
bool operator()(const unsigned char lhs, const unsigned char rhs) const
The CaseInsensitiveStringComparer struct defines a method for case-insensivive string comparison (les...
bool operator()(const std::string &lhs, const std::string &rhs) const
bool operator()(std::string_view lhs, std::string_view rhs) const