PhmsResponseHead.cpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #include "PhmsResponseHead.h"
  2. CPhmsResponseHead::CPhmsResponseHead(void)
  3. {
  4. }
  5. CPhmsResponseHead::CPhmsResponseHead(string stringPhmsResponseHead)
  6. {
  7. this->m_stringSign = stringPhmsResponseHead.substr(0, SIGN_LENGTH);
  8. this->m_stringVersion = stringPhmsResponseHead.substr(SIGN_LENGTH, VERSION_LENGTH);
  9. this->m_stringReturnCode = stringPhmsResponseHead.substr(SIGN_LENGTH+VERSION_LENGTH, RETURNCODE_LENGTH);
  10. this->m_stringMessageFormat = stringPhmsResponseHead.substr(SIGN_LENGTH+VERSION_LENGTH+RETURNCODE_LENGTH, MESSAGEFORMAT_LENGTH);
  11. }
  12. CPhmsResponseHead::CPhmsResponseHead(string stringSign, string stringVersion, string stringReturnCode, string stringMessageFormat)
  13. {
  14. this->m_stringSign = stringSign;
  15. this->m_stringVersion = stringVersion;
  16. this->m_stringReturnCode = stringReturnCode;
  17. this->m_stringMessageFormat = stringMessageFormat;
  18. }
  19. CPhmsResponseHead::CPhmsResponseHead(CPhmsResponseHead& phmsResponseHead)
  20. {
  21. this->m_stringSign = phmsResponseHead.m_stringSign;
  22. this->m_stringVersion = phmsResponseHead.m_stringVersion;
  23. this->m_stringReturnCode = phmsResponseHead.m_stringReturnCode;
  24. this->m_stringMessageFormat = phmsResponseHead.m_stringMessageFormat;
  25. }
  26. CPhmsResponseHead& CPhmsResponseHead::operator=(CPhmsResponseHead& phmsResponseHead)
  27. {
  28. this->m_stringSign = phmsResponseHead.m_stringSign;
  29. this->m_stringVersion = phmsResponseHead.m_stringVersion;
  30. this->m_stringReturnCode = phmsResponseHead.m_stringReturnCode;
  31. this->m_stringMessageFormat = phmsResponseHead.m_stringMessageFormat;
  32. return *this;
  33. }
  34. CPhmsResponseHead::~CPhmsResponseHead(void)
  35. {
  36. }
  37. //Getter
  38. string CPhmsResponseHead::GetSign()
  39. {
  40. return this->m_stringSign;
  41. }
  42. string CPhmsResponseHead::GetVersion()
  43. {
  44. return this->m_stringVersion;
  45. }
  46. string CPhmsResponseHead::GetReturnCode()
  47. {
  48. return this->m_stringReturnCode;
  49. }
  50. string CPhmsResponseHead::GetMessageFormat()
  51. {
  52. return this->m_stringMessageFormat;
  53. }
  54. //Setter
  55. void CPhmsResponseHead::SetSign(string stringSign)
  56. {
  57. this->m_stringSign = stringSign;
  58. }
  59. void CPhmsResponseHead::SetVersion(string stringVersion)
  60. {
  61. this->m_stringVersion = stringVersion;
  62. }
  63. void CPhmsResponseHead::SetReturnCode(string stringReturnCode)
  64. {
  65. this->m_stringReturnCode = stringReturnCode;
  66. }
  67. void CPhmsResponseHead::SetMessageFormat(string stringMessageFormat)
  68. {
  69. this->m_stringMessageFormat = stringMessageFormat;
  70. }
  71. EnumPhmsResponseMessageFormat CPhmsResponseHead::GetPhmsResponseMessageFormat()
  72. {
  73. if(this->m_stringMessageFormat == "10")
  74. {
  75. return NO_PHMS_RESPONSE_BODY;
  76. }
  77. if(this->m_stringMessageFormat == "11")
  78. {
  79. return XML_PHMS_RESPONSE_BODY;
  80. }
  81. if(this->m_stringMessageFormat == "12")
  82. {
  83. return FILE_OR_ECHORSTRING_PHMS_RESPONSE_BODY;
  84. }
  85. if(this->m_stringMessageFormat == "13")
  86. {
  87. return JSON_PHMS_RESPONSE_BODY;
  88. }
  89. return WRONG_PHMS_RESPONSE_MESSAGE_FORMAT;
  90. }
  91. EnumPhmsResponseReturnCode CPhmsResponseHead::GetPhmsResponseReturnCode()
  92. {
  93. if(this->m_stringReturnCode == "100000")
  94. {
  95. return SUCCESS_RETURN_CODE;
  96. }
  97. return FAIL_RETURN_CODE;
  98. }
  99. int CPhmsResponseHead::GetPhmsResposeHeadTotalLength()
  100. {
  101. return TOTAL_HEAD_LENGTH;
  102. }
  103. void CPhmsResponseHead::SetPhmsResponseHead(string stringPhmsResponseHead)
  104. {
  105. this->m_stringSign = stringPhmsResponseHead.substr(0, SIGN_LENGTH);
  106. this->m_stringVersion = stringPhmsResponseHead.substr(SIGN_LENGTH, VERSION_LENGTH);
  107. this->m_stringReturnCode = stringPhmsResponseHead.substr(SIGN_LENGTH+VERSION_LENGTH, RETURNCODE_LENGTH);
  108. this->m_stringMessageFormat = stringPhmsResponseHead.substr(SIGN_LENGTH+VERSION_LENGTH+RETURNCODE_LENGTH, MESSAGEFORMAT_LENGTH);
  109. }