Browse Source

Update 3rdParty/Radon

From 9203ff8b02
pull/1205/head
Gleb Mazovetskiy 5 years ago committed by Anders Jenbo
parent
commit
7ddabe188a
  1. 2
      3rdParty/Radon/Radon/include/File.hpp
  2. 2
      3rdParty/Radon/Radon/include/Key.hpp
  3. 2
      3rdParty/Radon/Radon/include/Named.hpp
  4. 2
      3rdParty/Radon/Radon/include/Radon.hpp
  5. 2
      3rdParty/Radon/Radon/include/Section.hpp
  6. 20
      3rdParty/Radon/Radon/source/File.cpp
  7. 15
      3rdParty/Radon/Radon/source/Key.cpp
  8. 2
      3rdParty/Radon/Radon/source/Named.cpp
  9. 12
      3rdParty/Radon/Radon/source/Section.cpp

2
3rdParty/Radon/Radon/include/File.hpp vendored

@ -26,4 +26,4 @@ namespace radon
std::vector<Section> sections;
std::string path;
};
}
}

2
3rdParty/Radon/Radon/include/Key.hpp vendored

@ -32,4 +32,4 @@ namespace radon
friend class File;
};
}
}

2
3rdParty/Radon/Radon/include/Named.hpp vendored

@ -21,4 +21,4 @@ namespace radon
protected:
std::string name;
};
}
}

2
3rdParty/Radon/Radon/include/Radon.hpp vendored

@ -6,4 +6,4 @@
#include "Key.hpp"
#include "Named.hpp"
#include "Radon.hpp"
#include "Section.hpp"
#include "Section.hpp"

2
3rdParty/Radon/Radon/include/Section.hpp vendored

@ -29,4 +29,4 @@ namespace radon
friend class File;
};
}
}

20
3rdParty/Radon/Radon/source/File.cpp vendored

@ -15,7 +15,7 @@ namespace radon
this->path = path;
if (reading)
{
std::ifstream stream(path);
std::ifstream stream(path.c_str());
if (stream.is_open())
{
@ -47,15 +47,15 @@ namespace radon
Section *File::getSection(const std::string & name)
{
for (auto & section : sections)
for (int i = 0; i < (int)sections.size(); i++)
{
if (section.getName() == name)
if (sections[i].getName() == name)
{
return &section;
return &sections[i];
}
}
return nullptr;
return NULL;
}
@ -69,14 +69,14 @@ namespace radon
{
std::ofstream file(path.data(), std::ios::out | std::ios::trunc);
for (auto & section : sections)
for (int i = 0; i < (int)sections.size(); i++)
{
file << "[" << section.getName() << "] \n";
for (auto & key : section.keys)
file << "[" << sections[i].getName() << "] \n";
for(int j = 0; j < (int)sections[i].keys.size(); j++)
{
file << key.getName() << "=" << key.getStringValue() << "\n";
file << sections[i].keys[j].getName() << "=" << sections[i].keys[j].getStringValue() << "\n";
}
}
file.close();
}
}
}

15
3rdParty/Radon/Radon/source/Key.cpp vendored

@ -1,6 +1,15 @@
// Copyright Dmitro bjornus Szewczuk 2017
#include "../include/Radon.hpp"
#include <sstream>
std::string Float2String(float fVal)
{
std::ostringstream ss;
ss << fVal;
std::string s(ss.str());
return s;
}
namespace radon
{
@ -17,7 +26,7 @@ namespace radon
Key::Key(const std::string & name, const float & value)
: Named(name), value(std::to_string(value))
: Named(name), value(Float2String(value))
{
}
@ -36,7 +45,7 @@ namespace radon
void Key::setValue(float & value)
{
this->value = std::to_string(value);
this->value = Float2String(value);
}
@ -44,4 +53,4 @@ namespace radon
{
this->value = value;
}
}
}

2
3rdParty/Radon/Radon/source/Named.cpp vendored

@ -26,4 +26,4 @@ namespace radon
{
return name;
}
}
}

12
3rdParty/Radon/Radon/source/Section.cpp vendored

@ -17,19 +17,21 @@ namespace radon
{
}
Key *Section::getKey(const std::string & name)
{
for (auto & key : keys)
for (int i = 0; i < (int)keys.size(); i++)
{
if (key.getName() == name)
return &key;
if (keys[i].getName() == name)
return &keys[i];
}
return nullptr;
return NULL;
}
void Section::addKey(Key key)
{
keys.push_back(key);
}
}
}
Loading…
Cancel
Save