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

Side by Side Diff: tools/gn/c_include_iterator.h

Issue 216903004: Add optional public header checking to GN build (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 2014 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 TOOLS_GN_C_INCLUDE_ITERATOR_H_
6 #define TOOLS_GN_C_INCLUDE_ITERATOR_H_
7
8 #include "base/basictypes.h"
9 #include "base/strings/string_piece.h"
10
11 // Iterates through #includes in C source and header files.
12 //
13 // This only returns includes we want to check, which is user includes with
14 // double-quotes: #include "..."
15 class CIncludeIterator {
16 public:
17 // The buffer pointed to must outlive this class.
18 CIncludeIterator(const base::StringPiece& file);
19 ~CIncludeIterator();
20
21 // Fills in the string with the contents of the next include and returns
22 // true, or returns false if there are no more includes.
23 bool GetNextIncludeString(base::StringPiece* out);
24
25 private:
26 // Returns false on EOF, otherwise fills in the given line.
27 bool GetNextLine(base::StringPiece* line);
28
29 base::StringPiece file_;
30
31 size_t offset_;
32
33 // Number of lines we've processed since seeing the last include (or the
34 // beginning of the file) with some exceptions.
35 int lines_since_last_include_;
36
37 DISALLOW_COPY_AND_ASSIGN(CIncludeIterator);
38 };
39
40 #endif // TOOLS_GN_INCLUDE_ITERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698