Merge "Add ApplyCustomFragmentPrefix" into devel/master
[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 can be used to wrap an external buffer.
37  *
38  * An instance of ImageUrl can be created from Image::GenerateUrl().
39  * Application can get url from ImageUrl.
40  * When application does not use this anymore, the destructor of the ImageUrl is called.
41  * At this time, the buffer is deleted from the texture manager.
42  */
43 class DALI_TOOLKIT_API ImageUrl : public BaseHandle
44 {
45 public:
46   /**
47    * Default Constructor.
48    * Resulting URL is not valid
49    */
50   ImageUrl();
51
52   /**
53    * Destructor
54    */
55   ~ImageUrl();
56
57   /**
58    * @brief Create an initialized ImageUrl.
59    *
60    * @param[in] texture The texture url is got from external buffer.
61    * @return A handle to a newly allocated Dali resource.
62    */
63   static ImageUrl New(Texture& texture);
64
65   /**
66    * @brief Downcast an Object handle to ImageUrl handle.
67    *
68    * If handle points to a ImageUrl object the downcast produces valid
69    * handle. If not the returned handle is left uninitialized.
70    *
71    * @param[in] handle to An object.
72    * @return handle to a ImageUrl object or an uninitialized handle.
73    */
74   static ImageUrl DownCast(BaseHandle handle);
75
76   /**
77    * Copy constructor
78    * @param[in] url The url to copy
79    */
80   ImageUrl(const ImageUrl& url);
81
82   /**
83    * Assignment operator
84    * @param[in] url The url to copy
85    */
86   ImageUrl& operator=(const ImageUrl& url);
87
88   /**
89    * @brief Move constructor.
90    * @param[in] rhs A reference to the moved handle
91    */
92   ImageUrl(ImageUrl&& rhs);
93
94   /**
95    * @brief Move assignment operator.
96    * @param[in] rhs A reference to the moved handle
97    * @return A reference to this handle
98    */
99   ImageUrl& operator=(ImageUrl&& rhs);
100
101   /**
102    * Get the url
103    * @return Returns url's string
104    */
105   const std::string& GetUrl() const;
106
107 public: // Not intended for application developers
108   /// @cond internal
109   /**
110    * @brief This constructor is used by New() methods.
111    *
112    * @param[in] internal A pointer to a newly allocated Dali resource.
113    */
114   explicit DALI_INTERNAL ImageUrl(Toolkit::Internal::ImageUrl* internal);
115   /// @endcond
116 };
117
118 } // namespace Toolkit
119
120 } // namespace Dali
121
122 #endif /* DALI_TOOLKIT_IMAGE_URL_H */