initial commit of reimplementation of hidl-gen

    commit 56da787631c17276bc987f19649c6c1ea92200c3
    Author: Andreas Huber <andih@google.com>
    Date:   Thu Jul 28 12:18:57 2016 -0700

    ast.cpp => AST.cpp

    commit 095552aba072152d9c87475895cd2e97c43b7b03
    Author: Andreas Huber <andih@google.com>
    Date:   Thu Jul 28 10:43:04 2016 -0700

    TypeContainer => Scope, since it now also holds constants.

    commit 89ec1c511e7806037a53e43333c37fdf1b7aa39e
    Author: Andreas Huber <andih@google.com>
    Date:   Thu Jul 28 10:41:05 2016 -0700

    initial support for constants

    commit b60b7ae588654b634bfdc5c283a25dd6378e1df7
    Author: Andreas Huber <andih@google.com>
    Date:   Thu Jul 28 10:01:46 2016 -0700

    Support for typedef, maintain ordering inside TypeContainer

    commit 8e83034a077ce2309deeb0e2094079cf6f11d8b4
    Author: Andreas Huber <andih@google.com>
    Date:   Thu Jul 28 09:36:29 2016 -0700

    support for optional super interface

    commit 9d44b022adb4a68dfca67ba2a6d845b7c8f27b88
    Author: Andreas Huber <andih@google.com>
    Date:   Thu Jul 28 09:28:18 2016 -0700

    ast => AST

    commit 48fd7f8a4e8ecf230cfc416aec6c8f6115e410af
    Author: Andreas Huber <andih@google.com>
    Date:   Thu Jul 28 09:26:44 2016 -0700

    Each type in its own source/header file pair.

    commit ca1285ecbcbbb1340eec476e3fd4d1334908d8c1
    Author: Andreas Huber <andih@google.com>
    Date:   Thu Jul 28 08:52:24 2016 -0700

    added scalar types "char", "bool" and "opaque"

    commit fbb351e5f4392fcbbce77402dfe059a1c8d79fb2
    Author: Andreas Huber <andih@google.com>
    Date:   Wed Jul 27 13:47:32 2016 -0700

    some fixes to the parser and ast.

    commit 78288216b101349e9364c2d4470ecb5b9a942f5c
    Author: Andreas Huber <andih@google.com>
    Date:   Wed Jul 27 12:34:21 2016 -0700

    Formatter, AST::dump(), NamedType

    commit 4b8cc5d0a8ff5f70cb53e21b56138124259b8bcb
    Author: Andreas Huber <andih@google.com>
    Date:   Wed Jul 27 11:45:10 2016 -0700

    revamp of the parser, scoped type containers

    commit 0193fbfa5c7ac3ac1ce306dfb9c55d879f8c02b5
    Author: Andreas Huber <andih@google.com>
    Date:   Wed Jul 27 10:13:35 2016 -0700

    store output in AST.

    commit 7f53022123978cc7c2a05b0c4aba7a4c5deea93b
    Author: Andreas Huber <andih@google.com>
    Date:   Wed Jul 27 10:06:54 2016 -0700

    reentrant lexer/parser

    commit 3d3e343d6cea2fb127b203071e8aff08a5715011
    Author: Andreas Huber <andih@google.com>
    Date:   Tue Jul 26 15:27:02 2016 -0700

    better typename lookup, comments.

    commit 39f13ae860dbd9ffd163a5c99f150170525457ef
    Author: Andreas Huber <andih@google.com>
    Date:   Tue Jul 26 14:29:33 2016 -0700

    an actual AST.

    commit b1f3f1d94a8d1257426da35ace5bc2af04c433b6
    Author: Andreas Huber <andih@google.com>
    Date:   Tue Jul 26 12:51:34 2016 -0700

    initial commit

Change-Id: I44d1d928a5f3dcb908e264d53af09bbe25d8c464
diff --git a/Interface.cpp b/Interface.cpp
new file mode 100644
index 0000000..054a869
--- /dev/null
+++ b/Interface.cpp
@@ -0,0 +1,46 @@
+#include "Interface.h"
+
+#include "Formatter.h"
+#include "Method.h"
+
+namespace android {
+
+Interface::Interface(const char *name, Type *super)
+    : Scope(name),
+      mSuperType(super) {
+}
+
+void Interface::addMethod(Method *method) {
+    mMethods.push_back(method);
+}
+
+const Type *Interface::superType() const {
+    return mSuperType;
+}
+
+void Interface::dump(Formatter &out) const {
+    out << "interface " << name();
+
+    if (mSuperType != NULL) {
+        out << " extends ";
+        mSuperType->dump(out);
+    }
+
+    out << " {\n";
+
+    out.indent();
+    Scope::dump(out);
+
+    for (size_t i = 0; i < mMethods.size(); ++i) {
+        mMethods[i]->dump(out);
+
+        out << "\n";
+    }
+
+    out.unindent();
+
+    out << "};\n\n";
+}
+
+}  // namespace android
+