diff --git a/3rdParty/Radon/Radon/include/File.hpp b/3rdParty/Radon/Radon/include/File.hpp index b60423640..d30b1dc25 100644 --- a/3rdParty/Radon/Radon/include/File.hpp +++ b/3rdParty/Radon/Radon/include/File.hpp @@ -16,14 +16,14 @@ namespace radon File(const std::string & path, bool reading = true); - std::unique_ptr
getSection(const std::string & name); + Section* getSection(const std::string & name); - void addSection(Section & category); + void File::addSection(const std::string & name); void saveToFile(); private: - std::vector> sections; + std::vector
sections; std::string path; }; -} \ No newline at end of file +} diff --git a/3rdParty/Radon/Radon/include/Key.hpp b/3rdParty/Radon/Radon/include/Key.hpp index 8d36ea5d0..d3135b1c5 100644 --- a/3rdParty/Radon/Radon/include/Key.hpp +++ b/3rdParty/Radon/Radon/include/Key.hpp @@ -32,4 +32,4 @@ namespace radon friend class File; }; -} \ No newline at end of file +} diff --git a/3rdParty/Radon/Radon/include/Named.hpp b/3rdParty/Radon/Radon/include/Named.hpp index dbbdd1bb0..49a02a358 100644 --- a/3rdParty/Radon/Radon/include/Named.hpp +++ b/3rdParty/Radon/Radon/include/Named.hpp @@ -21,4 +21,4 @@ namespace radon protected: std::string name; }; -} \ No newline at end of file +} diff --git a/3rdParty/Radon/Radon/include/Radon.hpp b/3rdParty/Radon/Radon/include/Radon.hpp index de898f963..106139b89 100644 --- a/3rdParty/Radon/Radon/include/Radon.hpp +++ b/3rdParty/Radon/Radon/include/Radon.hpp @@ -6,4 +6,4 @@ #include "Key.hpp" #include "Named.hpp" #include "Radon.hpp" -#include "Section.hpp" \ No newline at end of file +#include "Section.hpp" diff --git a/3rdParty/Radon/Radon/include/Section.hpp b/3rdParty/Radon/Radon/include/Section.hpp index 488dc3387..3a74703e8 100644 --- a/3rdParty/Radon/Radon/include/Section.hpp +++ b/3rdParty/Radon/Radon/include/Section.hpp @@ -20,13 +20,13 @@ namespace radon Section(const std::string & name); - Key getKey(const std::string & name); + Key *getKey(const std::string & name); - void addKey(Key & variable); + void addKey(Key variable); private: std::vector keys; friend class File; }; -} \ No newline at end of file +} diff --git a/3rdParty/Radon/Radon/source/File.cpp b/3rdParty/Radon/Radon/source/File.cpp index 8d74967f6..77d9b4d3a 100644 --- a/3rdParty/Radon/Radon/source/File.cpp +++ b/3rdParty/Radon/Radon/source/File.cpp @@ -24,12 +24,11 @@ namespace radon while (std::getline(stream, buffer)) { - buffer.erase(std::remove(buffer.begin(), buffer.end(), ' '), buffer.end()); if (buffer[0] == ';' || buffer[0] == '#') continue; if (buffer[0] == '[') { nameOfCurrent = buffer.substr(buffer.find("[") + 1, buffer.find("]") - 1); - sections.push_back(std::unique_ptr
(new Section(nameOfCurrent))); + sections.push_back(Section(nameOfCurrent)); } else { @@ -38,7 +37,7 @@ namespace radon std::string nameOfElement = buffer.substr(0, equalsPosition); std::string valueOfElement = buffer.substr(equalsPosition + 1, buffer.size()); - sections.back()->addKey(Key(nameOfElement, valueOfElement)); + sections.back().addKey(Key(nameOfElement, valueOfElement)); } } } @@ -46,23 +45,23 @@ namespace radon } - std::unique_ptr
File::getSection(const std::string & name) + Section *File::getSection(const std::string & name) { for (auto & section : sections) { - if (section->getName() == name) + if (section.getName() == name) { - return std::make_unique
(*section); + return §ion; } } - assert(1); + return nullptr; } - void File::addSection(Section & category) + void File::addSection(const std::string & name) { - sections.push_back(std::make_unique
(category)); + sections.push_back(Section(name)); } @@ -72,12 +71,12 @@ namespace radon for (auto & section : sections) { - file << "[" << section->getName() << "] \n"; - for (auto & key : section->keys) + file << "[" << section.getName() << "] \n"; + for (auto & key : section.keys) { file << key.getName() << "=" << key.getStringValue() << "\n"; } } file.close(); } -} \ No newline at end of file +} diff --git a/3rdParty/Radon/Radon/source/Key.cpp b/3rdParty/Radon/Radon/source/Key.cpp index 8310fdcfe..3357e1b16 100644 --- a/3rdParty/Radon/Radon/source/Key.cpp +++ b/3rdParty/Radon/Radon/source/Key.cpp @@ -44,4 +44,4 @@ namespace radon { this->value = value; } -} \ No newline at end of file +} diff --git a/3rdParty/Radon/Radon/source/Named.cpp b/3rdParty/Radon/Radon/source/Named.cpp index d6b26f27f..f2853ba15 100644 --- a/3rdParty/Radon/Radon/source/Named.cpp +++ b/3rdParty/Radon/Radon/source/Named.cpp @@ -26,4 +26,4 @@ namespace radon { return name; } -} \ No newline at end of file +} diff --git a/3rdParty/Radon/Radon/source/Section.cpp b/3rdParty/Radon/Radon/source/Section.cpp index 2f2145528..1de7772a7 100644 --- a/3rdParty/Radon/Radon/source/Section.cpp +++ b/3rdParty/Radon/Radon/source/Section.cpp @@ -17,21 +17,19 @@ namespace radon { } - - Key Section::getKey(const std::string & name) + Key *Section::getKey(const std::string & name) { - for each (auto var in keys) + for (auto & key : keys) { - if (var.getName() == name) - return var; + if (key.getName() == name) + return &key; } - assert(1); + return nullptr; } - - void Section::addKey(Key & variable) + void Section::addKey(Key key) { - keys.push_back(variable); + keys.push_back(key); } -} \ No newline at end of file +}