1 /*
2  * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_ACELITE_RESPONSE_DATA_H
17 #define OHOS_ACELITE_RESPONSE_DATA_H
18 
19 #include <map>
20 #include <string>
21 
22 namespace OHOS {
23 namespace ACELite {
24 class ResponseData {
25 public:
26     ResponseData();
27 
28     void SetCode(int32_t codePara);
29 
30     void SetErrString(const std::string &err);
31 
32     void ParseHeaders(const std::string &headersStr);
33 
34     void AppendData(const char *dataPara, size_t size);
35 
36     [[nodiscard]] int32_t GetCode() const;
37 
38     [[nodiscard]] const std::string &GetErrString() const;
39 
40     [[nodiscard]] const std::string &GetData() const;
41 
42     [[nodiscard]] const std::string &GetStatusLine() const;
43 
44     [[nodiscard]] const std::map<std::string, std::string> &GetHeaders() const;
45 
46 private:
47     int32_t code;
48     std::string data;
49     std::string statusLine;
50     std::string errString;
51     std::map<std::string, std::string> headers;
52 };
53 } // namespace ACELite
54 } // namespace OHOS
55 
56 #endif /* OHOS_ACELITE_RESPONSE_DATA_H */
57