OLD | NEW |
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_SOURCE_FILE_TYPE_H_ | 5 #ifndef TOOLS_GN_SOURCE_FILE_TYPE_H_ |
6 #define TOOLS_GN_SOURCE_FILE_TYPE_H_ | 6 #define TOOLS_GN_SOURCE_FILE_TYPE_H_ |
7 | 7 |
8 class SourceFile; | 8 class SourceFile; |
9 | 9 |
10 // This should be sequential integers starting from 0 so they can be used as | 10 // This should be sequential integers starting from 0 so they can be used as |
(...skipping 10 matching lines...) Expand all Loading... |
21 SOURCE_RC, | 21 SOURCE_RC, |
22 SOURCE_O, // Object files can be inputs, too. Also counts .obj. | 22 SOURCE_O, // Object files can be inputs, too. Also counts .obj. |
23 SOURCE_DEF, | 23 SOURCE_DEF, |
24 | 24 |
25 // Must be last. | 25 // Must be last. |
26 SOURCE_NUMTYPES, | 26 SOURCE_NUMTYPES, |
27 }; | 27 }; |
28 | 28 |
29 SourceFileType GetSourceFileType(const SourceFile& file); | 29 SourceFileType GetSourceFileType(const SourceFile& file); |
30 | 30 |
| 31 // Represents a set of tool types. |
| 32 class SourceFileTypeSet { |
| 33 public: |
| 34 SourceFileTypeSet() { |
| 35 for (auto& flag : flags_) |
| 36 flag = 0; |
| 37 } |
| 38 |
| 39 void Set(SourceFileType type) { flags_[static_cast<int>(type)] = true; } |
| 40 bool Get(SourceFileType type) const { return flags_[static_cast<int>(type)]; } |
| 41 |
| 42 private: |
| 43 bool flags_[static_cast<int>(SOURCE_NUMTYPES)]; |
| 44 }; |
| 45 |
31 #endif // TOOLS_GN_SOURCE_FILE_TYPE_H_ | 46 #endif // TOOLS_GN_SOURCE_FILE_TYPE_H_ |
OLD | NEW |