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

Side by Side Diff: ash/display/display_pref_util.h

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « ash/display/display_manager_unittest.cc ('k') | ash/display/display_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ASH_DISPLAY_DISPLAY_PREF_UTIL_H 5 #ifndef ASH_DISPLAY_DISPLAY_PREF_UTIL_H
6 #define ASH_DISPLAY_DISPLAY_PREF_UTIL_H 6 #define ASH_DISPLAY_DISPLAY_PREF_UTIL_H
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/strings/string_piece.h" 11 #include "base/strings/string_piece.h"
12 12
13 namespace ash { 13 namespace ash {
14 14
15 // Utility templates to create enum to string map and 15 // Utility templates to create enum to string map and
16 // a function to find an enum value from a string. 16 // a function to find an enum value from a string.
17 template<typename T> 17 template <typename T>
18 std::map<T, std::string>* CreateToStringMap(T k1, const std::string& v1, 18 std::map<T, std::string>* CreateToStringMap(T k1,
19 T k2, const std::string& v2, 19 const std::string& v1,
20 T k3, const std::string& v3, 20 T k2,
21 T k4, const std::string& v4) { 21 const std::string& v2,
22 T k3,
23 const std::string& v3,
24 T k4,
25 const std::string& v4) {
22 std::map<T, std::string>* map = new std::map<T, std::string>(); 26 std::map<T, std::string>* map = new std::map<T, std::string>();
23 (*map)[k1] = v1; 27 (*map)[k1] = v1;
24 (*map)[k2] = v2; 28 (*map)[k2] = v2;
25 (*map)[k3] = v3; 29 (*map)[k3] = v3;
26 (*map)[k4] = v4; 30 (*map)[k4] = v4;
27 return map; 31 return map;
28 } 32 }
29 33
30 template<typename T> 34 template <typename T>
31 std::map<T, std::string>* CreateToStringMap(T k1, const std::string& v1, 35 std::map<T, std::string>* CreateToStringMap(T k1,
32 T k2, const std::string& v2, 36 const std::string& v1,
33 T k3, const std::string& v3) { 37 T k2,
38 const std::string& v2,
39 T k3,
40 const std::string& v3) {
34 std::map<T, std::string>* map = new std::map<T, std::string>(); 41 std::map<T, std::string>* map = new std::map<T, std::string>();
35 (*map)[k1] = v1; 42 (*map)[k1] = v1;
36 (*map)[k2] = v2; 43 (*map)[k2] = v2;
37 (*map)[k3] = v3; 44 (*map)[k3] = v3;
38 return map; 45 return map;
39 } 46 }
40 47
41 template<typename T> 48 template <typename T>
42 bool ReverseFind(const std::map<T, std::string>* map, 49 bool ReverseFind(const std::map<T, std::string>* map,
43 const base::StringPiece& value, 50 const base::StringPiece& value,
44 T* key) { 51 T* key) {
45 typename std::map<T, std::string>::const_iterator iter = map->begin(); 52 typename std::map<T, std::string>::const_iterator iter = map->begin();
46 for (; 53 for (; iter != map->end(); ++iter) {
47 iter != map->end();
48 ++iter) {
49 if (iter->second == value) { 54 if (iter->second == value) {
50 *key = iter->first; 55 *key = iter->first;
51 return true; 56 return true;
52 } 57 }
53 } 58 }
54 return false; 59 return false;
55 } 60 }
56 61
57 } // namespace ash 62 } // namespace ash
58 63
59 #endif // ASH_DISPLAY_DISPLAY_PREF_UTIL_H 64 #endif // ASH_DISPLAY_DISPLAY_PREF_UTIL_H
OLDNEW
« no previous file with comments | « ash/display/display_manager_unittest.cc ('k') | ash/display/display_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698