You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

38 lines
911 B

#ifndef WEBRESOURCE_H
#define WEBRESOURCE_H
#include <string>
#include <map>
#include "URL.h"
#include "networking/HTTPResponse.h"
#include <functional>
enum class ResourceType {
INVALID,
HTML,
CSS,
JS,
TXT
};
struct WebResource {
WebResource();
WebResource(ResourceType rtype, std::string const& rraw);
ResourceType resourceType;
std::string raw;
static std::function<void(const HTTPResponse&)> responseCallback;
};
// Depending on the resourceName specified, this function will forward the call
// to either getLocalWebResource or getOnlineWebResource.
WebResource getWebResource(URL const& url);
// Loads a resource from the local file storage.
WebResource getLocalWebResource(URL const& url);
// Loads a resource from an internet address.
WebResource getOnlineWebResource(URL const& url, std::unique_ptr<std::map<std::string, std::string>> formData);
#endif