1 /******************************************************************
\r
3 * Copyright 2015 Samsung Electronics All Rights Reserved.
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
19 ******************************************************************/
\r
24 * @brief This file provides data Model for RAML Response.
\r
33 #include "RequestResponseBody.h"
\r
36 #include "IncludeResolver.h"
\r
42 * @brief This class provides data Model for RAML Response.
\r
48 * This method is for getting Headers from Response.
\r
50 * @return map of headerName and Pointer to Header.
\r
52 virtual std::map<std::string, HeaderPtr> const &getHeaders() const;
\r
55 * This method is for setting Header to Response.
\r
57 * @param headerName - header Name
\r
58 * @param header - pointer to Header Object.
\r
60 virtual void setHeader(const std::string &headerName, const HeaderPtr &header);
\r
63 * This method is for getting Description from Response.
\r
65 * @return Description string.
\r
67 virtual std::string getDescription() const;
\r
70 * This method is for setting Description to Response.
\r
72 * @param description - description string
\r
74 virtual void setDescription(const std::string &description);
\r
77 * This method is for setting ResponseBody to Response.
\r
79 * @param typeName - response body typeName
\r
81 virtual void setResponseBody(const std::string &typeName);
\r
84 * This method is for setting ResponseBody to Response.
\r
86 * @param type - response body typeName
\r
87 * @param body - Pointer to RequestResponseBody
\r
89 virtual void setResponseBody(const std::string &type, const RequestResponseBodyPtr &body) ;
\r
92 * This method is for getting ResponseBody from Response.
\r
94 * @return map of body type and Pointer to RequestResponseBody.
\r
96 virtual std::map<std::string, RequestResponseBodyPtr> const &getResponseBody() const;
\r
99 * This method is for getting ResponseBody from Response.
\r
101 * @param bodyType - response body type
\r
103 * @return Pointer to RequestResponseBody.
\r
105 virtual RequestResponseBodyPtr getResponseBody(const std::string &bodyType);
\r
108 * Constructor of Response.
\r
110 Response() : m_includeResolver(NULL) {}
\r
113 * Constructor of Response.
\r
115 * @param yamlNode - Reference to YamlNode for reading the Response
\r
116 * @param includeResolver - Reference to IncludeResolver for reading external files
\r
119 Response(const YAML::Node &yamlNode,
\r
120 const IncludeResolverPtr &includeResolver): m_includeResolver(includeResolver)
\r
121 { readResponse(yamlNode);}
\r
123 void readResponse(const YAML::Node &yamlNode) ;
\r
125 std::string m_description;
\r
126 std::map<std::string, RequestResponseBodyPtr> m_responseBody;
\r
127 std::map<std::string, HeaderPtr> m_headers;
\r
128 IncludeResolverPtr m_includeResolver;
\r
131 /** ResponsePtr - shared Ptr to Response.*/
\r
132 typedef std::shared_ptr<Response> ResponsePtr;
\r