feat: update BMapInspector
This commit is contained in:
@@ -1,11 +1,14 @@
|
|||||||
#include "Utils.hpp"
|
#include "Utils.hpp"
|
||||||
|
#include "Ruleset.hpp"
|
||||||
#include <VTAll.hpp>
|
#include <VTAll.hpp>
|
||||||
#include <yycc.hpp>
|
#include <yycc.hpp>
|
||||||
#include <yycc/carton/termcolor.hpp>
|
#include <yycc/carton/termcolor.hpp>
|
||||||
|
#include <yycc/string/op.hpp>
|
||||||
#include <yycc/patch/stream.hpp>
|
#include <yycc/patch/stream.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace yycc::patch::stream;
|
using namespace yycc::patch::stream;
|
||||||
|
namespace strop = yycc::string::op;
|
||||||
namespace termcolor = yycc::carton::termcolor;
|
namespace termcolor = yycc::carton::termcolor;
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
@@ -13,14 +16,23 @@ int main(int argc, char *argv[]) {
|
|||||||
// Show splash
|
// Show splash
|
||||||
std::cout << termcolor::colored(u8"Ballance Map Inspector", termcolor::Color::LightYellow)
|
std::cout << termcolor::colored(u8"Ballance Map Inspector", termcolor::Color::LightYellow)
|
||||||
<< " (based on LibCmo " LIBCMO_VER_STR ") built at " __DATE__ " " __TIME__ << std::endl
|
<< " (based on LibCmo " LIBCMO_VER_STR ") built at " __DATE__ " " __TIME__ << std::endl
|
||||||
<< u8"The inspector for checking whether your Ballance custom map can be loaded without any issues." << std::endl;
|
<< u8"The inspector for checking whether your Ballance custom map can be loaded without any issues." << std::endl
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
// Create reporter
|
// Create reporter
|
||||||
BMapInspector::Utils::Reporter reporter;
|
BMapInspector::Utils::Reporter reporter;
|
||||||
|
|
||||||
// Show report
|
// Get rule collection
|
||||||
|
BMapInspector::Ruleset::RuleCollection rule_collection;
|
||||||
|
// Show rule infos
|
||||||
|
std::cout << strop::printf(u8"Total %" PRIuSIZET " rule(s) are loaded.", rule_collection.GetRuleCount()) << std::endl
|
||||||
|
<< u8"Check may take few minutes. Please do not close this console..." << std::endl
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
|
// Show report conclusion
|
||||||
reporter.PrintConclusion();
|
reporter.PrintConclusion();
|
||||||
reporter.PrintDetails();
|
// Print report in detail
|
||||||
|
reporter.PrintReport();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ namespace BMapInspector::Ruleset {
|
|||||||
|
|
||||||
RuleCollection::~RuleCollection() {}
|
RuleCollection::~RuleCollection() {}
|
||||||
|
|
||||||
|
size_t RuleCollection::GetRuleCount() const {
|
||||||
|
return this->rules.size();
|
||||||
|
}
|
||||||
|
|
||||||
const std::vector<IRule*>& RuleCollection::GetRules() const {
|
const std::vector<IRule*>& RuleCollection::GetRules() const {
|
||||||
return this->rules;
|
return this->rules;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include "Utils.hpp"
|
||||||
|
#include <VTAll.hpp>
|
||||||
#include <yycc.hpp>
|
#include <yycc.hpp>
|
||||||
#include <yycc/macro/class_copy_move.hpp>
|
#include <yycc/macro/class_copy_move.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -15,7 +17,7 @@ namespace BMapInspector::Ruleset {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
virtual std::u8string_view GetRuleName() const = 0;
|
virtual std::u8string_view GetRuleName() const = 0;
|
||||||
virtual void Check() const = 0;
|
virtual void Check(Utils::Reporter& reporter) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RuleCollection {
|
class RuleCollection {
|
||||||
@@ -25,6 +27,7 @@ namespace BMapInspector::Ruleset {
|
|||||||
YYCC_DELETE_COPY_MOVE(RuleCollection)
|
YYCC_DELETE_COPY_MOVE(RuleCollection)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
size_t GetRuleCount() const;
|
||||||
const std::vector<IRule *> &GetRules() const;
|
const std::vector<IRule *> &GetRules() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ using namespace yycc::patch::stream;
|
|||||||
namespace strop = yycc::string::op;
|
namespace strop = yycc::string::op;
|
||||||
namespace termcolor = yycc::carton::termcolor;
|
namespace termcolor = yycc::carton::termcolor;
|
||||||
|
|
||||||
#define PRIuSIZET "zu"
|
|
||||||
|
|
||||||
namespace BMapInspector::Utils {
|
namespace BMapInspector::Utils {
|
||||||
|
|
||||||
#pragma region Reporter
|
#pragma region Reporter
|
||||||
@@ -84,7 +82,7 @@ namespace BMapInspector::Utils {
|
|||||||
termcolor::Color::LightBlue);
|
termcolor::Color::LightBlue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Reporter::PrintDetails() const {
|
void Reporter::PrintReport() const {
|
||||||
// Print all entries by different color
|
// Print all entries by different color
|
||||||
for (const auto &report : this->reports) {
|
for (const auto &report : this->reports) {
|
||||||
switch (report.kind) {
|
switch (report.kind) {
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#define PRIuSIZET "zu"
|
||||||
|
|
||||||
namespace BMapInspector::Utils {
|
namespace BMapInspector::Utils {
|
||||||
|
|
||||||
enum class ReportKind { Error, Warning, Info };
|
enum class ReportKind { Error, Warning, Info };
|
||||||
@@ -34,7 +36,7 @@ namespace BMapInspector::Utils {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
void PrintConclusion() const;
|
void PrintConclusion() const;
|
||||||
void PrintDetails() const;
|
void PrintReport() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<Report> reports;
|
std::vector<Report> reports;
|
||||||
|
|||||||
Reference in New Issue
Block a user