1 #ifndef DALI_TOOLKIT_INTERNAL_VISUAL_URL_H
2 #define DALI_TOOLKIT_INTERNAL_VISUAL_URL_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
32 * The type of the URL based on the string contents
46 LOCAL, ///< file in local file system
47 TEXTURE, ///< texture uploaded to texture manager
48 REMOTE ///< remote image
52 * Default Constructor.
53 * Resulting URL is not valid
59 * Delete an external texture if if protocolType is TEXTURE.
65 * Determines type of visual and whether the url is local or remote
66 * Notify that it is using an external texture if if protocolType is TEXTURE.
68 * @param[in] url The URL to store and resolve
70 VisualUrl(const std::string& url);
74 * @param[in] url The VisualUrl to copy
76 VisualUrl(const VisualUrl& url);
80 * @param[in] url The VisualUrl to copy
82 VisualUrl& operator=(const VisualUrl& url);
88 const std::string& GetUrl() const;
91 * Get the visual type of the URL
92 * @return The visual type of the URL
97 * Is the URL is local to the device, or remote?
98 * @return the location of the resource
100 ProtocolType GetProtocolType() const;
104 * @return true if the URL has length
106 bool IsValid() const;
109 * @return true if the location is LOCAL, i.e. is loadable from local file system
111 bool IsLocalResource() const;
114 * @return the location part of the url
116 std::string GetLocation() const;
119 * Helper to create a URL of type TEXTURE
120 * @param location the location of the texture
123 static std::string CreateTextureUrl(const std::string& location);
126 * Helper to get a ProtocolType from url
127 * @param url the url of the texture
128 * @return the protocol type
130 static VisualUrl::ProtocolType GetProtocolType(const std::string& url);
133 * Helper to get a location from url
134 * @param url the location of the texture
135 * @return the location
137 static std::string GetLocation(const std::string& url);
141 ProtocolType mLocation;
144 } // namespace Internal
146 } // namespace Toolkit
150 #endif /* DALI_TOOLKIT_INTERNAL_VISUAL_URL_H */