LEFT | RIGHT |
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 return first == KEY_INVALID; | 56 return first == KEY_INVALID; |
57 } | 57 } |
58 | 58 |
59 bool is_deleted() const | 59 bool is_deleted() const |
60 { | 60 { |
61 return first == KEY_DELETED; | 61 return first == KEY_DELETED; |
62 } | 62 } |
63 | 63 |
64 void erase() | 64 void erase() |
65 { | 65 { |
66 first = KEY_INVALID; | 66 first = KEY_DELETED; |
67 } | 67 } |
68 | 68 |
69 static size_type hash(key_type_cref key) | 69 static size_type hash(key_type_cref key) |
70 { | 70 { |
71 return key; | 71 return key; |
72 } | 72 } |
73 }; | 73 }; |
74 | 74 |
75 template<typename Value> | 75 template<typename Value> |
76 struct Uint32MapEntry : Uint32SetEntry | 76 struct Uint32MapEntry : Uint32SetEntry |
77 { | 77 { |
78 typedef Uint32SetEntry super; | 78 typedef Uint32SetEntry super; |
79 typedef Value value_type; | 79 typedef Value value_type; |
80 | 80 |
81 value_type second; | 81 value_type second; |
82 | 82 |
83 Uint32MapEntry(key_type_cref key = KEY_INVALID, value_type value = value_typ
e()) | 83 Uint32MapEntry(key_type_cref key = KEY_INVALID, value_type value = value_typ
e()) |
84 : Uint32SetEntry(key), second(value) | 84 : Uint32SetEntry(key), second(std::move(value)) |
85 { | 85 { |
86 } | 86 } |
87 | 87 |
88 void erase() | 88 void erase() |
89 { | 89 { |
90 super::erase(); | 90 super::erase(); |
91 second = value_type(); | 91 second = value_type(); |
92 } | 92 } |
93 }; | 93 }; |
94 } | 94 } |
95 | 95 |
96 using Uint32Set = Set<Uint32Map_internal::Uint32SetEntry>; | 96 using Uint32Set = Set<Uint32Map_internal::Uint32SetEntry>; |
97 | 97 |
98 template<typename Value> | 98 template<typename Value> |
99 using Uint32Map = Map<Uint32Map_internal::Uint32MapEntry<Value>>; | 99 using Uint32Map = Map<Uint32Map_internal::Uint32MapEntry<Value>>; |
100 | 100 |
101 ABP_NS_END | 101 ABP_NS_END |
LEFT | RIGHT |