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

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

Issue 21114002: Add initial prototype for the GN meta-buildsystem. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add owners and readme Created 7 years, 4 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
« no previous file with comments | « tools/gn/input_conversion_unittest.cc ('k') | tools/gn/input_file.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 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_INPUT_FILE_H_
6 #define TOOLS_GN_INPUT_FILE_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/files/file_path.h"
12 #include "base/logging.h"
13 #include "tools/gn/source_dir.h"
14 #include "tools/gn/source_file.h"
15
16 class InputFile {
17 public:
18 InputFile(const SourceFile& name);
19
20 // Constructor for testing. Uses an empty file path and a given contents.
21 //InputFile(const char* contents);
22 ~InputFile();
23
24 const SourceFile& name() const { return name_; }
25
26 // The directory is just a cached version of name_->GetDir() but we get this
27 // a lot so computing it once up front saves a bunch of work.
28 const SourceDir& dir() const { return dir_; }
29
30 const std::string& contents() const {
31 DCHECK(contents_loaded_);
32 return contents_;
33 }
34
35 // For testing and in cases where this input doesn't actually refer to
36 // "a file".
37 void SetContents(const std::string& c);
38
39 // Loads the given file synchronously, returning true on success. This
40 bool Load(const base::FilePath& system_path);
41
42 private:
43 SourceFile name_;
44 SourceDir dir_;
45
46 bool contents_loaded_;
47 std::string contents_;
48
49 DISALLOW_COPY_AND_ASSIGN(InputFile);
50 };
51
52 #endif // TOOLS_GN_INPUT_FILE_H_
OLDNEW
« no previous file with comments | « tools/gn/input_conversion_unittest.cc ('k') | tools/gn/input_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698