Add to Null checking log in IsSameEowner
[platform/upstream/iotivity.git] / resource / include / OCResourceResponse.h
index 6305a7c..754f1ac 100644 (file)
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-/// @file OCResourceResponse.h
+/**
+ * @file
+ *
+ * This file contains the declaration of classes and its members related to
+ * ResourceResponse.
+ */
 
-/// @brief  This file contains the declaration of classes and its members related to
-///         ResourceResponse.
-
-#ifndef __OCRESOURCERESPONSE_H
-#define __OCRESOURCERESPONSE_H
+#ifndef OC_RESOURCERESPONSE_H_
+#define OC_RESOURCERESPONSE_H_
 
 #include "OCApi.h"
 #include <IServerWrapper.h>
 #include <ocstack.h>
 #include <OCRepresentation.h>
 
-using namespace std;
-
 namespace OC
 {
     class InProcServerWrapper;
@@ -51,14 +51,39 @@ namespace OC
             m_headerOptions{},
             m_interface{},
             m_representation{},
-            m_requestHandle{nullptr},
+            m_requestHandle{0},
             m_resourceHandle{nullptr},
             m_responseResult{}
         {
         }
 
+#if defined(_MSC_VER) && (_MSC_VER < 1900)
+        OCResourceResponse(OCResourceResponse&& o):
+            m_newResourceUri(std::move(o.m_newResourceUri)),
+            m_errorCode(o.m_errorCode),
+            m_headerOptions(std::move(o.m_headerOptions)),
+            m_interface(std::move(o.m_interface)),
+            m_representation(std::move(o.m_representation)),
+            m_requestHandle(std::move(o.m_requestHandle)),
+            m_resourceHandle(std::move(o.m_resourceHandle)),
+            m_responseResult(std::move(o.m_responseResult))
+        {
+        }
+        OCResourceResponse& operator=(OCResourceResponse&& o)
+        {
+            m_newResourceUri = std::move(o.m_newResourceUri);
+            m_errorCode = o.m_errorCode;
+            m_headerOptions = std::move(o.m_headerOptions);
+            m_interface = std::move(o.m_interface);
+            m_representation = std::move(o.m_representation);
+            m_requestHandle = std::move(o.m_requestHandle);
+            m_resourceHandle = std::move(o.m_resourceHandle);
+            m_responseResult = std::move(o.m_responseResult);
+        }
+#else
         OCResourceResponse(OCResourceResponse&&) = default;
         OCResourceResponse& operator=(OCResourceResponse&&) = default;
+#endif
         virtual ~OCResourceResponse(void) {}
 
         /**
@@ -126,29 +151,26 @@ namespace OC
 
         /**
         *  API to set the entire resource attribute representation
-        *  @param attributeMap reference containing the name value pairs representing
-        *         the resource's attributes
+        *  @param rep reference to the resource's representation
         *  @param interface specifies the interface
         */
-        void setResourceRepresentation(OCRepresentation& rep, std::string interface) {
-            m_interface = interface;
+        void setResourceRepresentation(OCRepresentation& rep, std::string iface) {
+            m_interface = iface;
             m_representation = rep;
         }
 
         /**
         *  API to set the entire resource attribute representation
-        *  @param attributeMap rvalue reference containing the name value pairs representing
-        *         the resource's attributes
+        *  @param rep rvalue reference to the resource's representation
         *  @param interface specifies the interface
         */
-        void setResourceRepresentation(OCRepresentation&& rep, std::string interface) {
-            setResourceRepresentation(rep, interface);
+        void setResourceRepresentation(OCRepresentation&& rep, std::string iface) {
+            setResourceRepresentation(rep, iface);
         }
 
         /**
         *  API to set the entire resource attribute representation
-        *  @param attributeMap reference containing the name value pairs representing the resource's
-        *  attributes
+        *  @param rep reference to the resource's representation
         */
         void setResourceRepresentation(OCRepresentation& rep) {
             // Call the default
@@ -158,8 +180,7 @@ namespace OC
 
         /**
         *  API to set the entire resource attribute representation
-        *  @param attributeMap rvalue reference containing the name value pairs representing the
-        *  resource's attributes
+        *  @param rep rvalue reference to the resource's representation
         */
         void setResourceRepresentation(OCRepresentation&& rep) {
             // Call the above function
@@ -178,7 +199,7 @@ namespace OC
     private:
         friend class InProcServerWrapper;
 
-        std::string getPayload() const
+        OCRepPayload* getPayload() const
         {
             MessageContainer inf;
             OCRepresentation first(m_representation);
@@ -219,14 +240,17 @@ namespace OC
 
             }
 
-            return inf.getJSONRepresentation(OCInfoFormat::ExcludeOC);
+            return inf.getPayload();
         }
     public:
 
         /**
         * Get error code
         */
-        int getErrorCode() const;
+        int getErrorCode() const
+        {
+            return m_errorCode;
+        }
 
         /**
          * Get the Response Representation
@@ -268,7 +292,7 @@ namespace OC
         *
         * @return OCEntityHandler result value
         */
-        const OCEntityHandlerResult getResponseResult() const
+        OCEntityHandlerResult getResponseResult() const
         {
             return m_responseResult;
         }
@@ -276,4 +300,4 @@ namespace OC
 
 } // namespace OC
 
-#endif //__OCRESOURCERESPONSE_H
+#endif // OC_RESOURCERESPONSE_H_