#include <simgear/structure/SGSharedPtr.hxx>
#include <simgear/math/sg_types.hxx>
+#include <boost/bind.hpp>
#include <boost/function.hpp>
class SGPropertyNode;
*/
Request* done(const Callback& cb);
+ template<class C>
+ Request* done(C* instance, void (C::*mem_func)(Request*))
+ {
+ return done(boost::bind(mem_func, instance, _1));
+ }
+
/**
* Set the handler to be called when the request completes or aborts with an
* error.
*/
Request* fail(const Callback& cb);
+ template<class C>
+ Request* fail(C* instance, void (C::*mem_func)(Request*))
+ {
+ return fail(boost::bind(mem_func, instance, _1));
+ }
+
/**
* Set the handler to be called when the request either successfully
* completes or fails.
*/
Request* always(const Callback& cb);
+ template<class C>
+ Request* always(C* instance, void (C::*mem_func)(Request*))
+ {
+ return always(boost::bind(mem_func, instance, _1));
+ }
+
/**
* Set the data for the body of the request. The request is automatically
* send using the POST method.
StringMap const& responseHeaders() const
{ return _responseHeaders; }
+ std::string responseMime() const;
+
virtual int responseCode() const
{ return _responseStatus; }
virtual void onFail();
virtual void onAlways();
+ void setFailure(int code, const std::string& reason);
+
private:
friend class Client;
friend class Connection;
Request& operator=(const Request&); // = delete;
void processBodyBytes(const char* s, int n);
- void setFailure(int code, const std::string& reason);
void setReadyState(ReadyState state);
std::string _method;