1 #ifndef __DALI_INTEGRATION_RESOURCE_REQUEST_H__
2 #define __DALI_INTEGRATION_RESOURCE_REQUEST_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
21 #include <dali/integration-api/resource-types.h>
34 * Used to return loaded resources for rendering etc.
36 typedef IntrusivePtr<Dali::RefObject> ResourcePointer;
39 * Used to prioritize between loading operations.
41 enum LoadResourcePriority
51 * Used to request a resource from the native filesystem.
53 class DALI_IMPORT_API ResourceRequest
58 * Used to request a resource be accessed from the native filesystem.
59 * @param[in] newId A unique ID for this request.
60 * @param[in] resourceType The type of resource requested. The implementation of
61 * PlatformAbstraction::LoadResource() is responsible for
62 * converting the native file(s) to this type
63 * e.g. decoding a jpeg to a bitmap.
64 * @param[in] resourcePath The path of the resource; typically a filename.
65 * @param[in] loadPriority The priority of the request.
67 ResourceRequest(ResourceId newId,
68 const ResourceType& resourceType,
69 const std::string& resourcePath,
70 LoadResourcePriority loadPriority = LoadPriorityNormal)
74 priority(loadPriority)
76 type = resourceType.Clone();
80 * Used to request or save a resource from/to the native filesystem.
81 * @param[in] newId A unique ID for this request.
82 * @param[in] resourceType The type of resource.
83 * @param[in] resourcePath The location of the resource / where the resource should be saved.
84 * @param[in] resourcePtr The resource to decode / save.
85 * @param[in] savePriority The priority of the request.
87 ResourceRequest(ResourceId newId,
88 const ResourceType& resourceType,
89 const std::string& resourcePath,
90 ResourcePointer resourcePtr,
91 LoadResourcePriority savePriority = LoadPriorityNormal)
95 resource(resourcePtr),
96 priority(savePriority)
98 type = resourceType.Clone();
103 * @param[in] request The resource request to copy.
105 ResourceRequest(const ResourceRequest& request)
109 resource(request.resource),
110 priority(request.priority)
112 type = request.type->Clone();
116 * Assignment operator.
117 * @param[in] rhs The resource request to copy.
119 ResourceRequest& operator=(const ResourceRequest& rhs)
124 type = rhs.type->Clone();
126 resource = rhs.resource;
127 priority = rhs.priority;
134 * Non-virtual destructor; not intended as a base class
142 * Retrieve the resource ID
145 ResourceId GetId() const
151 * Retrieve the resource type
154 ResourceType* GetType() const
160 * Retrieve the resource path
163 const std::string& GetPath() const
169 * Retrieve the resource (for save and decode requests)
170 * @return The resource
172 ResourcePointer GetResource() const
178 * Retrieve the load priority
179 * @return The priority
181 LoadResourcePriority GetPriority() const
191 /** When saving resources or decoding them, the resource data will be passed
192 * through in a reference counted object here. When Loading, it will be null. */
193 ResourcePointer resource;
194 LoadResourcePriority priority;
197 } // namespace Integration
201 #endif // __DALI_INTEGRATION_RESOURCE_REQUEST_H__