| 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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 const_iterator begin() const | 226 const_iterator begin() const |
| 227 { | 227 { |
| 228 return const_iterator(&mBuckets[0], &mBuckets[mBucketCount]); | 228 return const_iterator(&mBuckets[0], &mBuckets[mBucketCount]); |
| 229 } | 229 } |
| 230 | 230 |
| 231 const_iterator end() const | 231 const_iterator end() const |
| 232 { | 232 { |
| 233 return const_iterator(&mBuckets[mBucketCount], &mBuckets[mBucketCount]); | 233 return const_iterator(&mBuckets[mBucketCount], &mBuckets[mBucketCount]); |
| 234 } | 234 } |
| 235 | 235 |
| 236 size_type max_size() const | |
| 237 { | |
| 238 return mBucketCount; | |
| 239 } | |
| 240 | |
| 241 size_type size() const | 236 size_type size() const |
| 242 { | 237 { |
| 243 return mEntryCount; | 238 return mEntryCount; |
| 244 } | 239 } |
| 245 }; | 240 }; |
| 246 | 241 |
| 247 struct StringSetEntry | 242 struct StringSetEntry |
| 248 { | 243 { |
| 249 StringSetEntry() {} | 244 StringSetEntry() {} |
| 250 StringSetEntry(const String& key) | 245 StringSetEntry(const String& key) |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 friend class StringMap_internal::StringMapEntryReference<T>; | 322 friend class StringMap_internal::StringMapEntryReference<T>; |
| 328 | 323 |
| 329 explicit StringMap(size_type expectedEntries = 0) | 324 explicit StringMap(size_type expectedEntries = 0) |
| 330 : super(expectedEntries) | 325 : super(expectedEntries) |
| 331 { | 326 { |
| 332 } | 327 } |
| 333 | 328 |
| 334 StringMap(std::initializer_list<entry_type> list) | 329 StringMap(std::initializer_list<entry_type> list) |
| 335 : super(list.size()) | 330 : super(list.size()) |
| 336 { | 331 { |
| 337 for (auto it = list.begin(); it != list.end(); ++it) | 332 for (const auto& item : list) |
| 338 super::insert(*it); | 333 super::insert(item); |
| 339 } | 334 } |
| 340 | 335 |
| 341 ~StringMap() | 336 ~StringMap() |
| 342 { | 337 { |
| 343 } | 338 } |
| 344 | 339 |
| 345 T& operator[](const String& key) | 340 T& operator[](const String& key) |
| 346 { | 341 { |
| 347 entry_type* entry = super::find_bucket(key); | 342 entry_type* entry = super::find_bucket(key); |
| 348 if (entry->first.is_invalid()) | 343 if (entry->first.is_invalid()) |
| 349 entry = super::assign(entry, key); | 344 entry = super::assign(entry, key); |
| 350 return entry->second; | 345 return entry->second; |
| 351 } | 346 } |
| 352 | 347 |
| 353 const_reference find(const String& key) const | 348 const_reference find(const String& key) const |
| 354 { | 349 { |
| 355 return super::find(key); | 350 return super::find(key); |
| 356 } | 351 } |
| 357 | 352 |
| 358 reference find(const String& key) | 353 reference find(const String& key) |
| 359 { | 354 { |
| 360 return reference(this, key, super::find_bucket(key)); | 355 return reference(this, key, super::find_bucket(key)); |
| 361 } | 356 } |
| 362 }; | 357 }; |
| LEFT | RIGHT |