Replaced project configuration format from JSON to YAML
This commit is contained in:
@@ -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>()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user