Merge branch 'master' of git.c3d2.de:sic++

master
blastmaster 9 years ago
commit 9a8fb2f600

@ -23,6 +23,8 @@ public:
return me;
}
static int event_route(struct mg_event *event)
{
// Foohash fh;
@ -43,12 +45,16 @@ public:
}
std::string const & get_baseurl()const{return _baseurl;}
void set_baseurl(std::string baseurl);
std::string const & get_persist_path() const { return perists_path;}
private:
explicit Routerin();
std::unique_ptr<StaticFileHandler> sfh;
DynamicObjects * _dyn_obs;
std::string _baseurl;
std::string perists_path;
bool hasInstance = false;
int event_request_route ( struct mg_event *event);

@ -7,6 +7,7 @@
#include <cstring>
#include <iostream>
#include <vector>
#include "Routerin.H"
#include "sicccobject.H"
@ -101,37 +102,28 @@ static std::string get_json_string_representation(const json_t *j)
class SicccPersister
{
public:
SicccPersister()
SicccPersister(const Routerin & merouter = *Routerin::get_instance()) :
merouter(merouter)
{
root = json_object();
perists_path = "./";
json_file_name = "foo.json"; // not the best default
};
SicccPersister(const Sicccobject& so)
SicccPersister(const Sicccobject& so,const Routerin &merouter = * Routerin::get_instance()):
merouter(merouter)
{
root = get_json_from_sicccobject(so);
perists_path = "./";
perists_path =
json_file_name = so.get_filename();
}
SicccPersister(json_t *j)
SicccPersister(json_t *j, const Routerin & merouter =* Routerin::get_instance())
{
root = json_object();
json_object_update(root, j);
}
/*TODO
* clean up path handling
*/
SicccPersister(const std::string& jsonfilename,
const std::string& storepath
) : perists_path(storepath), json_file_name(jsonfilename)
{
root = load_json(std::string(perists_path + json_file_name));
assert(root);
}
~SicccPersister()
{
if (root)
@ -160,8 +152,9 @@ class SicccPersister
}
private:
std::string perists_path;
std::string json_file_name;
const Routerin & merouter;
/* std::string perists_path;
std::string json_file_name; */
json_t *root;
std::string

Loading…
Cancel
Save