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

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

Issue 17392006: In components/autofill, move browser/ to core/browser/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to fix conflicts Created 7 years, 6 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 COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_SCANNER_H_
6 #define COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_SCANNER_H_
7
8 #include <vector>
9
10 #include "base/basictypes.h"
11 #include "base/strings/string16.h"
12
13 namespace autofill {
14
15 class AutofillField;
16
17 // A helper class for parsing a stream of |AutofillField|'s with lookahead.
18 class AutofillScanner {
19 public:
20 explicit AutofillScanner(const std::vector<const AutofillField*>& fields);
21 ~AutofillScanner();
22
23 // Advances the cursor by one step, if possible.
24 void Advance();
25
26 // Returns the current field in the stream, or |NULL| if there are no more
27 // fields in the stream.
28 const AutofillField* Cursor() const;
29
30 // Returns |true| if the cursor has reached the end of the stream.
31 bool IsEnd() const;
32
33 // Restores the most recently saved cursor. See also |SaveCursor()|.
34 void Rewind();
35
36 // Repositions the cursor to the specified |index|. See also |SaveCursor()|.
37 void RewindTo(size_t index);
38
39 // Saves and returns the current cursor position. See also |Rewind()| and
40 // |RewindTo()|.
41 size_t SaveCursor();
42
43 private:
44 // Indicates the current position in the stream, represented as a vector.
45 std::vector<const AutofillField*>::const_iterator cursor_;
46
47 // The most recently saved cursor.
48 std::vector<const AutofillField*>::const_iterator saved_cursor_;
49
50 // The beginning pointer for the stream.
51 const std::vector<const AutofillField*>::const_iterator begin_;
52
53 // The past-the-end pointer for the stream.
54 const std::vector<const AutofillField*>::const_iterator end_;
55
56 DISALLOW_COPY_AND_ASSIGN(AutofillScanner);
57 };
58
59 } // namespace autofill
60
61 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_SCANNER_H_
OLDNEW
« no previous file with comments | « components/autofill/browser/autofill_regexes_unittest.cc ('k') | components/autofill/browser/autofill_scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698