Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 1 | #ifndef SCOPE_H_ |
| 2 | |
| 3 | #define SCOPE_H_ |
| 4 | |
| 5 | #include "NamedType.h" |
| 6 | |
| 7 | #include <utils/KeyedVector.h> |
| 8 | #include <utils/Vector.h> |
| 9 | |
| 10 | namespace android { |
| 11 | |
| 12 | struct Constant; |
| 13 | |
| 14 | struct Scope : public NamedType { |
| 15 | Scope(const char *name); |
| 16 | |
| 17 | bool addType(NamedType *type); |
| 18 | Type *lookupType(const char *name) const; |
| 19 | |
| 20 | bool addConstant(Constant *constant); |
| 21 | |
| 22 | void dump(Formatter &out) const override; |
Andreas Huber | 5345ec2 | 2016-07-29 13:33:27 -0700 | [diff] [blame^] | 23 | bool isScope() const override; |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 24 | |
| 25 | private: |
| 26 | Vector<Type *> mTypes; |
| 27 | KeyedVector<std::string, size_t> mTypeIndexByName; |
| 28 | |
| 29 | KeyedVector<std::string, Constant *> mConstants; |
| 30 | |
| 31 | DISALLOW_COPY_AND_ASSIGN(Scope); |
| 32 | }; |
| 33 | |
| 34 | } // namespace android |
| 35 | |
| 36 | #endif // SCOPE_H_ |
| 37 | |