Added get/set apis with query params in RCSRemoteResourceObject.
[platform/upstream/iotivity.git] / service / resource-encapsulation / src / serverBuilder / src / RCSRequest.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 "RCSRequest.h"
22
23 #include "OCResourceRequest.h"
24
25 namespace OIC
26 {
27     namespace Service
28     {
29
30         RCSRequest::RCSRequest(const std::shared_ptr< OC::OCResourceRequest >& ocRequest) :
31                 m_ocRequest{ ocRequest }
32         {
33         }
34
35         RCSRequest::RCSRequest(const std::string& resourceUri) :
36                 m_ocRequest{ std::make_shared< OC::OCResourceRequest >() }
37         {
38             m_ocRequest->setResourceUri(resourceUri);
39         }
40
41         std::string RCSRequest::getResourceUri() const
42         {
43             return m_ocRequest->getResourceUri();
44         }
45
46         const std::shared_ptr< OC::OCResourceRequest >& RCSRequest::getOCRequest() const
47         {
48             return m_ocRequest;
49         }
50
51         const std::map< std::string, std::string >& RCSRequest::getQueryParams() const
52         {
53             return m_ocRequest->getQueryParameters();
54         }
55
56         std::string RCSRequest::getInterface() const
57         {
58             const auto& params = m_ocRequest->getQueryParameters();
59
60             auto it = params.find(OC::Key::INTERFACESKEY);
61
62             if (it == params.end()) return "";
63
64             return it->second;
65         }
66     }
67 }