OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * | 10 * |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 return adoptPtr(new ScriptRegexp(regexSource, caseSensitive ? TextCaseSensit
ive : TextCaseInsensitive)); | 94 return adoptPtr(new ScriptRegexp(regexSource, caseSensitive ? TextCaseSensit
ive : TextCaseInsensitive)); |
95 } | 95 } |
96 | 96 |
97 PassRefPtr<TypeBuilder::Array<TypeBuilder::Page::SearchMatch> > searchInTextByLi
nes(const String& text, const String& query, const bool caseSensitive, const boo
l isRegex) | 97 PassRefPtr<TypeBuilder::Array<TypeBuilder::Page::SearchMatch> > searchInTextByLi
nes(const String& text, const String& query, const bool caseSensitive, const boo
l isRegex) |
98 { | 98 { |
99 RefPtr<TypeBuilder::Array<TypeBuilder::Page::SearchMatch> > result = TypeBui
lder::Array<TypeBuilder::Page::SearchMatch>::create(); | 99 RefPtr<TypeBuilder::Array<TypeBuilder::Page::SearchMatch> > result = TypeBui
lder::Array<TypeBuilder::Page::SearchMatch>::create(); |
100 | 100 |
101 OwnPtr<ScriptRegexp> regex = ContentSearchUtils::createSearchRegex(query, ca
seSensitive, isRegex); | 101 OwnPtr<ScriptRegexp> regex = ContentSearchUtils::createSearchRegex(query, ca
seSensitive, isRegex); |
102 Vector<pair<int, String> > matches = getScriptRegexpMatchesByLines(regex.get
(), text); | 102 Vector<pair<int, String> > matches = getScriptRegexpMatchesByLines(regex.get
(), text); |
103 | 103 |
104 for (Vector<pair<int, String> >::const_iterator it = matches.begin(); it !=
matches.end(); ++it) | 104 for (const auto& match : matches) |
105 result->addItem(buildObjectForSearchMatch(it->first, it->second)); | 105 result->addItem(buildObjectForSearchMatch(match.first, match.second)); |
106 | 106 |
107 return result; | 107 return result; |
108 } | 108 } |
109 | 109 |
110 static String findMagicComment(const String& content, const String& name, MagicC
ommentType commentType, bool* deprecated = 0) | 110 static String findMagicComment(const String& content, const String& name, MagicC
ommentType commentType, bool* deprecated = 0) |
111 { | 111 { |
112 ASSERT(name.find("=") == kNotFound); | 112 ASSERT(name.find("=") == kNotFound); |
113 if (deprecated) | 113 if (deprecated) |
114 *deprecated = false; | 114 *deprecated = false; |
115 | 115 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 } | 179 } |
180 | 180 |
181 String findSourceMapURL(const String& content, MagicCommentType commentType, boo
l* deprecated) | 181 String findSourceMapURL(const String& content, MagicCommentType commentType, boo
l* deprecated) |
182 { | 182 { |
183 return findMagicComment(content, "sourceMappingURL", commentType, deprecated
); | 183 return findMagicComment(content, "sourceMappingURL", commentType, deprecated
); |
184 } | 184 } |
185 | 185 |
186 } // namespace ContentSearchUtils | 186 } // namespace ContentSearchUtils |
187 } // namespace blink | 187 } // namespace blink |
188 | 188 |
OLD | NEW |