Large refactoring. Also, reimplemented resource manager to use parsers. Changed from json to xml (it allows comments!!!).

This commit is contained in:
2016-12-01 21:08:28 +02:00
parent 9c8cbf8518
commit 0b6a988184
71 changed files with 1608 additions and 923 deletions

View File

@@ -0,0 +1,43 @@
/*
* S.cpp
*
* Created on: Dec 1, 2016
* Author: tibi
*/
#include <utils/DumpPropertyTree.h>
#include <iostream>
#include <boost/algorithm/string.hpp>
namespace farmlands {
namespace utils {
void dumpPropertyTreeInternal(boost::property_tree::ptree& tree, unsigned level)
{
for (auto child : tree)
{
for (unsigned i = 0; i < level; i++)
std::cout << " ";
std::string data = child.second.data();
boost::trim(data);
std::cout<< "* " << child.first <<" = " << data << "\n";
dumpPropertyTreeInternal(child.second, level + 1);
}
}
void dumpPropertyTree(boost::property_tree::ptree& tree)
{
std::string data = tree.data();
boost::trim(data);
std::cout << "[root] = " << data << "\n";
dumpPropertyTreeInternal(tree, 1);
}
} /* namespace utils */
} /* namespace farmlands */

View File

@@ -0,0 +1,21 @@
/*
* S.h
*
* Created on: Dec 1, 2016
* Author: tibi
*/
#ifndef UTILS_DUMPPROPERTYTREE_H_
#define UTILS_DUMPPROPERTYTREE_H_
#include <boost/property_tree/ptree.hpp>
namespace farmlands {
namespace utils {
void dumpPropertyTree(boost::property_tree::ptree& tree);
} /* namespace utils */
} /* namespace farmlands */
#endif /* UTILS_DUMPPROPERTYTREE_H_ */

View File

@@ -36,7 +36,9 @@ Exception::~Exception()
}
DEFINE_EXCEPTION_CPP(InvalidArgumentException, Exception)
DEFINE_EXCEPTION_CPP(InvalidArgumentException, Exception);
DEFINE_EXCEPTION_CPP(NotImplementedException, Exception);
DEFINE_EXCEPTION_CPP(IOException, Exception);
DEFINE_EXCEPTION_CPP(ResourceLoadException, IOException);

View File

@@ -65,8 +65,10 @@ namespace utils {
// Common exceptions
DEFINE_EXCEPTION_CLASS(InvalidArgumentException, Exception);
DEFINE_EXCEPTION_CLASS(NotImplementedException, Exception);
// IO Exceptions
DEFINE_EXCEPTION_CLASS(IOException, Exception);
DEFINE_EXCEPTION_CLASS(ResourceLoadException, IOException);