sysd_monitor: Parse json file(s)

Parse the json file(s) into a c++ data object that can be used in later
commits to easily check for monitored targets and log appropriate
errors.

Accept a command line parameter to input file and call parsing function

Tested:
- Verified 100% code coverage of new parser cpp

Change-Id: I0bacd80b7f5330eb9cb03d8e3717742ab107bf94
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/systemd_target_parser.hpp b/systemd_target_parser.hpp
new file mode 100644
index 0000000..fbe3814
--- /dev/null
+++ b/systemd_target_parser.hpp
@@ -0,0 +1,35 @@
+#pragma once
+
+#include <map>
+#include <string>
+#include <vector>
+
+#include <nlohmann/json.hpp>
+
+/** @brief Stores the error to log if errors to monitor is found */
+struct targetEntry
+{
+    std::string errorToLog;
+    std::vector<std::string> errorsToMonitor;
+};
+
+/** @brief A map of the systemd target to its corresponding targetEntry*/
+using TargetErrorData = std::map<std::string, targetEntry>;
+
+using json = nlohmann::json;
+
+extern bool gVerbose;
+
+/** @brief Parse input json files
+ *
+ * Will return the parsed data in the TargetErrorData object
+ *
+ * @note This function will throw exceptions for an invalid json file
+ * @note See phosphor-target-monitor-default.json for example of json file
+ *       format
+ *
+ * @param[in] filePaths - The file(s) to parse
+ *
+ * @return Map of target to error log relationships
+ */
+TargetErrorData parseFiles(const std::vector<std::string>& filePaths);