ComparatorLibs: Add stringify to hierarchy for easy printing

This commit is contained in:
2026-06-10 22:43:39 -04:00
parent 549f0c04f4
commit 82b99e680c
10 changed files with 91 additions and 7 deletions
+10
View File
@@ -3,6 +3,8 @@
#include <cstdint>
#include <memory>
#include <sstream>
#include <string>
#include <mentalEntity.h>
#include <user/logic.h>
@@ -43,6 +45,14 @@ struct ComparatorTypeId
{
return !(*this == other);
}
std::string stringify() const
{
std::ostringstream result;
result << std::hex << std::showbase;
result << "vendorId=" << vendorId << " typeId=" << typeId;
return result.str();
}
};
class Comparator
+19
View File
@@ -32,6 +32,11 @@ public:
return true;
}
std::string stringify() const
{
return name + " (" + typeId.stringify() + ")";
}
public:
std::string name;
ComparatorTypeId typeId;
@@ -56,6 +61,20 @@ public:
return true;
}
std::string stringify() const
{
std::string result = "Name: " + name + "\n";
result += "Exported Comparator Types:\n";
for (size_t i = 0; i < exportedComparatorTypes.size(); ++i)
{
result += " - " + exportedComparatorTypes[i].stringify();
if (i + 1 < exportedComparatorTypes.size()) {
result += "\n";
}
}
return result;
}
public:
std::string name;
std::vector<ExportedComparatorTypeDesc> exportedComparatorTypes;
+6 -2
View File
@@ -90,8 +90,12 @@ public:
{
std::string result = "Name: " + name + "\n";
result += "Exported QualeIface APIs:\n";
for (const auto& api : exportedQualeIfaceApis) {
result += " - " + api.name + "\n";
for (size_t i = 0; i < exportedQualeIfaceApis.size(); ++i)
{
result += " - " + exportedQualeIfaceApis[i].name;
if (i + 1 < exportedQualeIfaceApis.size()) {
result += "\n";
}
}
return result;
}