Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 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. | |
| 4 | |
| 5 #include "config.h" | |
| 6 #include "platform/CommaDelimitedParser.h" | |
| 7 | |
| 8 namespace blink { | |
| 9 | |
| 10 static bool isWhitespace(UChar chr) | |
|
Mike West
2015/02/27 08:53:41
Can you use isASCIIWhitespace instead (in string_u
| |
| 11 { | |
| 12 return (chr == ' ') || (chr == '\t'); | |
| 13 } | |
| 14 | |
| 15 CommaDelimitedParser::CommaDelimitedParser(String input) | |
| 16 { | |
| 17 Vector<String> results; | |
| 18 input.split(",", results); | |
| 19 for (auto& value : results) | |
| 20 m_map.add(value.stripWhiteSpace(isWhitespace), true); | |
| 21 } | |
| 22 | |
| 23 bool CommaDelimitedParser::contains(String field) | |
| 24 { | |
| 25 auto i = m_map.find(field); | |
| 26 if (i == m_map.end()) | |
| 27 return false; | |
| 28 return i->value; | |
| 29 } | |
| 30 | |
| 31 } // namespace blink | |
| 32 | |
| OLD | NEW |