1 #ifndef __DALI_TIZEN_PLATFORM_RESOURCE_LOADER_H__
2 #define __DALI_TIZEN_PLATFORM_RESOURCE_LOADER_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.
21 #include <dali/integration-api/platform-abstraction.h>
22 #include <dali/public-api/common/dali-vector.h>
37 namespace TizenPlatform
41 * Contains information about a successfully loaded resource
47 * @param[in] loadedId The ID of the resource
48 * @param[in] loadedType The resource type
49 * @param[in] loadedResource A pointer to the loaded resource data
51 LoadedResource(Integration::ResourceId loadedId,
52 Integration::ResourceTypeId loadedType,
53 Integration::ResourcePointer loadedResource)
56 resource(loadedResource)
61 LoadedResource(const LoadedResource& loaded)
64 resource(loaded.resource)
68 /// Assignment operator
69 LoadedResource& operator=(const LoadedResource& rhs)
75 resource = rhs.resource;
80 Integration::ResourceId id; ///< Integer ID
81 Integration::ResourceTypeId type; ///< Type enum (bitmap, ...)
82 Integration::ResourcePointer resource; ///< Reference counting pointer to the loaded / decoded representation of the resource.
86 * Contains information about a failed resource load/save request
93 * This implements the resource loading part of the PlatformAbstraction API.
94 * The requests for a specific resource type are farmed-out to a resource
95 * requester for that type which handles them in their own dedicated loading
103 * Create a resource loader.
104 * There should exactly one of these objects per Dali Core.
109 * Non-virtual destructor.
110 * ResourceLoader is NOT intended as a base class.
115 * Check if the ResourceLoader is terminating
116 * @return true if terminating else false
118 bool IsTerminating();
121 * Add a completely loaded resource to the LoadedResource queue
122 * @param[in] resource The resource's information and data
124 void AddLoadedResource(LoadedResource& resource);
127 * Add information about a failed resource load to the FailedLoads queue
128 * @param[in] resource The failed resource's information
130 void AddFailedLoad(FailedResource& resource);
132 // From PlatformAbstraction
135 * @copydoc SlpPlatformAbstraction::LoadFile()
137 bool LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const;
138 bool LoadFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const;
141 * @copydoc TizenPlatformAbstraction::LoadFile()
143 std::string LoadFile(const std::string& filename) const;
146 * @copydoc TizenPlatformAbstraction::SaveFile()
148 static bool SaveFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes );
153 ResourceLoader( const ResourceLoader& resourceLoader );
156 ResourceLoader& operator=( const ResourceLoader& resourceLoader );
159 struct ResourceLoaderImpl;
160 ResourceLoaderImpl* mImpl;
162 volatile int mTerminateThread; ///< Set to <> 0 in destructor, signals threads to exit their controlling loops
166 } // namespace TizenPlatform
170 #endif // __DALI_TIZEN_PLATFORM_RESOURCE_LOADER_H_