blob: ef4b573b7fb0331e30ed187fb5fd0d421f958fd7 [file] [log] [blame]
Andreas Huberc9410c72016-07-28 12:18:40 -07001#include "Interface.h"
2
3#include "Formatter.h"
4#include "Method.h"
5
6namespace android {
7
8Interface::Interface(const char *name, Type *super)
9 : Scope(name),
10 mSuperType(super) {
11}
12
13void Interface::addMethod(Method *method) {
14 mMethods.push_back(method);
15}
16
17const Type *Interface::superType() const {
18 return mSuperType;
19}
20
21void 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 Hubera2723d22016-07-29 15:36:07 -070045bool Interface::isInterface() const {
46 return true;
47}
48
Andreas Huberc9410c72016-07-28 12:18:40 -070049} // namespace android
50