Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1594)

Unified Diff: net/base/linked_hash_map.h

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/base/linked_hash_map.h
diff --git a/net/base/linked_hash_map.h b/net/base/linked_hash_map.h
index 7948647df05913ae86de3eb3eaeacbb11fcf7967..5082597b551ec90099689dd0b6f0c5023d239104 100644
--- a/net/base/linked_hash_map.h
+++ b/net/base/linked_hash_map.h
@@ -27,7 +27,7 @@
//
// We also keep a map<Key, list::iterator> for find. Since std::list is a
// doubly-linked list, the iterators should remain stable.
-template<class Key, class Value>
+template <class Key, class Value>
class linked_hash_map {
private:
typedef std::list<std::pair<Key, Value> > ListType;
@@ -42,42 +42,25 @@ class linked_hash_map {
typedef typename ListType::value_type value_type;
typedef typename ListType::size_type size_type;
- linked_hash_map() : map_(), list_() {
- }
+ linked_hash_map() : map_(), list_() {}
// Returns an iterator to the first (insertion-ordered) element. Like a map,
// this can be dereferenced to a pair<Key, Value>.
- iterator begin() {
- return list_.begin();
- }
- const_iterator begin() const {
- return list_.begin();
- }
+ iterator begin() { return list_.begin(); }
+ const_iterator begin() const { return list_.begin(); }
// Returns an iterator beyond the last element.
- iterator end() {
- return list_.end();
- }
- const_iterator end() const {
- return list_.end();
- }
+ iterator end() { return list_.end(); }
+ const_iterator end() const { return list_.end(); }
// Returns an iterator to the last (insertion-ordered) element. Like a map,
// this can be dereferenced to a pair<Key, Value>.
- reverse_iterator rbegin() {
- return list_.rbegin();
- }
- const_reverse_iterator rbegin() const {
- return list_.rbegin();
- }
+ reverse_iterator rbegin() { return list_.rbegin(); }
+ const_reverse_iterator rbegin() const { return list_.rbegin(); }
// Returns an iterator beyond the first element.
- reverse_iterator rend() {
- return list_.rend();
- }
- const_reverse_iterator rend() const {
- return list_.rend();
- }
+ reverse_iterator rend() { return list_.rend(); }
+ const_reverse_iterator rend() const { return list_.rend(); }
// Clears the map of all values.
void clear() {
@@ -86,15 +69,14 @@ class linked_hash_map {
}
// Returns true iff the map is empty.
- bool empty() const {
- return list_.empty();
- }
+ bool empty() const { return list_.empty(); }
// Erases values with the provided key. Returns the number of elements
// erased. In this implementation, this will be 0 or 1.
size_type erase(const Key& key) {
typename MapType::iterator found = map_.find(key);
- if (found == map_.end()) return 0;
+ if (found == map_.end())
+ return 0;
list_.erase(found->second);
map_.erase(found);
@@ -152,12 +134,12 @@ class linked_hash_map {
std::pair<const_iterator, const_iterator> equal_range(
const key_type& key) const {
std::pair<typename MapType::const_iterator,
- typename MapType::const_iterator> eq_range =
+ typename MapType::const_iterator> eq_range =
map_.equal_range(key);
- const const_iterator& start_iter = eq_range.first != map_.end() ?
- eq_range.first->second : end();
- const const_iterator& end_iter = eq_range.second != map_.end() ?
- eq_range.second->second : end();
+ const const_iterator& start_iter =
+ eq_range.first != map_.end() ? eq_range.first->second : end();
+ const const_iterator& end_iter =
+ eq_range.second != map_.end() ? eq_range.second->second : end();
return std::make_pair(start_iter, end_iter);
}
@@ -174,7 +156,8 @@ class linked_hash_map {
// return a pair with an iterator to it, and false indicating that we
// didn't insert anything.
typename MapType::iterator found = map_.find(pair.first);
- if (found != map_.end()) return std::make_pair(found->second, false);
+ if (found != map_.end())
+ return std::make_pair(found->second, false);
// Otherwise, insert into the list first.
list_.push_back(pair);
@@ -190,9 +173,7 @@ class linked_hash_map {
return std::make_pair(last, true);
}
- size_type size() const {
- return list_.size();
- }
+ size_type size() const { return list_.size(); }
void swap(linked_hash_map& other) {
map_.swap(other.map_);
« no previous file with comments | « net/base/keygen_handler_win.cc ('k') | net/base/load_flags.h » ('j') | net/base/mime_sniffer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698