libvintf: use toFQNameString

Centralize the hard-coded "@" "::" "/".

Test: builds
Test: libvintf_test
Test: vintf_object_test
Change-Id: I1942441865585b11801e7d9b38c0c57b5c5ebe17
diff --git a/main.cpp b/main.cpp
index 111b797..c4119c9 100644
--- a/main.cpp
+++ b/main.cpp
@@ -151,15 +151,6 @@
     }
 }
 
-// android.hardware.foo@1.0-1::IFoo/default.
-// Note that the format is extended to support a range of versions.
-std::string fqInstanceName(const std::string& package, const VersionRange& range,
-                           const std::string& interface, const std::string& instance) {
-    std::stringstream ss;
-    ss << package << "@" << range << "::" << interface << "/" << instance;
-    return ss.str();
-}
-
 struct TableRow {
     // Whether the HAL version is in device manifest, framework manifest, device compatibility
     // matrix, framework compatibility matrix, respectively.
@@ -199,7 +190,7 @@
     if (manifest == nullptr) return;
     manifest->forEachInstance([&](const auto& package, const auto& version, const auto& interface,
                                   const auto& instance, bool* /* stop */) {
-        std::string key = fqInstanceName(package, VersionRange{version.majorVer, version.minorVer},
+        std::string key = toFQNameString(package, VersionRange{version.majorVer, version.minorVer},
                                          interface, instance);
         mutate(&(*table)[key]);
     });
@@ -211,7 +202,7 @@
                                 const auto& instance, bool optional, bool* /* stop */) {
         bool missed = false;
         for (auto minorVer = range.minMinor; minorVer <= range.maxMinor; ++minorVer) {
-            std::string key = fqInstanceName(package, VersionRange{range.majorVer, minorVer},
+            std::string key = toFQNameString(package, VersionRange{range.majorVer, minorVer},
                                              interface, instance);
             auto it = table->find(key);
             if (it == table->end()) {
@@ -222,7 +213,7 @@
             }
         }
         if (missed) {
-            std::string key = fqInstanceName(package, range, interface, instance);
+            std::string key = toFQNameString(package, range, interface, instance);
             mutate(&(*table)[key]);
         }
     });