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

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

Issue 2064533002: [GN] Add JSON project writer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [GN] fix include order Created 4 years, 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 TOOLS_GN_VISIBILITY_H_ 5 #ifndef TOOLS_GN_VISIBILITY_H_
6 #define TOOLS_GN_VISIBILITY_H_ 6 #define TOOLS_GN_VISIBILITY_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "tools/gn/label_pattern.h" 11 #include "tools/gn/label_pattern.h"
12 #include "tools/gn/source_dir.h" 12 #include "tools/gn/source_dir.h"
13 13
14 namespace base {
15 class Value;
16 }
17
14 class Err; 18 class Err;
15 class Item; 19 class Item;
16 class Label; 20 class Label;
17 class Scope; 21 class Scope;
18 class Value; 22 class Value;
19 23
20 class Visibility { 24 class Visibility {
21 public: 25 public:
22 // Defaults to private visibility (only the current file). 26 // Defaults to private visibility (only the current file).
23 Visibility(); 27 Visibility();
(...skipping 12 matching lines...) Expand all
36 // Returns true if the target with the given label can depend on one with the 40 // Returns true if the target with the given label can depend on one with the
37 // current visibility. 41 // current visibility.
38 bool CanSeeMe(const Label& label) const; 42 bool CanSeeMe(const Label& label) const;
39 43
40 // Returns a string listing the visibility. |indent| number of spaces will 44 // Returns a string listing the visibility. |indent| number of spaces will
41 // be added on the left side of the output. If |include_brackets| is set, the 45 // be added on the left side of the output. If |include_brackets| is set, the
42 // result will be wrapped in "[ ]" and the contents further indented. The 46 // result will be wrapped in "[ ]" and the contents further indented. The
43 // result will end in a newline. 47 // result will end in a newline.
44 std::string Describe(int indent, bool include_brackets) const; 48 std::string Describe(int indent, bool include_brackets) const;
45 49
50 // Returns value representation of this visibility
51 std::unique_ptr<base::Value> AsValue() const;
52
46 // Helper function to check visibility between the given two items. If 53 // Helper function to check visibility between the given two items. If
47 // to is invisible to from, returns false and sets the error. 54 // to is invisible to from, returns false and sets the error.
48 static bool CheckItemVisibility(const Item* from, const Item* to, Err* err); 55 static bool CheckItemVisibility(const Item* from, const Item* to, Err* err);
49 56
50 // Helper function to fill an item's visibility from the "visibility" value 57 // Helper function to fill an item's visibility from the "visibility" value
51 // in the current scope. 58 // in the current scope.
52 static bool FillItemVisibility(Item* item, Scope* scope, Err* err); 59 static bool FillItemVisibility(Item* item, Scope* scope, Err* err);
53 60
54 private: 61 private:
55 std::vector<LabelPattern> patterns_; 62 std::vector<LabelPattern> patterns_;
56 63
57 DISALLOW_COPY_AND_ASSIGN(Visibility); 64 DISALLOW_COPY_AND_ASSIGN(Visibility);
58 }; 65 };
59 66
60 #endif // TOOLS_GN_VISIBILITY_H_ 67 #endif // TOOLS_GN_VISIBILITY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698