34 #define RESOURCE_HANDLER(resource, ct) ::cloe::utility::ResourceHandler(RESOURCE(resource), ct)
35 #define RESOURCE_LOADER(resource) ::cloe::utility::ResourceLoader(RESOURCE(resource))
49 std::string to_string()
const {
52 std::ifstream ifs{res_.filepath()};
55 data =
static_cast<std::stringstream const&
>(std::stringstream() << ifs.rdbuf()).str();
57 logger::get(
"cloe")->warn(
"File does not exist: {}", res_.filepath());
58 data = res_.to_string();
62 return res_.to_string();
89 j = fable::parse_json(c.to_string());
90 }
catch (cloe::Json::type_error& e) {
91 j = {c.res_.filepath(), c.to_string()};
Definition: resource.hpp:53
Definition: handler.hpp:94
Definition: handler.hpp:196
void set_body(const std::string &s, ContentType type)
Definition: handler.hpp:264
Definition: resource_handler.hpp:72
Definition: resource_handler.hpp:45
friend void to_json(cloe::Json &j, const ResourceLoader &c)
Definition: resource_handler.hpp:87
ContentType
Definition: handler.hpp:71