From 907a46213e5ca3e741744f67ad71966b70b89e38 Mon Sep 17 00:00:00 2001
From: gcontini <1121667+gcontini@users.noreply.github.com>
Date: 周六, 05 12月 2020 23:38:40 +0800
Subject: [PATCH] fix Codacy warnings

---
 src/library/base/EventRegistry.cpp |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/library/base/EventRegistry.cpp b/src/library/base/EventRegistry.cpp
index 920e735..961e72b 100644
--- a/src/library/base/EventRegistry.cpp
+++ b/src/library/base/EventRegistry.cpp
@@ -10,6 +10,7 @@
 #include <algorithm>
 #include <map>
 #include <iostream>
+#include <sstream>
 
 #include "EventRegistry.h"
 #define LIC_ID_NOT_DEFINED "UNDEF"
@@ -17,7 +18,7 @@
 namespace license {
 using namespace std;
 
-const map<EVENT_TYPE, int> PROGRESS_BY_EVENT_TYPE = {
+const map<LCC_EVENT_TYPE, int> PROGRESS_BY_EVENT_TYPE = {
 	{LICENSE_SPECIFIED, 0}, {LICENSE_FOUND, 1}, {PRODUCT_FOUND, 2}, {SIGNATURE_VERIFIED, 3}, {LICENSE_OK, 4}};
 
 EventRegistry::EventRegistry() { current_validation_step = -1; }
@@ -39,6 +40,12 @@
 	}
 	out << "]";
 	return out;
+}
+
+string EventRegistry::to_string() const {
+	std::stringstream ss;
+	ss << this;
+	return ss.str();
 }
 
 void EventRegistry::append(const EventRegistry &eventRegistry) {
@@ -73,11 +80,11 @@
 	return result;
 }
 
-void EventRegistry::addEvent(EVENT_TYPE event, const std::string &licenseLocationId) {
+void EventRegistry::addEvent(LCC_EVENT_TYPE event, const std::string &licenseLocationId) {
 	addEvent(event, licenseLocationId.c_str(), nullptr);
 }
 
-void EventRegistry::addEvent(EVENT_TYPE event, const char *licenseLocationId, const char *info) {
+void EventRegistry::addEvent(LCC_EVENT_TYPE event, const char *licenseLocationId, const char *info) {
 	AuditEvent audit;
 	auto eventIterator = PROGRESS_BY_EVENT_TYPE.find(event);
 	bool successEvent = (eventIterator != PROGRESS_BY_EVENT_TYPE.end());

--
Gitblit v1.9.1