X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fvisual-url.h;h=555e383824b2048a6deddb1bde3586c09d3549b0;hb=HEAD;hp=8857184e07e05925033a27d1d5ec193453aba7d1;hpb=85a9005b80fce7dedf0acc52cf73aa950905e3ec;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/visuals/visual-url.h b/dali-toolkit/internal/visuals/visual-url.h index 8857184..8caf716 100644 --- a/dali-toolkit/internal/visuals/visual-url.h +++ b/dali-toolkit/internal/visuals/visual-url.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_VISUAL_URL_H /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,10 @@ * limitations under the License. */ +// EXTERNAL INCLUDES +#include #include +#include namespace Dali { @@ -38,14 +41,16 @@ public: SVG, GIF, WEBP, - JSON + JSON, + TVG }; enum ProtocolType { LOCAL, ///< file in local file system TEXTURE, ///< texture uploaded to texture manager - REMOTE ///< remote image + REMOTE, ///< remote image + BUFFER ///< encoded image buffer }; /** @@ -55,8 +60,16 @@ public: VisualUrl(); /** + * Default Destructor. + * Delete an external texture if if protocolType is TEXTURE. + */ + ~VisualUrl(); + + /** * Constructor. * Determines type of visual and whether the url is local or remote + * Notify that it is using an external texture if if protocolType is TEXTURE. + * * @param[in] url The URL to store and resolve */ VisualUrl(const std::string& url); @@ -74,12 +87,36 @@ public: VisualUrl& operator=(const VisualUrl& url); /** + * Move constructor + * @param[in] url The VisualUrl to move + */ + VisualUrl(VisualUrl&& url) noexcept; + + /** + * Move assignment operator + * @param[in] url The VisualUrl to move + */ + VisualUrl& operator=(VisualUrl&& url) noexcept; + + /** * Get the full URL * @return The url */ const std::string& GetUrl() const; /** + * Get the ellipsed URL. + * @return The ellipsed url + */ + std::string GetEllipsedUrl() const; + + /** + * Get the hash value of full URL + * @return The hash value of url + */ + std::uint64_t GetUrlHash() const; + + /** * Get the visual type of the URL * @return The visual type of the URL */ @@ -103,21 +140,62 @@ public: bool IsLocalResource() const; /** + * @return true if the location is BUFFER, i.e. may contain EncodedImageBuffer + */ + bool IsBufferResource() const; + + /** * @return the location part of the url */ std::string GetLocation() const; /** + * @return the location part of the url without extension + */ + std::string GetLocationWithoutExtension() const; + + /** * Helper to create a URL of type TEXTURE * @param location the location of the texture * @return the Url */ static std::string CreateTextureUrl(const std::string& location); + /** + * Helper to create a URL of type BUFFER + * @param[in] location the location of the texture + * @param[in] extension the extension of url + * @return the Url + */ + static std::string CreateBufferUrl(const std::string& location, const std::string_view& extension); + + /** + * Helper to get a ProtocolType from url + * @param url the url of the texture + * @return the protocol type + */ + static VisualUrl::ProtocolType GetProtocolType(const std::string& url); + + /** + * Helper to get a location from url + * @param url the location of the texture + * @return the location + */ + static std::string GetLocation(const std::string& url); + + /** + * Helper to get a location from url without extension + * @param[in] url the location of the texture + * @return the location without extension + */ + static std::string GetLocationWithoutExtension(const std::string& url); + private: std::string mUrl; Type mType; ProtocolType mLocation; + + mutable std::uint64_t mUrlHash; }; } // namespace Internal