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>
35 * Used to return loaded resources for rendering etc.
37 typedef IntrusivePtr<Dali::RefObject> ResourcePointer;
40 * Used to prioritize between loading operations.
42 enum LoadResourcePriority
52 * Used to request a resource from the native filesystem.
59 * Used to request a resource be accessed from the native filesystem.
60 * @param[in] newId A unique ID for this request.
61 * @param[in] resourceType The type of resource requested. The implementation of
62 * PlatformAbstraction::LoadResource() is responsible for
63 * converting the native file(s) to this type
64 * e.g. decoding a jpeg to a bitmap.
65 * @param[in] resourcePath The path of the resource; typically a filename.
66 * @param[in] loadPriority The priority of the request.
68 ResourceRequest(ResourceId newId,
69 const ResourceType& resourceType,
70 const std::string& resourcePath,
71 LoadResourcePriority loadPriority = LoadPriorityNormal)
75 priority(loadPriority)
77 type = resourceType.Clone();
81 * Used to request or save a resource from/to the native filesystem.
82 * @param[in] newId A unique ID for this request.
83 * @param[in] resourceType The type of resource.
84 * @param[in] resourcePath The location of the resource / where the resource should be saved.
85 * @param[in] resourcePtr The resource to decode / save.
86 * @param[in] savePriority The priority of the request.
88 ResourceRequest(ResourceId newId,
89 const ResourceType& resourceType,
90 const std::string& resourcePath,
91 ResourcePointer resourcePtr,
92 LoadResourcePriority savePriority = LoadPriorityNormal)
96 resource(resourcePtr),
97 priority(savePriority)
99 type = resourceType.Clone();
104 * @param[in] request The resource request to copy.
106 ResourceRequest(const ResourceRequest& request)
110 resource(request.resource),
111 priority(request.priority)
113 type = request.type->Clone();
117 * Assignment operator.
118 * @param[in] rhs The resource request to copy.
120 ResourceRequest& operator=(const ResourceRequest& rhs)
125 type = rhs.type->Clone();
127 resource = rhs.resource;
128 priority = rhs.priority;
135 * Non-virtual destructor; not intended as a base class
143 * Retrieve the resource ID
146 ResourceId GetId() const
152 * Retrieve the resource type
155 ResourceType* GetType() const
161 * Retrieve the resource path
164 const std::string& GetPath() const
170 * Retrieve the resource (for save and decode requests)
171 * @return The resource
173 ResourcePointer GetResource() const
179 * Retrieve the load priority
180 * @return The priority
182 LoadResourcePriority GetPriority() const
192 /** When saving resources or decoding them, the resource data will be passed
193 * through in a reference counted object here. When Loading, it will be null. */
194 ResourcePointer resource;
195 LoadResourcePriority priority;
198 } // namespace Integration
202 #endif // __DALI_INTEGRATION_RESOURCE_REQUEST_H__