Ensure BaseHandle class move noexcept (adaptor public-api)
[platform/core/uifw/dali-adaptor.git] / dali / public-api / adaptor-framework / encoded-image-buffer.h
1 #ifndef DALI_ENCODED_IMAGE_BUFFER_H
2 #define DALI_ENCODED_IMAGE_BUFFER_H
3 /*
4  * Copyright (c) 2023 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 // EXTERNAL INCLUDES
21 #include <dali/public-api/common/dali-vector.h>
22 #include <dali/public-api/object/base-handle.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/dali-adaptor-common.h>
26
27 namespace Dali
28 {
29 namespace Internal DALI_INTERNAL
30 {
31 class EncodedImageBuffer;
32 }
33
34 /**
35  * @brief EncodedImageBuffer contains the large encoded raw buffer informations.
36  *
37  * @SINCE_2_0.34
38  * @note Object will copy raw buffer data.
39  */
40 class DALI_ADAPTOR_API EncodedImageBuffer : public BaseHandle
41 {
42 public:
43   using RawBufferType = Dali::Vector<uint8_t>;
44
45 public:
46   /**
47    * @brief Create a new EncodedImageBuffer.
48    *
49    * @SINCE_2_0.34
50    * @param [in] buffer The encoded raw buffer
51    * @return A handle to a new EncodedImageBuffer.
52    */
53   static EncodedImageBuffer New(const RawBufferType& buffer);
54
55   /**
56    * @brief Create an empty handle.
57    *
58    * @SINCE_2_0.34
59    * Calling member functions of an empty handle is not allowed.
60    */
61   EncodedImageBuffer();
62
63   /**
64    * @brief Destructor.
65    *
66    * This is non-virtual since derived Handle types must not contain data or virtual methods.
67    * @SINCE_2_0.34
68    */
69   ~EncodedImageBuffer();
70
71   /**
72    * @brief This copy constructor is required for (smart) pointer semantics.
73    *
74    * @SINCE_2_0.34
75    * @param [in] handle A reference to the copied handle
76    */
77   EncodedImageBuffer(const EncodedImageBuffer& handle);
78
79   /**
80    * @brief This assignment operator is required for (smart) pointer semantics.
81    *
82    * @SINCE_2_0.34
83    * @param [in] handle  A reference to the copied handle
84    * @return A reference to this
85    */
86   EncodedImageBuffer& operator=(const EncodedImageBuffer& handle);
87
88   /**
89    * @brief This move constructor is required for (smart) pointer semantics.
90    *
91    * @SINCE_2_0.34
92    * @param [in] handle A reference to the moved handle
93    */
94   EncodedImageBuffer(EncodedImageBuffer&& handle) noexcept;
95
96   /**
97    * @brief This move assignment operator is required for (smart) pointer semantics.
98    *
99    * @SINCE_2_0.34
100    * @param [in] handle  A reference to the moved handle
101    * @return A reference to this
102    */
103   EncodedImageBuffer& operator=(EncodedImageBuffer&& handle) noexcept;
104
105   /**
106    * @brief Get raw buffer data
107    *
108    * @SINCE_2_0.34
109    * @note this method return const value. Mean, you cannot change raw buffer
110    * @return A RawBufferType this buffer have
111    */
112   const RawBufferType& GetRawBuffer() const;
113
114   /**
115    * @brief Get the hash value of raw buffer
116    *
117    * @SINCE_2_1.20
118    * @return A hash value of raw buffer.
119    */
120   const std::size_t GetHash() const;
121
122 public: // Not intended for developer use
123   explicit DALI_INTERNAL EncodedImageBuffer(Internal::EncodedImageBuffer* impl);
124 };
125
126 } // namespace Dali
127
128 #endif // DALI_ENCODED_IMAGE_BUFFER_H