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 
17 #pragma once
18 
19 #include <string>
20 #include <alibabacloud/oss/Export.h>
21 
22 namespace AlibabaCloud
23 {
24 namespace OSS
25 {
26     class ALIBABACLOUD_OSS_EXPORT OssError
27     {
28     public:
29         OssError() = default;
OssError(const std::string & code,const std::string & message)30         OssError(const std::string& code, const std::string& message) :
31             code_(code),
32             message_(message)
33         {
34         }
OssError(const OssError & rhs)35         OssError(const OssError& rhs) :
36             code_(rhs.code_),
37             message_(rhs.message_),
38             requestId_(rhs.requestId_),
39             host_(rhs.host_)
40         {
41         }
OssError(OssError && lhs)42         OssError(OssError&& lhs) :
43             code_(std::move(lhs.code_)),
44             message_(std::move(lhs.message_)),
45             requestId_(std::move(lhs.requestId_)),
46             host_(std::move(lhs.host_))
47         {
48         }
49         OssError& operator=(OssError&& lhs)
50         {
51             code_ = std::move(lhs.code_);
52             message_ = std::move(lhs.message_);
53             requestId_ = std::move(lhs.requestId_);
54             host_ = std::move(lhs.host_);
55             return *this;
56         }
57         OssError& operator=(const OssError& rhs)
58         {
59             code_ = rhs.code_;
60             message_ = rhs.message_;
61             requestId_ = rhs.requestId_;
62             host_ = rhs.host_;
63             return *this;
64         }
65 
66         ~OssError() = default;
Code()67         const std::string& Code()const { return code_; }
Message()68         const std::string& Message() const { return message_; }
RequestId()69         const std::string& RequestId() const { return requestId_; }
Host()70         const std::string& Host() const { return host_; }
setCode(const std::string & value)71         void setCode(const std::string& value) { code_ = value; }
setCode(const char * value)72         void setCode(const char *value) { code_ = value; }
setMessage(const std::string & value)73         void setMessage(const std::string& value) { message_ = value; }
setMessage(const char * value)74         void setMessage(const char *value) { message_ = value; }
setRequestId(const std::string & value)75         void setRequestId(const std::string& value) { requestId_ = value; }
setRequestId(const char * value)76         void setRequestId(const char *value) { requestId_ = value; }
setHost(const std::string & value)77         void setHost(const std::string& value) { host_ = value; }
setHost(const char * value)78         void setHost(const char *value) { host_ = value; }
79     private:
80         std::string code_;
81         std::string message_;
82         std::string requestId_;
83         std::string host_;
84     };
85 }
86 }
87