01fdff1220ce5c43a8a5016f12b37d2b1985d43f
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / image-loader / image-url.h
1 #ifndef DALI_TOOLKIT_IMAGE_URL_H
2 #define DALI_TOOLKIT_IMAGE_URL_H
3
4 /*
5  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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 // EXTERNAL INCLUDES
21 #include <string>
22 #include <dali/public-api/rendering/texture.h>
23
24 // INTERNAL INCLUDES
25 #include <dali-toolkit/public-api/dali-toolkit-common.h>
26
27 namespace Dali
28 {
29 namespace Toolkit
30 {
31 namespace Internal DALI_INTERNAL
32 {
33 class ImageUrl;
34 }
35 /**
36  * @brief ImageUrl is a class for wrapping url that is get from external buffer.
37  * An instance of ImageUrl can be created from GenerateUrl().
38  * Application can get the ImageUrl at this time and use it by getting url from ImageUrl.
39  * When application does not use this anymore, the destructor of the ImageUrl is called.
40  * At this time, the buffer is deleted from the texture manager.
41  */
42 class DALI_TOOLKIT_API ImageUrl : public BaseHandle
43 {
44 public:
45   /**
46    * Default Constructor.
47    * Resulting URL is not valid
48    */
49   ImageUrl();
50
51   /**
52    * Destructor
53    */
54   ~ImageUrl();
55
56   /**
57    * @brief Create an initialized ImageUrl.
58    *
59    * @param[in] texture The texture url is got from external buffer.
60    * @return A handle to a newly allocated Dali resource.
61    */
62   static ImageUrl New(Texture& texture);
63
64   /**
65    * @brief Downcast an Object handle to ImageUrl handle.
66    *
67    * If handle points to a ImageUrl object the downcast produces valid
68    * handle. If not the returned handle is left uninitialized.
69    *
70    * @param[in] handle to An object.
71    * @return handle to a ImageUrl object or an uninitialized handle.
72    */
73   static ImageUrl DownCast(BaseHandle handle);
74
75   /**
76    * Copy constructor
77    * @param[in] url The url to copy
78    */
79   ImageUrl(const ImageUrl& url);
80
81   /**
82    * Assignment operator
83    * @param[in] url The url to copy
84    */
85   ImageUrl& operator=(const ImageUrl& url);
86
87   /**
88    * @brief Move constructor.
89    * @param[in] rhs A reference to the moved handle
90    */
91   ImageUrl(ImageUrl&& rhs);
92
93   /**
94    * @brief Move assignment operator.
95    * @param[in] rhs A reference to the moved handle
96    * @return A reference to this handle
97    */
98   ImageUrl& operator=(ImageUrl&& rhs);
99
100   /**
101    * Get the url
102    * @return Returns url's string
103    */
104   const std::string& GetUrl() const;
105
106 public: // Not intended for application developers
107   /// @cond internal
108   /**
109    * @brief This constructor is used by New() methods.
110    *
111    * @param[in] internal A pointer to a newly allocated Dali resource.
112    */
113   explicit DALI_INTERNAL ImageUrl(Toolkit::Internal::ImageUrl* internal);
114   /// @endcond
115 };
116
117 } // namespace Toolkit
118
119 } // namespace Dali
120
121 #endif /* DALI_TOOLKIT_IMAGE_URL_H */