request.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #include "request.h"
  2. #include <client.h>
  3. #include <stdexcept>
  4. #define LOGIN_ERROR "You must login first."
  5. using std::runtime_error;
  6. create_request::create_request()
  7. {
  8. }
  9. create_request::~create_request()
  10. {
  11. }
  12. bool create_request::get_logged_in()
  13. {
  14. return client_::logged_in;
  15. }
  16. void create_request::set_logged_in(bool value)
  17. {
  18. client_::logged_in = value;
  19. }
  20. bool create_request::get_cmd_issued()
  21. {
  22. return client_::cmd_issued;
  23. }
  24. void create_request::set_cmd_issued(bool value)
  25. {
  26. client_::cmd_issued = value;
  27. }
  28. string create_request::get_username()
  29. {
  30. return *client_::username;
  31. }
  32. void create_request::set_username(string username)
  33. {
  34. *client_::username = username;
  35. }
  36. unsigned long create_request::get_session_key()
  37. {
  38. return client_::session_key;
  39. }
  40. void create_request::set_session_key(unsigned long session_key)
  41. {
  42. client_::session_key = session_key;
  43. }
  44. void create_request::throw_login_error()
  45. {
  46. throw runtime_error(LOGIN_ERROR);
  47. }
  48. request create_request::generate(istringstream *stream)
  49. {
  50. check();
  51. return create(stream);
  52. }