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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // of |pair|. | 84 // of |pair|. |
85 size_t value_size = std::string::npos; | 85 size_t value_size = std::string::npos; |
86 if (!comment_delim.empty()) { | 86 if (!comment_delim.empty()) { |
87 size_t comment_pos = pair.find(comment_delim, eq_pos + 1); | 87 size_t comment_pos = pair.find(comment_delim, eq_pos + 1); |
88 if (comment_pos != std::string::npos) | 88 if (comment_pos != std::string::npos) |
89 value_size = comment_pos - eq_pos - 1; | 89 value_size = comment_pos - eq_pos - 1; |
90 } | 90 } |
91 | 91 |
92 std::string key; | 92 std::string key; |
93 std::string value; | 93 std::string value; |
94 TrimString(pair.substr(0, eq_pos), kTrimChars, &key); | 94 base::TrimString(pair.substr(0, eq_pos), kTrimChars, &key); |
95 TrimString(pair.substr(eq_pos + 1, value_size), kTrimChars, &value); | 95 base::TrimString(pair.substr(eq_pos + 1, value_size), kTrimChars, &value); |
96 | 96 |
97 if (!key.empty()) { | 97 if (!key.empty()) { |
98 AddNameValuePair(key, value); | 98 AddNameValuePair(key, value); |
99 continue; | 99 continue; |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 LOG(WARNING) << "Invalid token pair: " << pair << ". Ignoring."; | 103 LOG(WARNING) << "Invalid token pair: " << pair << ". Ignoring."; |
104 all_valid = false; | 104 all_valid = false; |
105 } | 105 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 std::string output_string; | 140 std::string output_string; |
141 if (!GetToolOutput(argc, argv, output_string)) | 141 if (!GetToolOutput(argc, argv, output_string)) |
142 return false; | 142 return false; |
143 | 143 |
144 return ParseNameValuePairsWithComments( | 144 return ParseNameValuePairsWithComments( |
145 output_string, eq, delim, comment_delim); | 145 output_string, eq, delim, comment_delim); |
146 } | 146 } |
147 | 147 |
148 } // namespace system | 148 } // namespace system |
149 } // namespace chromeos | 149 } // namespace chromeos |
OLD | NEW |