Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 1 | #include "Interface.h" |
| 2 | |
| 3 | #include "Formatter.h" |
| 4 | #include "Method.h" |
| 5 | |
| 6 | namespace android { |
| 7 | |
| 8 | Interface::Interface(const char *name, Type *super) |
| 9 | : Scope(name), |
| 10 | mSuperType(super) { |
| 11 | } |
| 12 | |
| 13 | void Interface::addMethod(Method *method) { |
| 14 | mMethods.push_back(method); |
| 15 | } |
| 16 | |
| 17 | const Type *Interface::superType() const { |
| 18 | return mSuperType; |
| 19 | } |
| 20 | |
| 21 | void Interface::dump(Formatter &out) const { |
| 22 | out << "interface " << name(); |
| 23 | |
| 24 | if (mSuperType != NULL) { |
| 25 | out << " extends "; |
| 26 | mSuperType->dump(out); |
| 27 | } |
| 28 | |
| 29 | out << " {\n"; |
| 30 | |
| 31 | out.indent(); |
| 32 | Scope::dump(out); |
| 33 | |
| 34 | for (size_t i = 0; i < mMethods.size(); ++i) { |
| 35 | mMethods[i]->dump(out); |
| 36 | |
| 37 | out << "\n"; |
| 38 | } |
| 39 | |
| 40 | out.unindent(); |
| 41 | |
| 42 | out << "};\n\n"; |
| 43 | } |
| 44 | |
Andreas Huber | a2723d2 | 2016-07-29 15:36:07 -0700 | [diff] [blame^] | 45 | bool Interface::isInterface() const { |
| 46 | return true; |
| 47 | } |
| 48 | |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 49 | } // namespace android |
| 50 | |