OssError.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Copyright 2009-2017 Alibaba Cloud All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #pragma once
  17. #include <string>
  18. #include <alibabacloud/oss/Export.h>
  19. namespace AlibabaCloud
  20. {
  21. namespace OSS
  22. {
  23. class ALIBABACLOUD_OSS_EXPORT OssError
  24. {
  25. public:
  26. OssError() = default;
  27. OssError(const std::string& code, const std::string& message) :
  28. code_(code),
  29. message_(message)
  30. {
  31. }
  32. OssError(const OssError& rhs) :
  33. code_(rhs.code_),
  34. message_(rhs.message_),
  35. requestId_(rhs.requestId_),
  36. host_(rhs.host_)
  37. {
  38. }
  39. OssError(OssError&& lhs) :
  40. code_(std::move(lhs.code_)),
  41. message_(std::move(lhs.message_)),
  42. requestId_(std::move(lhs.requestId_)),
  43. host_(std::move(lhs.host_))
  44. {
  45. }
  46. OssError& operator=(OssError&& lhs)
  47. {
  48. code_ = std::move(lhs.code_);
  49. message_ = std::move(lhs.message_);
  50. requestId_ = std::move(lhs.requestId_);
  51. host_ = std::move(lhs.host_);
  52. return *this;
  53. }
  54. OssError& operator=(const OssError& rhs)
  55. {
  56. code_ = rhs.code_;
  57. message_ = rhs.message_;
  58. requestId_ = rhs.requestId_;
  59. host_ = rhs.host_;
  60. return *this;
  61. }
  62. ~OssError() = default;
  63. const std::string& Code()const { return code_; }
  64. const std::string& Message() const { return message_; }
  65. const std::string& RequestId() const { return requestId_; }
  66. const std::string& Host() const { return host_; }
  67. void setCode(const std::string& value) { code_ = value; }
  68. void setCode(const char *value) { code_ = value; }
  69. void setMessage(const std::string& value) { message_ = value; }
  70. void setMessage(const char *value) { message_ = value; }
  71. void setRequestId(const std::string& value) { requestId_ = value; }
  72. void setRequestId(const char *value) { requestId_ = value; }
  73. void setHost(const std::string& value) { host_ = value; }
  74. void setHost(const char *value) { host_ = value; }
  75. private:
  76. std::string code_;
  77. std::string message_;
  78. std::string requestId_;
  79. std::string host_;
  80. };
  81. }
  82. }