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

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

Issue 1728303003: tools/gn: Add out-of-line copy ctors for complex classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 (c) 2013 The Chromium Authors. All rights reserved. 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 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_PATTERN_H_ 5 #ifndef TOOLS_GN_PATTERN_H_
6 #define TOOLS_GN_PATTERN_H_ 6 #define TOOLS_GN_PATTERN_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 29 matching lines...) Expand all
40 } 40 }
41 } 41 }
42 42
43 Type type; 43 Type type;
44 44
45 // When type == LITERAL this is the text to match. 45 // When type == LITERAL this is the text to match.
46 std::string literal; 46 std::string literal;
47 }; 47 };
48 48
49 explicit Pattern(const std::string& s); 49 explicit Pattern(const std::string& s);
50 Pattern(const Pattern& other);
50 ~Pattern(); 51 ~Pattern();
51 52
52 // Returns true if the current pattern matches the given string. 53 // Returns true if the current pattern matches the given string.
53 bool MatchesString(const std::string& s) const; 54 bool MatchesString(const std::string& s) const;
54 55
55 private: 56 private:
56 // allow_implicit_path_boundary determines if a path boundary should accept 57 // allow_implicit_path_boundary determines if a path boundary should accept
57 // matches at the beginning or end of the string. 58 // matches at the beginning or end of the string.
58 bool RecursiveMatch(const std::string& s, 59 bool RecursiveMatch(const std::string& s,
59 size_t begin_char, 60 size_t begin_char,
60 size_t subrange_index, 61 size_t subrange_index,
61 bool allow_implicit_path_boundary) const; 62 bool allow_implicit_path_boundary) const;
62 63
63 std::vector<Subrange> subranges_; 64 std::vector<Subrange> subranges_;
64 65
65 // Set to true when the subranges are "*foo" ("ANYTHING" followed by a 66 // Set to true when the subranges are "*foo" ("ANYTHING" followed by a
66 // literal). This covers most patterns so we optimize for this. 67 // literal). This covers most patterns so we optimize for this.
67 bool is_suffix_; 68 bool is_suffix_;
68 }; 69 };
69 70
70 class PatternList { 71 class PatternList {
71 public: 72 public:
72 PatternList(); 73 PatternList();
74 PatternList(const PatternList& other);
73 ~PatternList(); 75 ~PatternList();
74 76
75 bool is_empty() const { return patterns_.empty(); } 77 bool is_empty() const { return patterns_.empty(); }
76 78
77 void Append(const Pattern& pattern); 79 void Append(const Pattern& pattern);
78 80
79 // Initializes the pattern list from a give list of pattern strings. Sets 81 // Initializes the pattern list from a give list of pattern strings. Sets
80 // |*err| on failure. 82 // |*err| on failure.
81 void SetFromValue(const Value& v, Err* err); 83 void SetFromValue(const Value& v, Err* err);
82 84
83 bool MatchesString(const std::string& s) const; 85 bool MatchesString(const std::string& s) const;
84 bool MatchesValue(const Value& v) const; 86 bool MatchesValue(const Value& v) const;
85 87
86 private: 88 private:
87 std::vector<Pattern> patterns_; 89 std::vector<Pattern> patterns_;
88 }; 90 };
89 91
90 #endif // TOOLS_GN_PATTERN_H_ 92 #endif // TOOLS_GN_PATTERN_H_
OLDNEW
« tools/gn/label.h ('K') | « tools/gn/label_pattern.cc ('k') | tools/gn/pattern.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698