diff --git a/ImperatorToCK3/CMakeLists.txt b/ImperatorToCK3/CMakeLists.txt
index f277c4382..266ad9af6 100644
--- a/ImperatorToCK3/CMakeLists.txt
+++ b/ImperatorToCK3/CMakeLists.txt
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.5)
#set(CMAKE_VERBOSE_MAKEFILE on)
project(ImperatorToCK3)
-#SET(CMAKE_CXX_COMPILER g++-9)
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/Source)
set(PROJECT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/Source)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/Release-Linux)
@@ -15,7 +14,6 @@ add_compile_options("-pthread")
add_link_options(-no-pie)
include_directories("../commonItems")
-include_directories("../commonItems/compile-time-regular-expressions/single-header")
include_directories("../ZipLib")
include_directories("/usr/local/include/ImageMagick-7/")
include_directories("../cpp-base64")
@@ -34,6 +32,7 @@ file(GLOB CK3OUTPUTTER_SOURCES "${PROJECT_SOURCE_DIR}/CK3Outputter/*.cpp")
set(BASE64_SOURCES "../cpp-base64/base64.cpp")
set(COMMON_SOURCES "../commonItems/CommonFunctions.cpp")
set(COMMON_SOURCES ${COMMON_SOURCES} "../commonItems/Color.cpp")
+set(COMMON_SOURCES ${COMMON_SOURCES} "../commonItems/ConverterVersion.cpp")
set(COMMON_SOURCES ${COMMON_SOURCES} "../commonItems/GameVersion.cpp")
set(COMMON_SOURCES ${COMMON_SOURCES} "../commonItems/Date.cpp")
set(COMMON_SOURCES ${COMMON_SOURCES} "../commonItems/LinuxUtils.cpp")
diff --git a/ImperatorToCK3/ImperatorToCK3.vcxproj b/ImperatorToCK3/ImperatorToCK3.vcxproj
index fb8113b4e..8d0007898 100644
--- a/ImperatorToCK3/ImperatorToCK3.vcxproj
+++ b/ImperatorToCK3/ImperatorToCK3.vcxproj
@@ -214,6 +214,7 @@
+
@@ -304,13 +305,13 @@
-
+
@@ -402,7 +403,6 @@
-
diff --git a/ImperatorToCK3/ImperatorToCK3.vcxproj.filters b/ImperatorToCK3/ImperatorToCK3.vcxproj.filters
index 582df01e2..5a5e521cd 100644
--- a/ImperatorToCK3/ImperatorToCK3.vcxproj.filters
+++ b/ImperatorToCK3/ImperatorToCK3.vcxproj.filters
@@ -85,9 +85,6 @@
{2404ac05-3984-4e42-9e9d-b039e3d69238}
-
- {0bd26324-6936-4f56-825a-3e90efa339df}
-
{f9b0565f-9991-465b-8df3-67bdce281de6}
@@ -331,9 +328,6 @@
Mappers\NicknameMapper
-
- Mappers\VersionParser
-
Mappers\CK3RegionMapper
@@ -397,6 +391,9 @@
Mappers\SuccessionLawMapper
+
+ commonItems
+
@@ -608,9 +605,6 @@
Mappers\NicknameMapper
-
- Mappers\VersionParser
-
Mappers\CK3RegionMapper
@@ -677,6 +671,9 @@
Mappers\SuccessionLawMapper
+
+ commonItems
+
diff --git a/ImperatorToCK3/Source/CK3/CK3World.cpp b/ImperatorToCK3/Source/CK3/CK3World.cpp
index 216925fda..bb64393c1 100644
--- a/ImperatorToCK3/Source/CK3/CK3World.cpp
+++ b/ImperatorToCK3/Source/CK3/CK3World.cpp
@@ -9,6 +9,7 @@
#include "Titles/Title.h"
#include "Log.h"
#include "OSCompatibilityLayer.h"
+#include "ConverterVersion.h"
#include
#include
#include
@@ -19,7 +20,7 @@ namespace fs = std::filesystem;
-CK3::World::World(const Imperator::World& impWorld, const Configuration& theConfiguration, const mappers::VersionParser& versionParser) {
+CK3::World::World(const Imperator::World& impWorld, const Configuration& theConfiguration, const commonItems::ConverterVersion& converterVersion) {
LOG(LogLevel::Info) << "*** Hello CK3, let's get painting. ***";
// Scraping localizations from Imperator so we may know proper names for our countries.
localizationMapper.scrapeLocalizations(theConfiguration, std::map()); // passes an empty map as second arg because we don't actually load mods yet
diff --git a/ImperatorToCK3/Source/CK3/CK3World.h b/ImperatorToCK3/Source/CK3/CK3World.h
index eb728e421..03913c05a 100644
--- a/ImperatorToCK3/Source/CK3/CK3World.h
+++ b/ImperatorToCK3/Source/CK3/CK3World.h
@@ -3,7 +3,6 @@
-#include "Mappers/VersionParser/VersionParser.h"
#include "Mappers/LocalizationMapper/LocalizationMapper.h"
#include "Mappers/TagTitleMapper/TagTitleMapper.h"
#include "Mappers/CultureMapper/CultureMapper.h"
@@ -31,11 +30,15 @@ namespace Imperator {
class World;
}
+namespace commonItems {
+struct ConverterVersion;
+}
+
namespace CK3 {
class World {
public:
- World(const Imperator::World& impWorld, const Configuration& theConfiguration, const mappers::VersionParser& versionParser);
+ World(const Imperator::World& impWorld, const Configuration& theConfiguration, const commonItems::ConverterVersion& converterVersion);
[[nodiscard]] const auto& getCharacters() const { return characters; }
[[nodiscard]] const auto& getDynasties() const { return dynasties; }
diff --git a/ImperatorToCK3/Source/CK3Outputter/outVersion.cpp b/ImperatorToCK3/Source/CK3Outputter/outVersion.cpp
index d1449980a..b164ea94d 100644
--- a/ImperatorToCK3/Source/CK3Outputter/outVersion.cpp
+++ b/ImperatorToCK3/Source/CK3Outputter/outVersion.cpp
@@ -1,21 +1,20 @@
#include "outVersion.h"
-#include "Mappers/VersionParser/VersionParser.h"
+#include "ConverterVersion.h"
+#include "Log.h"
#include
-std::ostream& mappers::operator<<(std::ostream& output, const VersionParser& versionParser) {
+void logConverterVersion(const commonItems::ConverterVersion& versionParser) {
// read commit id
std::string commitID;
std::ifstream commitIdFile{ "../commit_id.txt" };
commitIdFile >> commitID;
commitIdFile.close();
- output << "\n\n";
- output << "************ -= The Paradox Converters Team =- ********************\n";
- output << "* Converter build based on commit " << commitID << "\n";
- output << "* " << versionParser.descriptionLine << "\n";
- output << "* Built on " << __TIMESTAMP__ << "\n";
- output << "*********** + Imperator: Rome To Crusader Kings III + **************\n";
- return output;
+ Log(LogLevel::Info) << "************ -= The Paradox Converters Team =- ********************";
+ Log(LogLevel::Info) << "* Converter build based on commit " << commitID;
+ Log(LogLevel::Info) << "* " << versionParser.descriptionLine;
+ Log(LogLevel::Info) << "* Built on " << __TIMESTAMP__;
+ Log(LogLevel::Info) << "*********** + Imperator: Rome To Crusader Kings III + *************\n";
}
diff --git a/ImperatorToCK3/Source/CK3Outputter/outVersion.h b/ImperatorToCK3/Source/CK3Outputter/outVersion.h
index 3f2087a19..8a51f2426 100644
--- a/ImperatorToCK3/Source/CK3Outputter/outVersion.h
+++ b/ImperatorToCK3/Source/CK3Outputter/outVersion.h
@@ -3,16 +3,11 @@
-#include
+namespace commonItems {
+struct ConverterVersion;
+} // namespace commonItems
-
-
-namespace mappers {
-
-class VersionParser;
-std::ostream& operator<<(std::ostream& output, const VersionParser& versionParser);
-
-} // namespace mappers
+void logConverterVersion(const commonItems::ConverterVersion& versionParser);
diff --git a/ImperatorToCK3/Source/ImperatorToCK3Converter.cpp b/ImperatorToCK3/Source/ImperatorToCK3Converter.cpp
index 25b2e1979..e29b3fa83 100644
--- a/ImperatorToCK3/Source/ImperatorToCK3Converter.cpp
+++ b/ImperatorToCK3/Source/ImperatorToCK3Converter.cpp
@@ -4,13 +4,15 @@
#include "CK3/CK3World.h"
#include "CK3Outputter/CK3WorldOutputter.h"
#include "Log.h"
+#include "ConverterVersion.h"
-void convertImperatorToCK3(const mappers::VersionParser& versionParser)
-{
+
+
+void convertImperatorToCK3(const commonItems::ConverterVersion& converterVersion) {
const Configuration theConfiguration;
const Imperator::World impWorld(theConfiguration);
- const CK3::World ck3World(impWorld, theConfiguration, versionParser);
+ const CK3::World ck3World(impWorld, theConfiguration, converterVersion);
CK3::outputWorld(ck3World, theConfiguration);
LOG(LogLevel::Info) << "* Conversion complete *";
diff --git a/ImperatorToCK3/Source/ImperatorToCK3Converter.h b/ImperatorToCK3/Source/ImperatorToCK3Converter.h
index ac0dcf982..5f2bf3b39 100644
--- a/ImperatorToCK3/Source/ImperatorToCK3Converter.h
+++ b/ImperatorToCK3/Source/ImperatorToCK3Converter.h
@@ -1,10 +1,14 @@
#ifndef IMPERATORTOCK3_CONVERTER_H
#define IMPERATORTOCK3_CONVERTER_H
-namespace mappers {
- class VersionParser;
+
+
+namespace commonItems {
+struct ConverterVersion;
}
-void convertImperatorToCK3(const mappers::VersionParser& versionParser);
+void convertImperatorToCK3(const commonItems::ConverterVersion& converterVersion);
+
+
#endif // IMPERATORTOCK3_CONVERTER_H
\ No newline at end of file
diff --git a/ImperatorToCK3/Source/Mappers/VersionParser/VersionParser.cpp b/ImperatorToCK3/Source/Mappers/VersionParser/VersionParser.cpp
deleted file mode 100644
index ba91a5024..000000000
--- a/ImperatorToCK3/Source/Mappers/VersionParser/VersionParser.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "VersionParser.h"
-#include "ParserHelpers.h"
-#include "CommonRegexes.h"
-
-
-
-mappers::VersionParser::VersionParser() {
- registerKeys();
- parseFile("configurables/version.txt");
- clearRegisteredKeywords();
-}
-
-
-mappers::VersionParser::VersionParser(std::istream& theStream) {
- registerKeys();
- parseStream(theStream);
- clearRegisteredKeywords();
-}
-
-
-void mappers::VersionParser::registerKeys() {
- registerKeyword("name", [this](std::istream& theStream) {
- name = commonItems::getString(theStream);
- });
- registerKeyword("version", [this](std::istream& theStream) {
- version = commonItems::getString(theStream);
- });
- registerKeyword("descriptionLine", [this](std::istream& theStream) {
- descriptionLine = commonItems::getString(theStream);
- });
- registerRegex(commonItems::catchallRegex, commonItems::ignoreItem);
-}
diff --git a/ImperatorToCK3/Source/Mappers/VersionParser/VersionParser.h b/ImperatorToCK3/Source/Mappers/VersionParser/VersionParser.h
deleted file mode 100644
index ede1ff12d..000000000
--- a/ImperatorToCK3/Source/Mappers/VersionParser/VersionParser.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef VERSION_PARSER_H
-#define VERSION_PARSER_H
-
-
-
-#include "Parser.h"
-
-
-
-namespace mappers {
-
-class VersionParser: commonItems::parser {
- public:
- VersionParser();
- explicit VersionParser(std::istream& theStream);
- [[nodiscard]] const auto& getName() const { return name; }
- [[nodiscard]] const auto& getVersion() const { return version; }
- [[nodiscard]] const auto& getDescription() const { return descriptionLine; }
-
- friend std::ostream& operator<<(std::ostream& output, const VersionParser& versionParser);
-
- private:
- void registerKeys();
-
- std::string name;
- std::string version;
- std::string descriptionLine;
-};
-
-} // namespace mappers
-
-
-
-#endif // VERSION_PARSER_H
\ No newline at end of file
diff --git a/ImperatorToCK3/Source/main.cpp b/ImperatorToCK3/Source/main.cpp
index ab32bcc3e..870cf08ab 100644
--- a/ImperatorToCK3/Source/main.cpp
+++ b/ImperatorToCK3/Source/main.cpp
@@ -1,19 +1,24 @@
#include "ImperatorToCK3Converter.h"
-#include "Mappers/VersionParser/VersionParser.h"
+#include "CK3Outputter/outVersion.h"
#include "Log.h"
+#include "ConverterVersion.h"
#include
-int main(const int argc, const char* argv[])
-{
+
+
+int main(const int argc, const char* argv[]) {
try {
Magick::InitializeMagick(nullptr);
- const mappers::VersionParser versionParser;
- Log(LogLevel::Info) << versionParser;
+
+ commonItems::ConverterVersionParser versionParser;
+ auto converterVersion = versionParser.importVersion("configurables/version.txt");
+ logConverterVersion(converterVersion);
if (argc >= 2) {
Log(LogLevel::Info) << "ImperatorToCK3 takes no parameters.";
Log(LogLevel::Info) << "It uses configuration.txt, configured manually or by the frontend.";
}
- convertImperatorToCK3(versionParser);
+
+ convertImperatorToCK3(converterVersion);
return 0;
}
catch (const std::exception& e) {
diff --git a/ImperatorToCK3Tests/ImperatorToCK3Tests.vcxproj b/ImperatorToCK3Tests/ImperatorToCK3Tests.vcxproj
index cf98b7309..69bb9d3d2 100644
--- a/ImperatorToCK3Tests/ImperatorToCK3Tests.vcxproj
+++ b/ImperatorToCK3Tests/ImperatorToCK3Tests.vcxproj
@@ -243,7 +243,6 @@
-
@@ -292,7 +291,6 @@
-
diff --git a/ImperatorToCK3Tests/ImperatorToCK3Tests.vcxproj.filters b/ImperatorToCK3Tests/ImperatorToCK3Tests.vcxproj.filters
index 86dd82c78..af796020b 100644
--- a/ImperatorToCK3Tests/ImperatorToCK3Tests.vcxproj.filters
+++ b/ImperatorToCK3Tests/ImperatorToCK3Tests.vcxproj.filters
@@ -16,9 +16,6 @@
{8b821bea-0ec6-4690-9411-14c66a11f938}
-
- {fe425519-205f-470d-bd7a-8fc120079608}
-
{7b11c93b-e646-48f4-be4f-a324ffc0b220}
@@ -126,12 +123,6 @@
ImperatorWorldTests\Characters
-
- MapperTests\VersionParser
-
-
- Sources
-
Sources
diff --git a/ImperatorToCK3Tests/MapperTests/VersionParser/VersionParserTests.cpp b/ImperatorToCK3Tests/MapperTests/VersionParser/VersionParserTests.cpp
deleted file mode 100644
index 3ae2018b6..000000000
--- a/ImperatorToCK3Tests/MapperTests/VersionParser/VersionParserTests.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-#include "../ImperatorToCK3/Source/Mappers/VersionParser/VersionParser.h"
-#include "gtest/gtest.h"
-#include
-
-TEST(Mappers_VersionParserTests, nameDefaultsToBlank)
-{
- std::stringstream input;
-
- const mappers::VersionParser theParser(input);
-
- ASSERT_TRUE(theParser.getName().empty());
-}
-
-TEST(Mappers_VersionParserTests, nameCanBeSet)
-{
- std::stringstream input;
- input << "name = test\n";
-
- const mappers::VersionParser theParser(input);
-
- ASSERT_EQ("test", theParser.getName());
-}
-
-TEST(Mappers_VersionParserTests, versionDefaultsToBlank)
-{
- std::stringstream input;
-
- const mappers::VersionParser theParser(input);
-
- ASSERT_TRUE(theParser.getVersion().empty());
-}
-
-TEST(Mappers_VersionParserTests, versionCanBeSet)
-{
- std::stringstream input;
- input << "version = test\n";
-
- const mappers::VersionParser theParser(input);
-
- ASSERT_EQ("test", theParser.getVersion());
-}
-
-TEST(Mappers_VersionParserTests, descriptionDefaultsToBlank)
-{
- std::stringstream input;
-
- const mappers::VersionParser theParser(input);
-
- ASSERT_TRUE(theParser.getDescription().empty());
-}
-
-TEST(Mappers_VersionParserTests, descriptionCanBeSet)
-{
- std::stringstream input;
- input << "descriptionLine = test\n";
-
- const mappers::VersionParser theParser(input);
-
- ASSERT_EQ("test", theParser.getDescription());
-}