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 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.
22 #include <dali/integration-api/resource-types.h>
23 #include <dali/public-api/object/ref-object.h>
36 * Used to return loaded resources for rendering etc.
38 typedef IntrusivePtr<Dali::RefObject> ResourcePointer;
41 * Used to prioritize between loading operations.
43 enum LoadResourcePriority
53 * Used to request a resource from the native filesystem.
60 * Used to request a resource be accessed from the native filesystem.
61 * @param[in] newId A unique ID for this request.
62 * @param[in] resourceType The type of resource requested. The implementation of
63 * PlatformAbstraction::LoadResource() is responsible for
64 * converting the native file(s) to this type
65 * e.g. decoding a jpeg to a bitmap.
66 * @param[in] resourcePath The path of the resource; typically a filename.
67 * @param[in] loadPriority The priority of the request.
69 ResourceRequest(ResourceId newId,
70 const ResourceType& resourceType,
71 const std::string& resourcePath,
72 LoadResourcePriority loadPriority = LoadPriorityNormal)
76 priority(loadPriority)
78 type = resourceType.Clone();
82 * Used to request or save a resource from/to the native filesystem.
83 * @param[in] newId A unique ID for this request.
84 * @param[in] resourceType The type of resource.
85 * @param[in] resourcePath The location of the resource / where the resource should be saved.
86 * @param[in] resourcePtr The resource to decode / save.
87 * @param[in] savePriority The priority of the request.
89 ResourceRequest(ResourceId newId,
90 const ResourceType& resourceType,
91 const std::string& resourcePath,
92 ResourcePointer resourcePtr,
93 LoadResourcePriority savePriority = LoadPriorityNormal)
97 resource(resourcePtr),
98 priority(savePriority)
100 type = resourceType.Clone();
105 * @param[in] request The resource request to copy.
107 ResourceRequest(const ResourceRequest& request)
111 resource(request.resource),
112 priority(request.priority)
114 type = request.type->Clone();
118 * Assignment operator.
119 * @param[in] rhs The resource request to copy.
121 ResourceRequest& operator=(const ResourceRequest& rhs)
130 type = rhs.type->Clone();
132 resource = rhs.resource;
133 priority = rhs.priority;
140 * Non-virtual destructor; not intended as a base class
148 * Retrieve the resource ID
151 ResourceId GetId() const
157 * Retrieve the resource type
160 ResourceType* GetType() const
166 * Retrieve the resource path
169 const std::string& GetPath() const
175 * Retrieve the resource (for save and decode requests)
176 * @return The resource
178 ResourcePointer GetResource() const
184 * Retrieve the load priority
185 * @return The priority
187 LoadResourcePriority GetPriority() const
197 /** When saving resources or decoding them, the resource data will be passed
198 * through in a reference counted object here. When Loading, it will be null. */
199 ResourcePointer resource;
200 LoadResourcePriority priority;
203 } // namespace Integration
207 #endif // __DALI_INTEGRATION_RESOURCE_REQUEST_H__