Editor implementation for VPD manager

This commit implements editor class for VPD manager app.
This calss holds responsibility of handling and editing
vpd data related requests on behalf of manager app and
updating the cache with new data if required.

This commit also changes parser class to implement api
needed to validate vpd header file in case of write call.

Steps to build:
meson <build_directory>
ninja -C <directory_path>

-Tested with sample json and sample vpd file
sample command to test
busctl call com.ibm.VPD.Manager /com/ibm/VPD/Manager
com.ibm.VPD.Manager WriteKeyword sssay
<"inventory_path"> <"Record_Name"> <"Keyword_Name">
<no. of bytes to update> <array_of_bytes>

Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
Change-Id: I569f03e329b0f62937c6e143a344d8e4ff02db6f
diff --git a/impl.cpp b/impl.cpp
index d647d8b..c7036b7 100644
--- a/impl.cpp
+++ b/impl.cpp
@@ -192,16 +192,13 @@
     }
 }
 
-internal::OffsetList Impl::readTOC() const
+std::size_t Impl::readTOC(Binary::const_iterator& iterator) const
 {
-    internal::OffsetList offsets{};
-
     // The offset to VTOC could be 1 or 2 bytes long
     RecordOffset vtocOffset = getVtocOffset();
 
     // Got the offset to VTOC, skip past record header and keyword header
     // to get to the record name.
-    auto iterator = vpd.cbegin();
     std::advance(iterator, vtocOffset + sizeof(RecordId) + sizeof(RecordSize) +
                                // Skip past the RT keyword, which contains
                                // the record name.
@@ -233,8 +230,8 @@
     // Skip past PT size
     std::advance(iterator, sizeof(KwSize));
 
-    // vpdBuffer is now pointing to PT data
-    return readPT(iterator, ptLen);
+    // length of PT keyword
+    return ptLen;
 }
 
 internal::OffsetList Impl::readPT(Binary::const_iterator iterator,
@@ -476,9 +473,14 @@
     // Check if the VHDR record is present
     checkHeader();
 
+    auto iterator = vpd.cbegin();
+
+    // Read the table of contents record
+    std::size_t ptLen = readTOC(iterator);
+
     // Read the table of contents record, to get offsets
     // to other records.
-    auto offsets = readTOC();
+    auto offsets = readPT(iterator, ptLen);
     for (const auto& offset : offsets)
     {
         processRecord(offset);
@@ -488,6 +490,12 @@
     return Store(std::move(out));
 }
 
+void Impl::checkVPDHeader()
+{
+    // Check if the VHDR record is present and is valid
+    checkHeader();
+}
+
 } // namespace parser
 } // namespace vpd
 } // namespace openpower