Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Side by Side Diff: chrome/browser/autofill/autofill_scanner.h

Issue 12434004: Move remaining Autofill code to //components/autofill. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix long lines Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_SCANNER_H_
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_SCANNER_H_
7
8 #include <vector>
9
10 #include "base/basictypes.h"
11 #include "base/string16.h"
12
13 class AutofillField;
14
15 // A helper class for parsing a stream of |AutofillField|'s with lookahead.
16 class AutofillScanner {
17 public:
18 explicit AutofillScanner(const std::vector<const AutofillField*>& fields);
19 ~AutofillScanner();
20
21 // Advances the cursor by one step, if possible.
22 void Advance();
23
24 // Returns the current field in the stream, or |NULL| if there are no more
25 // fields in the stream.
26 const AutofillField* Cursor() const;
27
28 // Returns |true| if the cursor has reached the end of the stream.
29 bool IsEnd() const;
30
31 // Restores the most recently saved cursor. See also |SaveCursor()|.
32 void Rewind();
33
34 // Repositions the cursor to the specified |index|. See also |SaveCursor()|.
35 void RewindTo(size_t index);
36
37 // Saves and returns the current cursor position. See also |Rewind()| and
38 // |RewindTo()|.
39 size_t SaveCursor();
40
41 private:
42 // Indicates the current position in the stream, represented as a vector.
43 std::vector<const AutofillField*>::const_iterator cursor_;
44
45 // The most recently saved cursor.
46 std::vector<const AutofillField*>::const_iterator saved_cursor_;
47
48 // The beginning pointer for the stream.
49 const std::vector<const AutofillField*>::const_iterator begin_;
50
51 // The past-the-end pointer for the stream.
52 const std::vector<const AutofillField*>::const_iterator end_;
53
54 DISALLOW_COPY_AND_ASSIGN(AutofillScanner);
55 };
56
57 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_SCANNER_H_
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_regexes_unittest.cc ('k') | chrome/browser/autofill/autofill_scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698