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
3 // found in the LICENSE file.
5 #ifndef ASH_DISPLAY_DISPLAY_PREF_UTIL_H
6 #define ASH_DISPLAY_DISPLAY_PREF_UTIL_H
11 #include "base/strings/string_piece.h"
15 // Utility templates to create enum to string map and
16 // a function to find an enum value from a string.
18 std::map
<T
, std::string
>* CreateToStringMap(T k1
, const std::string
& v1
,
19 T k2
, const std::string
& v2
,
20 T k3
, const std::string
& v3
,
21 T k4
, const std::string
& v4
) {
22 std::map
<T
, std::string
>* map
= new std::map
<T
, std::string
>();
31 bool ReverseFind(const std::map
<T
, std::string
>* map
,
32 const base::StringPiece
& value
,
34 typename
std::map
<T
, std::string
>::const_iterator iter
= map
->begin();
38 if (iter
->second
== value
) {
48 #endif // ASH_DISPLAY_DISPLAY_PREF_UTIL_H