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>
24 #include <dali/public-api/text/font-parameters.h>
32 * Used to determine why a resource IO operation has failed.
42 * Used to return loaded resources for rendering etc.
44 typedef IntrusivePtr<Dali::RefObject> ResourcePointer;
47 * Abstract interface to receive notifications of resource IO operations.
48 * This is used when pulling loaded resources from the PlatformAbstraction.
55 * Virtual protected destructor, no deletion through this interface
57 virtual ~ResourceCache() {}
62 * Provide the results of a resource loading operation to the cache.
63 * @param[in] id The unique ID of the load request.
64 * This should match an ID previously passed into PlatformAbstraction::LoadResource().
65 * LoadResponse() may be called multiple times with the same ID, when results are available
66 * at different stages e.g. a thumbnail image may be provided, before the full image is loaded.
67 * @param[in] type The type of the resource.
68 * @param[in] resource A pointer to a resource (Bitmap etc).
69 * @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.
71 virtual void LoadResponse(ResourceId id, ResourceTypeId type, ResourcePointer resource, LoadStatus status) = 0;
74 * Provide the results of a resource saving operation.
75 * @param[in] id The unique ID of the resource.
76 * This should match an ID previously passed into PlatformAbstraction::SaveResource().
77 * @param[in] type The type of the resource.
79 virtual void SaveComplete(ResourceId id, ResourceTypeId type) = 0;
82 * Report that a resource loading operation has failed.
83 * @param[in] id The unique ID of the load request.
84 * This should match an ID previously passed into PlatformAbstraction::LoadResource().
85 * @param[in] failure An error code, used to determine why the load failed.
87 virtual void LoadFailed(ResourceId id, ResourceFailure failure) = 0;
90 * Report that a resource saving operation has failed.
91 * @param[in] id The unique ID of the save request.
92 * This should match an ID previously passed into PlatformAbstraction::LoadResource().
93 * @param[in] failure An error code, used to determine why the save failed.
95 virtual void SaveFailed(ResourceId id, ResourceFailure failure) = 0;
99 } // namespace Integration
103 #endif // __DALI_INTEGRATION_RESOURCE_CACHE_H__