hidl-gen: auto-generate depdendencies for nested types

HIDL allows for types to be defined within interfaces, and for these
types to be able to be referred to from outside of these interfaces.
hidl-gen was not emitting the correct #include and import paths in C++
and Java respectively for such cases, and also Makefile dependencies.

b/31268323

Change-Id: I168c52823098348b4161b5d2c151d1d8eadec9b8
Signed-off-by: Iliyan Malchev <malchev@google.com>
diff --git a/FQName.h b/FQName.h
index 40f3ae1..6f5f8d5 100644
--- a/FQName.h
+++ b/FQName.h
@@ -41,7 +41,33 @@
 
     std::string package() const;
     std::string version() const;
+
+    // The next two methods return the name part of the FQName, that is, the
+    // part after the version field.  For example:
+    //
+    // package android.hardware.tests.foo@1.0;
+    // interface IFoo {
+    //    struct bar {
+    //        struct baz {
+    //            ...
+    //        };
+    //    };
+    // };
+    //
+    // package android.hardware.tests.bar@1.0;
+    // import android.hardware.tests.foo@1.0;
+    // interface {
+    //    struct boo {
+    //        IFoo.bar.baz base;
+    //    };
+    // }
+    //
+    // The FQName for base is android.hardware.tests.foo@1.0::IFoo.bar.baz; so
+    // FQName::name() will return "IFoo.bar.baz". FQName::names() will return
+    // std::vector<std::string>{"IFoo","bar","baz"}
+
     std::string name() const;
+    std::vector<std::string> names() const;
 
     bool isFullyQualified() const;