| 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 #ifndef TOOLS_GN_DEPS_ITERATOR_H_ | 5 #ifndef TOOLS_GN_DEPS_ITERATOR_H_ |
| 6 #define TOOLS_GN_DEPS_ITERATOR_H_ | 6 #define TOOLS_GN_DEPS_ITERATOR_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "tools/gn/label_ptr.h" | 10 #include "tools/gn/label_ptr.h" |
| 11 | 11 |
| 12 class Target; | |
| 13 | |
| 14 // Provides an iterator for iterating over multiple LabelTargetVectors to | 12 // Provides an iterator for iterating over multiple LabelTargetVectors to |
| 15 // make it convenient to iterate over all deps of a target. | 13 // make it convenient to iterate over all deps of a target. |
| 16 // | 14 // |
| 17 // This works by maintaining a simple stack of vectors (since we have a fixed | 15 // This works by maintaining a simple stack of vectors (since we have a fixed |
| 18 // number of deps types). When the stack is empty, we've reached the end. This | 16 // number of deps types). When the stack is empty, we've reached the end. This |
| 19 // means that the default-constructed iterator == end() for any sequence. | 17 // means that the default-constructed iterator == end() for any sequence. |
| 20 class DepsIterator { | 18 class DepsIterator { |
| 21 public: | 19 public: |
| 22 // Creates an empty iterator. | 20 // Creates an empty iterator. |
| 23 DepsIterator(); | 21 DepsIterator(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 63 |
| 66 const DepsIterator& begin() const { return begin_; } | 64 const DepsIterator& begin() const { return begin_; } |
| 67 const DepsIterator& end() const { return end_; } | 65 const DepsIterator& end() const { return end_; } |
| 68 | 66 |
| 69 private: | 67 private: |
| 70 DepsIterator begin_; | 68 DepsIterator begin_; |
| 71 DepsIterator end_; | 69 DepsIterator end_; |
| 72 }; | 70 }; |
| 73 | 71 |
| 74 #endif // TOOLS_GN_DEPS_ITERATOR_H_ | 72 #endif // TOOLS_GN_DEPS_ITERATOR_H_ |
| OLD | NEW |