| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Helper functions that allow to map enum values to strings. | 5 // Helper functions that allow to map enum values to strings. |
| 6 | 6 |
| 7 #include <stddef.h> |
| 8 |
| 9 #include "base/logging.h" |
| 10 |
| 7 namespace remoting { | 11 namespace remoting { |
| 8 namespace protocol { | 12 namespace protocol { |
| 9 | 13 |
| 10 template <typename T> | 14 template <typename T> |
| 11 struct NameMapElement { | 15 struct NameMapElement { |
| 12 const T value; | 16 const T value; |
| 13 const char* const name; | 17 const char* const name; |
| 14 }; | 18 }; |
| 15 | 19 |
| 16 template <typename T, size_t N> | 20 template <typename T, size_t N> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 31 if (map[i].name == name) { | 35 if (map[i].name == name) { |
| 32 *result = map[i].value; | 36 *result = map[i].value; |
| 33 return true; | 37 return true; |
| 34 } | 38 } |
| 35 } | 39 } |
| 36 return false; | 40 return false; |
| 37 } | 41 } |
| 38 | 42 |
| 39 } // namespace protocol | 43 } // namespace protocol |
| 40 } // namespace remoting | 44 } // namespace remoting |
| OLD | NEW |