Imported Upstream version 0.9.2
[platform/upstream/iotivity.git] / service / resource-encapsulation / src / common / primitiveResource / src / ResponseStatement.cpp
1 //******************************************************************
2 //
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 #include <ResponseStatement.h>
22
23 #include <ResourceAttributesConverter.h>
24
25 namespace OIC
26 {
27     namespace Service
28     {
29         ResponseStatement ResponseStatement::create(const OC::OCRepresentation& ocRepresentation)
30         {
31             return ResponseStatement::create(
32                     ResourceAttributesConverter::fromOCRepresentation(ocRepresentation));
33         }
34
35         ResponseStatement ResponseStatement::create(RCSResourceAttributes&& attrs)
36         {
37             return ResponseStatement(std::move(attrs));
38         }
39
40         ResponseStatement::ResponseStatement(const RCSResourceAttributes& attrs) :
41                 m_attrs{ attrs }
42         {
43         }
44
45         ResponseStatement::ResponseStatement(RCSResourceAttributes&& attrs) :
46                 m_attrs{ std::move(attrs) }
47         {
48         }
49
50         ResponseStatement::ResponseStatement(RCSResourceAttributes&& attrs, std::string&& uri,
51                 std::vector< std::string >&& resourceTypes,
52                 std::vector< std::string >&& resourceInterfaces) :
53                 m_attrs{ std::move(attrs) },
54                 m_uri{ std::move(uri) },
55                 m_resourceTypes { std::move(resourceTypes) },
56                 m_resourceInterfaces{ std::move(resourceInterfaces) }
57         {
58         }
59
60         std::string ResponseStatement::getUri() const
61         {
62             return m_uri;
63         }
64
65         std::vector< std::string > ResponseStatement::getResourceTypes() const
66         {
67             return m_resourceTypes;
68         }
69
70         std::vector< std::string > ResponseStatement::getResourceInterfaces() const
71         {
72             return m_resourceInterfaces;
73         }
74
75         const RCSResourceAttributes& ResponseStatement::getAttributes() const
76         {
77             return m_attrs;
78         }
79
80     }
81 }
82