Replaced project configuration format from JSON to YAML

This commit is contained in:
Nav
2022-07-23 15:37:22 +01:00
parent cb577c7acd
commit ae5747e79b
13 changed files with 215 additions and 133 deletions

View File

@@ -1,18 +1,27 @@
#include "GdbDebugServerConfig.hpp"
#include "src/Helpers/YamlUtilities.hpp"
#include "src/Logger/Logger.hpp"
namespace Bloom::DebugServer::Gdb
{
GdbDebugServerConfig::GdbDebugServerConfig(const DebugServerConfig& debugServerConfig)
: DebugServerConfig(debugServerConfig)
{
if (debugServerConfig.jsonObject.contains("ipAddress")) {
this->listeningAddress = debugServerConfig.jsonObject.value("ipAddress").toString().toStdString();
if (debugServerConfig.debugServerNode["ipAddress"]) {
if (!YamlUtilities::isType<std::string>(debugServerConfig.debugServerNode["ipAddress"])) {
Logger::error(
"Invalid GDB debug server config parameter ('ipAddress') provided - must be a string. The "
"parameter will be ignored."
);
}
this->listeningAddress = debugServerConfig.debugServerNode["ipAddress"].as<std::string>();
}
if (debugServerConfig.jsonObject.contains("port")) {
const auto portValue = debugServerConfig.jsonObject.value("port");
if (debugServerConfig.debugServerNode["port"]) {
this->listeningPortNumber = static_cast<std::uint16_t>(
portValue.isString() ? portValue.toString().toInt(nullptr, 10) : portValue.toInt()
debugServerConfig.debugServerNode["port"].as<int>()
);
}
}