acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
_loosely.h
1// From ::papaya::weak to ::loosely by camilo on 2022-11-18 07:47 <3ThomasBorregaardSorensen!!
2#pragma once
3
4
5template < typename A, typename B>
6bool weakly_contains(const A & a, const B &b)
7{
8
9 return a.contains(b);
10
11}
12
13
14namespace loosely
15{
16
17
18 template < typename TYPE >
19 inline TYPE default_payload()
20 {
21
22 return TYPE();
23
24 }
25
26
27 template < typename A, typename B >
28 inline bool contains(const A& a, const B& b)
29 {
30
31 return weakly_contains(a, b);
32
33 }
34
35
36 template < typename CHAR1, typename CHAR2 >
37 inline bool contains(const string_base < CHAR1 >& a, const string_base < CHAR2 >& b)
38 {
39
40 return a.case_insensitive_contains(b);
41
42 }
43
44 template < >
45 inline bool contains(const string& a, const ::block& b)
46 {
47
48 return case_insensitive_ansi_count_compare(a, (const_char_pointer )b.data(), b.size());
49
50 }
51
52 template < >
53 inline bool contains(const ::scoped_string & scopedstrAddress, const ::scoped_string & scopedstr)
54 {
55
56 return case_insensitive_ansi_count_compare(scopedstrAddress, (const_char_pointer )scopedstr.data(), scopedstr.size());
57
58 }
59
60
61 template < >
62 inline bool contains(const ::block& a, const ::string& b)
63 {
64
65 return case_insensitive_ansi_count_compare((const_char_pointer )a.data(), b, a.size());
66
67 }
68
69
70 template < >
71 inline string default_payload < string >()
72 {
73
74 return string();
75
76 }
77
78
79} // namespace loosely
80
81
82