HttpRequest.pkg 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. $#include "HttpRequest.h"
  2. enum HttpRequestState
  3. {
  4. HTTP_INITIALIZING,
  5. HTTP_ERROR,
  6. HTTP_OPEN,
  7. HTTP_CLOSED
  8. };
  9. class HttpRequest : public Deserializer
  10. {
  11. const String GetURL() const;
  12. const String GetVerb() const;
  13. String GetError() const;
  14. HttpRequestState GetState() const;
  15. unsigned GetAvailableSize() const;
  16. bool IsOpen() const;
  17. tolua_readonly tolua_property__get_set String URL;
  18. tolua_readonly tolua_property__get_set String verb;
  19. tolua_readonly tolua_property__get_set String error;
  20. tolua_readonly tolua_property__get_set HttpRequestState state;
  21. tolua_readonly tolua_property__get_set unsigned availableSize;
  22. tolua_readonly tolua_property__is_set bool open;
  23. };
  24. class SharedPtr : public T
  25. {
  26. TOLUA_TEMPLATE_BIND(T, HttpRequest)
  27. SharedPtr();
  28. ~SharedPtr();
  29. bool Null() const;
  30. bool NotNull() const;
  31. int Refs() const;
  32. };
  33. $renaming SharedPtr<HttpRequest> @ HttpRequestSPtr
  34. ${
  35. static void* tolua_tourho3dhttprequest(lua_State* L, int reg, void* def)
  36. {
  37. void* userdata = tolua_tousertype(L, reg, def);
  38. const char* type = tolua_typename(L, reg);
  39. if (strcmp(type, "HttpRequest") == 0)
  40. return userdata;
  41. return *static_cast<SharedPtr<HttpRequest>*>(userdata);
  42. }
  43. $}