Merge "Add ApplyCustomFragmentPrefix" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / image-loader / image-url-impl.h
1 #ifndef DALI_TOOLKIT_INTERNAL_IMAGE_URL_H
2 #define DALI_TOOLKIT_INTERNAL_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
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/base-object.h>
23 #include <string>
24
25 // INTERNAL INCLUDES
26 #include <dali-toolkit/public-api/image-loader/image-url.h>
27
28 namespace Dali
29 {
30 namespace Toolkit
31 {
32 namespace Internal
33 {
34 class ImageUrl;
35 using ImageUrlPtr = IntrusivePtr<ImageUrl>;
36
37 class ImageUrl : public BaseObject
38 {
39 public:
40   /**
41    * @brief Constructor.
42    */
43   ImageUrl(Texture& texture);
44
45   /**
46    * @copydoc Dali::Toolkit::ImageUrl::New
47    */
48   static ImageUrlPtr New(Texture& texture);
49
50   /**
51    * @copydoc Dali::Toolkit::ImageUrl::GetUrl
52    */
53   const std::string& GetUrl() const;
54
55 protected:
56   /**
57    * @brief A reference counted object may only be deleted by calling Unreference()
58    */
59   virtual ~ImageUrl();
60
61 private:
62   // Undefined
63   ImageUrl(const ImageUrl&);
64
65   // Undefined
66   ImageUrl& operator=(const ImageUrl& rhs);
67
68 private:
69   std::string mUrl;
70 };
71
72 } // namespace Internal
73 } // namespace Toolkit
74
75 // Helpers for public-api forwarding methods
76
77 inline Toolkit::Internal::ImageUrl& GetImpl(Dali::Toolkit::ImageUrl& imageUrl)
78 {
79   DALI_ASSERT_ALWAYS(imageUrl && "ImageUrl handle is empty");
80
81   BaseObject& handle = imageUrl.GetBaseObject();
82
83   return static_cast<Toolkit::Internal::ImageUrl&>(handle);
84 }
85
86 inline const Toolkit::Internal::ImageUrl& GetImpl(const Dali::Toolkit::ImageUrl& imageUrl)
87 {
88   DALI_ASSERT_ALWAYS(imageUrl && "ImageUrl handle is empty");
89
90   const BaseObject& handle = imageUrl.GetBaseObject();
91
92   return static_cast<const Toolkit::Internal::ImageUrl&>(handle);
93 }
94
95 } // End of namespace Dali
96
97 #endif // DALI_TOOLKIT_INTERNAL_IMAGE_URL_H