Make message registries use 2 digit versions

Redfish specification, section 9.5.11.2 says:

The MessageId property value shall be in the format:
<MessageRegistryPrefix>.<MajorVersion>.<MinorVersion>.<MessageKey>

bmcweb in certain places has incorrectly used the 3 digit version
instead of the 2 digit version.  This commit fixes that by modifying the
parse_registries script to generate 3 separate struct entries to
represent the registry version, and parse them where appropriate.

MessageRegistryFileCollection uses the 3 digit version.  No behavior
changes.
Message/event log entries use the 2 digit version.  This will cause a
MessageId change from:
Base.1.19.0.InternalError
to
Base.1.19.InternalError

This is a breaking change, so a new option to allow the old behavior is
provided.

Tested: Redfish Service validator passes.
Heartbeat events on EventService show 2 digit versions.

Change-Id: I4165e994f73e200f13bed8ea76cb58bee2b69faa
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/redfish-core/include/registries.hpp b/redfish-core/include/registries.hpp
index f7aa32b..ce6d7b8 100644
--- a/redfish-core/include/registries.hpp
+++ b/redfish-core/include/registries.hpp
@@ -15,11 +15,14 @@
 */
 #pragma once
 
+#include "bmcweb_config.h"
+
 #include <nlohmann/json.hpp>
 
 #include <array>
 #include <charconv>
 #include <cstddef>
+#include <format>
 #include <numeric>
 #include <span>
 #include <string>
@@ -32,12 +35,13 @@
 {
     const char* copyright;
     const char* type;
-    const char* id;
+    unsigned int versionMajor;
+    unsigned int versionMinor;
+    unsigned int versionPatch;
     const char* name;
     const char* language;
     const char* description;
     const char* registryPrefix;
-    const char* registryVersion;
     const char* owningEntity;
 };
 
@@ -101,10 +105,19 @@
     {
         jArgs.push_back(arg);
     }
-    std::string msgId = header.id;
-    msgId += ".";
-    msgId += entry.first;
-
+    std::string msgId;
+    if (BMCWEB_REDFISH_USE_3_DIGIT_MESSAGEID)
+    {
+        msgId = std::format("{}.{}.{}.{}.{}", header.registryPrefix,
+                            header.versionMajor, header.versionMinor,
+                            header.versionPatch, entry.first);
+    }
+    else
+    {
+        msgId =
+            std::format("{}.{}.{}.{}", header.registryPrefix,
+                        header.versionMajor, header.versionMinor, entry.first);
+    }
     nlohmann::json::object_t response;
     response["@odata.type"] = "#Message.v1_1_1.Message";
     response["MessageId"] = std::move(msgId);