Scope.h revision c7dfef3fda2061dcaeeb144c10eef3cf7360b03c
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 10namespace android { 11 12struct Constant; 13struct Formatter; 14struct Interface; 15 16struct Scope : public NamedType { 17 Scope(); 18 19 bool addType(const char *localName, NamedType *type); 20 21 Type *lookupType(const char *name) const; 22 23 bool addConstant(Constant *constant); 24 25 bool isScope() const override; 26 27 // Returns the single interface or NULL. 28 Interface *getInterface() const; 29 30 bool containsSingleInterface(std::string *ifaceName) const; 31 32 std::string pickUniqueAnonymousName() const; 33 34 std::string getJavaType() const override; 35 36 status_t emitTypeDeclarations(Formatter &out) const override; 37 status_t emitJavaTypeDeclarations(Formatter &out) const override; 38 39 status_t emitTypeDefinitions( 40 Formatter &out, const std::string prefix) const override; 41 42 Vector<Type *> getSubTypes() const; 43 44 status_t emitVtsTypeDeclarations(Formatter &out) const override; 45 46private: 47 Vector<Type *> mTypes; 48 KeyedVector<std::string, size_t> mTypeIndexByName; 49 50 KeyedVector<std::string, Constant *> mConstants; 51 52 DISALLOW_COPY_AND_ASSIGN(Scope); 53}; 54 55} // namespace android 56 57#endif // SCOPE_H_ 58 59