| 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 #include "chromeos/system/name_value_pairs_parser.h" | 5 #include "chromeos/system/name_value_pairs_parser.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 } | 41 } |
| 42 | 42 |
| 43 } // namespace | 43 } // namespace |
| 44 | 44 |
| 45 NameValuePairsParser::NameValuePairsParser(NameValueMap* map) | 45 NameValuePairsParser::NameValuePairsParser(NameValueMap* map) |
| 46 : map_(map) { | 46 : map_(map) { |
| 47 } | 47 } |
| 48 | 48 |
| 49 void NameValuePairsParser::AddNameValuePair(const std::string& key, | 49 void NameValuePairsParser::AddNameValuePair(const std::string& key, |
| 50 const std::string& value) { | 50 const std::string& value) { |
| 51 if (!ContainsKey(*map_, key)) { | 51 if (!base::ContainsKey(*map_, key)) { |
| 52 (*map_)[key] = value; | 52 (*map_)[key] = value; |
| 53 VLOG(1) << "name: " << key << ", value: " << value; | 53 VLOG(1) << "name: " << key << ", value: " << value; |
| 54 } else { | 54 } else { |
| 55 LOG(WARNING) << "Key " << key << " already has value " << (*map_)[key] | 55 LOG(WARNING) << "Key " << key << " already has value " << (*map_)[key] |
| 56 << ", ignoring new value: " << value; | 56 << ", ignoring new value: " << value; |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 bool NameValuePairsParser::ParseNameValuePairs(const std::string& in_string, | 60 bool NameValuePairsParser::ParseNameValuePairs(const std::string& in_string, |
| 61 const std::string& eq, | 61 const std::string& eq, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 std::string output_string; | 142 std::string output_string; |
| 143 if (!GetToolOutput(argc, argv, &output_string)) | 143 if (!GetToolOutput(argc, argv, &output_string)) |
| 144 return false; | 144 return false; |
| 145 | 145 |
| 146 return ParseNameValuePairsWithComments( | 146 return ParseNameValuePairsWithComments( |
| 147 output_string, eq, delim, comment_delim); | 147 output_string, eq, delim, comment_delim); |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace system | 150 } // namespace system |
| 151 } // namespace chromeos | 151 } // namespace chromeos |
| OLD | NEW |