1 #ifndef __DALI_INTEGRATION_RESOURCE_CACHE_H__
2 #define __DALI_INTEGRATION_RESOURCE_CACHE_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/public-api/common/intrusive-ptr.h>
23 #include <dali/integration-api/resource-request.h>
31 * Used to determine why a resource IO operation has failed.
41 * Used to return loaded resources for rendering etc.
43 typedef IntrusivePtr<Dali::RefObject> ResourcePointer;
46 * Abstract interface to receive notifications of resource IO operations.
47 * This is used when pulling loaded resources from the PlatformAbstraction.
54 * Virtual protected destructor, no deletion through this interface
56 virtual ~ResourceCache() {}
61 * Provide the results of a resource loading operation to the cache.
62 * @param[in] id The unique ID of the load request.
63 * This should match an ID previously passed into PlatformAbstraction::LoadResource().
64 * LoadResponse() may be called multiple times with the same ID, when results are available
65 * at different stages e.g. a thumbnail image may be provided, before the full image is loaded.
66 * @param[in] type The type of the resource.
67 * @param[in] resource A pointer to a resource (Bitmap etc).
68 * @param[in] status The current loading status. RESOURCE_LOADING and RESOURCE_PARTIALLY_LOADED indicate there are more responses to come, RESOURCE_COMPLETELY_LOADED indicates this is the last response for this id.
70 virtual void LoadResponse(ResourceId id, ResourceTypeId type, ResourcePointer resource, LoadStatus status) = 0;
73 * Provide the results of a resource saving operation.
74 * @param[in] id The unique ID of the resource.
75 * This should match an ID previously passed into PlatformAbstraction::SaveResource().
76 * @param[in] type The type of the resource.
78 virtual void SaveComplete(ResourceId id, ResourceTypeId type) = 0;
81 * Report that a resource loading operation has failed.
82 * @param[in] id The unique ID of the load request.
83 * This should match an ID previously passed into PlatformAbstraction::LoadResource().
84 * @param[in] failure An error code, used to determine why the load failed.
86 virtual void LoadFailed(ResourceId id, ResourceFailure failure) = 0;
89 * Report that a resource saving operation has failed.
90 * @param[in] id The unique ID of the save request.
91 * This should match an ID previously passed into PlatformAbstraction::LoadResource().
92 * @param[in] failure An error code, used to determine why the save failed.
94 virtual void SaveFailed(ResourceId id, ResourceFailure failure) = 0;
98 } // namespace Integration
102 #endif // __DALI_INTEGRATION_RESOURCE_CACHE_H__