| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/query_parser/query_parser.h" | 5 #include "components/query_parser/query_parser.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/i18n/break_iterator.h" | 10 #include "base/i18n/break_iterator.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 QueryNodeStarVector children_; | 178 QueryNodeStarVector children_; |
| 179 | 179 |
| 180 private: | 180 private: |
| 181 DISALLOW_COPY_AND_ASSIGN(QueryNodeList); | 181 DISALLOW_COPY_AND_ASSIGN(QueryNodeList); |
| 182 }; | 182 }; |
| 183 | 183 |
| 184 QueryNodeList::QueryNodeList() {} | 184 QueryNodeList::QueryNodeList() {} |
| 185 | 185 |
| 186 QueryNodeList::~QueryNodeList() { | 186 QueryNodeList::~QueryNodeList() { |
| 187 STLDeleteElements(&children_); | 187 base::STLDeleteElements(&children_); |
| 188 } | 188 } |
| 189 | 189 |
| 190 void QueryNodeList::AddChild(QueryNode* node) { | 190 void QueryNodeList::AddChild(QueryNode* node) { |
| 191 children_.push_back(node); | 191 children_.push_back(node); |
| 192 } | 192 } |
| 193 | 193 |
| 194 void QueryNodeList::RemoveEmptySubnodes() { | 194 void QueryNodeList::RemoveEmptySubnodes() { |
| 195 for (size_t i = 0; i < children_.size(); ++i) { | 195 for (size_t i = 0; i < children_.size(); ++i) { |
| 196 if (children_[i]->IsWord()) | 196 if (children_[i]->IsWord()) |
| 197 continue; | 197 continue; |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 void QueryParser::SortAndCoalesceMatchPositions( | 476 void QueryParser::SortAndCoalesceMatchPositions( |
| 477 Snippet::MatchPositions* matches) { | 477 Snippet::MatchPositions* matches) { |
| 478 std::sort(matches->begin(), matches->end(), &CompareMatchPosition); | 478 std::sort(matches->begin(), matches->end(), &CompareMatchPosition); |
| 479 // WARNING: we don't use iterator here as CoalesceMatchesFrom may remove | 479 // WARNING: we don't use iterator here as CoalesceMatchesFrom may remove |
| 480 // from matches. | 480 // from matches. |
| 481 for (size_t i = 0; i < matches->size(); ++i) | 481 for (size_t i = 0; i < matches->size(); ++i) |
| 482 CoalesceMatchesFrom(i, matches); | 482 CoalesceMatchesFrom(i, matches); |
| 483 } | 483 } |
| 484 | 484 |
| 485 } // namespace query_parser | 485 } // namespace query_parser |
| OLD | NEW |