#include <map>
+#include <simgear/structure/function_list.hxx>
#include <simgear/structure/map.hxx>
#include <simgear/structure/SGReferenced.hxx>
#include <simgear/structure/SGSharedPtr.hxx>
#include <simgear/math/sg_types.hxx>
-#include <boost/function.hpp>
+#include <boost/bind.hpp>
class SGPropertyNode;
{ return _request_headers.get(key); }
/**
- * Set the handler to be called when the request successfully completes.
+ * Add a handler to be called when the request successfully completes.
*
* @note If the request is already complete, the handler is called
* immediately.
*/
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
+ * Add a handler to be called when the request completes or aborts with an
* error.
*
* @note If the request has already failed, the handler is called
*/
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.
+ * Add a handler to be called when the request either successfully completes
+ * or fails.
*
* @note If the request is already complete or has already failed, the
* handler is called immediately.
*/
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; }
unsigned int _responseLength;
unsigned int _receivedBodyBytes;
- Callback _cb_done,
- _cb_fail,
- _cb_always;
+ function_list<Callback> _cb_done,
+ _cb_fail,
+ _cb_always;
ReadyState _ready_state;
bool _willClose;