Refactor Version::getValue()

Rename the function to getValues() and change the parameter and return
value types, and add a test case for it.
It will be used in future commits.

Tested: Verify the unit test case passes.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I57ccf857737ef13f4e2f27c5f2fb7400a2170e91
diff --git a/src/version.cpp b/src/version.cpp
index 7940d2e..0ea6cc9 100644
--- a/src/version.cpp
+++ b/src/version.cpp
@@ -23,8 +23,8 @@
 using Argument = xyz::openbmc_project::Common::InvalidArgument;
 
 std::map<std::string, std::string>
-    Version::getValue(const std::string& filePath,
-                      std::map<std::string, std::string> keys)
+    Version::getValues(const std::string& filePath,
+                       const std::vector<std::string>& keys)
 {
     if (filePath.empty())
     {
@@ -33,39 +33,24 @@
                               Argument::ARGUMENT_VALUE(filePath.c_str()));
     }
 
-    std::ifstream efile;
+    std::ifstream efile(filePath);
     std::string line;
-    efile.exceptions(std::ifstream::failbit | std::ifstream::badbit |
-                     std::ifstream::eofbit);
+    std::map<std::string, std::string> ret;
 
-    try
+    while (getline(efile, line))
     {
-        efile.open(filePath);
-        while (getline(efile, line))
+        for (const auto& key : keys)
         {
-            for (auto& key : keys)
+            auto value = key + "=";
+            auto keySize = value.length();
+            if (line.compare(0, keySize, value) == 0)
             {
-                auto value = key.first + "=";
-                auto keySize = value.length();
-                if (line.compare(0, keySize, value) == 0)
-                {
-                    key.second = line.substr(keySize);
-                    break;
-                }
+                ret.emplace(key, line.substr(keySize));
+                break;
             }
         }
-        efile.close();
     }
-    catch (const std::exception& e)
-    {
-        if (!efile.eof())
-        {
-            log<level::ERR>("Error in reading file");
-        }
-        efile.close();
-    }
-
-    return keys;
+    return ret;
 }
 
 void Delete::delete_()