Mercurial > minori
comparison dep/animia/src/util.cc @ 156:cdf79282d647
dep/animia: add VERY early x11 window stuff
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Wed, 15 Nov 2023 18:04:04 -0500 |
parents | bd439dd6ffc5 |
children | 80d6b28eb29f |
comparison
equal
deleted
inserted
replaced
155:d2bbb5773616 | 156:cdf79282d647 |
---|---|
1 #include <algorithm> | 1 #include <algorithm> |
2 #include <fstream> | 2 #include <fstream> |
3 #include <regex> | |
3 #include <sstream> | 4 #include <sstream> |
4 #include <string> | 5 #include <string> |
5 #include <regex> | |
6 | |
7 #include <iostream> | |
8 | 6 |
9 #include "animia/util.h" | 7 #include "animia/util.h" |
10 | 8 |
11 namespace animia::internal::util { | 9 namespace animia::internal::util { |
12 | 10 |
26 return true; | 24 return true; |
27 } | 25 } |
28 | 26 |
29 /* this assumes ASCII... which really should be the case for what we need, anyway */ | 27 /* this assumes ASCII... which really should be the case for what we need, anyway */ |
30 bool EqualStrings(const std::string& str1, const std::string& str2) { | 28 bool EqualStrings(const std::string& str1, const std::string& str2) { |
31 auto tolower = [](const char c) -> char { | 29 auto tolower = [](const char c) -> char { return ('A' <= c && c <= 'Z') ? c + ('a' - 'A') : c; }; |
32 return ('A' <= c && c <= 'Z') ? c + ('a' - 'A') : c; | |
33 }; | |
34 | 30 |
35 auto equal_chars = [&tolower](const char c1, const char c2) -> bool { | 31 auto equal_chars = [&tolower](const char c1, const char c2) -> bool { return tolower(c1) == tolower(c2); }; |
36 return tolower(c1) == tolower(c2); | |
37 }; | |
38 | 32 |
39 return str1.length() == str2.length() && std::equal(str1.begin(), str1.end(), str2.begin(), equal_chars); | 33 return str1.length() == str2.length() && std::equal(str1.begin(), str1.end(), str2.begin(), equal_chars); |
40 } | 34 } |
41 | 35 |
42 bool Stem(const std::string& filename, std::string& stem) { | 36 bool Stem(const std::string& filename, std::string& stem) { |
88 str.resize(found + 1); | 82 str.resize(found + 1); |
89 | 83 |
90 return true; | 84 return true; |
91 } | 85 } |
92 | 86 |
93 } // namespace anisthesia::detail::util | 87 } // namespace animia::internal::util |