OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 28 matching lines...) Expand all Loading... |
39 struct StringHash | 39 struct StringHash |
40 { | 40 { |
41 size_t operator()(const String& key) const | 41 size_t operator()(const String& key) const |
42 { | 42 { |
43 return StringMap_internal::stringHash(key); | 43 return StringMap_internal::stringHash(key); |
44 } | 44 } |
45 }; | 45 }; |
46 | 46 |
47 namespace StringMap_internal | 47 namespace StringMap_internal |
48 { | 48 { |
49 template<typename Key, | 49 template<typename Key> |
50 class = typename std::enable_if<std::is_base_of<String, Key>::value>::type> | |
51 struct StringSetEntry | 50 struct StringSetEntry |
52 { | 51 { |
| 52 static_assert(std::is_base_of<String, Key>::value, "Type of Key should be ba
sed on String"); |
53 typedef Key key_type; | 53 typedef Key key_type; |
54 typedef const String& key_type_cref; | 54 typedef const String& key_type_cref; |
55 typedef size_t size_type; | 55 typedef size_t size_type; |
56 | 56 |
57 key_type first; | 57 key_type first; |
58 | 58 |
59 StringSetEntry(key_type_cref key = key_type()) | 59 StringSetEntry(key_type_cref key = key_type()) |
60 { | 60 { |
61 if (!key.is_invalid()) | 61 if (!key.is_invalid()) |
62 first.reset(key); | 62 first.reset(key); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 }; | 110 }; |
111 } | 111 } |
112 | 112 |
113 using StringSet = Set<StringMap_internal::StringSetEntry<DependentString>>; | 113 using StringSet = Set<StringMap_internal::StringSetEntry<DependentString>>; |
114 | 114 |
115 template<typename Value> | 115 template<typename Value> |
116 using StringMap = Map<StringMap_internal::StringMapEntry<DependentString, Value>
>; | 116 using StringMap = Map<StringMap_internal::StringMapEntry<DependentString, Value>
>; |
117 template<typename Value> | 117 template<typename Value> |
118 using OwnedStringMap = Map<StringMap_internal::StringMapEntry<OwnedString, Value
>>; | 118 using OwnedStringMap = Map<StringMap_internal::StringMapEntry<OwnedString, Value
>>; |
119 ABP_NS_END | 119 ABP_NS_END |
OLD | NEW |