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 13 matching lines...) Expand all Loading... | |
24 // Returns the current field in the stream, or |NULL| if there are no more | 24 // Returns the current field in the stream, or |NULL| if there are no more |
25 // fields in the stream. | 25 // fields in the stream. |
26 const AutofillField* Cursor() const; | 26 const AutofillField* Cursor() const; |
27 | 27 |
28 // Returns |true| if the cursor has reached the end of the stream. | 28 // Returns |true| if the cursor has reached the end of the stream. |
29 bool IsEnd() const; | 29 bool IsEnd() const; |
30 | 30 |
31 // Returns the most recently saved cursor -- see also |SaveCursor()|. | 31 // Returns the most recently saved cursor -- see also |SaveCursor()|. |
32 void Rewind(); | 32 void Rewind(); |
33 | 33 |
34 // Returns the specified |index| saved cursor. |index| must be the return | |
35 // value of |SaveCursor()|. | |
36 void RewindTo(size_t position); | |
37 | |
34 // Saves the current cursor position. Multiple cursor positions can be saved, | 38 // Saves the current cursor position. Multiple cursor positions can be saved, |
35 // with stack ordering semantics. See also |Rewind()|. | 39 // with stack ordering semantics. Returns the saved cursor position. |
36 void SaveCursor(); | 40 // See also |Rewind()|. |
41 size_t SaveCursor(); | |
37 | 42 |
38 private: | 43 private: |
39 // Indicates the current position in the stream, represented as a vector. | 44 // Indicates the current position in the stream, represented as a vector. |
40 std::vector<AutofillField*>::const_iterator cursor_; | 45 std::vector<AutofillField*>::const_iterator cursor_; |
41 | 46 |
42 // A stack of saved positions in the stream. | 47 // A stack of saved positions in the stream. |
43 std::vector<std::vector<AutofillField*>::const_iterator> saved_cursors_; | 48 std::vector<std::vector<AutofillField*>::const_iterator> saved_cursors_; |
Ilya Sherman
2011/05/13 00:54:53
Since we need to expose RewindTo() functionality a
| |
44 | 49 |
45 // The past-the-end pointer for the stream. | 50 // The past-the-end pointer for the stream. |
46 const std::vector<AutofillField*>::const_iterator end_; | 51 const std::vector<AutofillField*>::const_iterator end_; |
47 | 52 |
48 DISALLOW_COPY_AND_ASSIGN(AutofillScanner); | 53 DISALLOW_COPY_AND_ASSIGN(AutofillScanner); |
49 }; | 54 }; |
50 | 55 |
51 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_SCANNER_H_ | 56 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_SCANNER_H_ |
OLD | NEW |