23 #ifndef CLOE_UTILITY_RESOURCE_HANDLER_HPP_ 24 #define CLOE_UTILITY_RESOURCE_HANDLER_HPP_ 36 #define RESOURCE_HANDLER(resource, ct) ::cloe::utility::ResourceHandler(RESOURCE(resource), ct) 37 #define RESOURCE_LOADER(resource) ::cloe::utility::ResourceLoader(RESOURCE(resource)) 51 std::string to_string()
const {
54 std::ifstream ifs{res_.filepath()};
57 data =
static_cast<std::stringstream const&
>(std::stringstream() << ifs.rdbuf()).str();
59 logger::get(
"cloe")->warn(
"File does not exist: {}", res_.filepath());
60 data = res_.to_string();
64 return res_.to_string();
91 j = fable::parse_json(c.to_string());
92 }
catch (cloe::Json::type_error& e) {
93 j = {c.res_.filepath(), c.to_string()};
100 #endif // CLOE_UTILITY_RESOURCE_HANDLER_HPP_ Definition: handler.hpp:197
friend void to_json(cloe::Json &j, const ResourceLoader &c)
Definition: resource_handler.hpp:89
Definition: handler.hpp:95
Definition: resource_handler.hpp:74
void set_body(const std::string &s, ContentType type)
Definition: handler.hpp:265
ContentType
Definition: handler.hpp:72
Definition: coordinator.hpp:36
Definition: resource.hpp:55
Definition: resource_handler.hpp:47