| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_AUTOFILL_AUTOFILL_SCANNER_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_SCANNER_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_SCANNER_H_ | 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_SCANNER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // Advances the cursor by one step, if possible. | 22 // Advances the cursor by one step, if possible. |
| 23 void Advance(); | 23 void Advance(); |
| 24 | 24 |
| 25 // Returns the current field in the stream, or |NULL| if there are no more | 25 // Returns the current field in the stream, or |NULL| if there are no more |
| 26 // fields in the stream. | 26 // fields in the stream. |
| 27 const AutofillField* Cursor() const; | 27 const AutofillField* Cursor() const; |
| 28 | 28 |
| 29 // Returns |true| if the cursor has reached the end of the stream. | 29 // Returns |true| if the cursor has reached the end of the stream. |
| 30 bool IsEnd() const; | 30 bool IsEnd() const; |
| 31 | 31 |
| 32 // Returns the most recently saved cursor -- see also |SaveCursor()|. | 32 // Restores the most recently saved cursor. See also |SaveCursor()|. |
| 33 void Rewind(); | 33 void Rewind(); |
| 34 | 34 |
| 35 // Saves the current cursor position. Multiple cursor positions can be saved, | 35 // Repositions the cursor to the specified |index|. See also |SaveCursor()|. |
| 36 // with stack ordering semantics. See also |Rewind()|. | 36 void RewindTo(size_t index); |
| 37 void SaveCursor(); | 37 |
| 38 // Saves and returns the current cursor position. See also |Rewind()| and |
| 39 // |RewindTo()|. |
| 40 size_t SaveCursor(); |
| 38 | 41 |
| 39 private: | 42 private: |
| 40 // Indicates the current position in the stream, represented as a vector. | 43 // Indicates the current position in the stream, represented as a vector. |
| 41 std::vector<const AutofillField*>::const_iterator cursor_; | 44 std::vector<const AutofillField*>::const_iterator cursor_; |
| 42 | 45 |
| 43 // A stack of saved positions in the stream. | 46 // The most recently saved cursor. |
| 44 std::vector<std::vector<const AutofillField*>::const_iterator> saved_cursors_; | 47 std::vector<const AutofillField*>::const_iterator saved_cursor_; |
| 48 |
| 49 // The beginning pointer for the stream. |
| 50 const std::vector<const AutofillField*>::const_iterator begin_; |
| 45 | 51 |
| 46 // The past-the-end pointer for the stream. | 52 // The past-the-end pointer for the stream. |
| 47 const std::vector<const AutofillField*>::const_iterator end_; | 53 const std::vector<const AutofillField*>::const_iterator end_; |
| 48 | 54 |
| 49 DISALLOW_COPY_AND_ASSIGN(AutofillScanner); | 55 DISALLOW_COPY_AND_ASSIGN(AutofillScanner); |
| 50 }; | 56 }; |
| 51 | 57 |
| 52 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_SCANNER_H_ | 58 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_SCANNER_H_ |
| OLD | NEW |