Dali 3D User Interface Engine
resource-loader.h
Go to the documentation of this file.
1 #ifndef __DALI_TIZEN_PLATFORM_RESOURCE_LOADER_H__
2 #define __DALI_TIZEN_PLATFORM_RESOURCE_LOADER_H__
3 
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20 
24 
25 #include <string>
26 
27 namespace Dali
28 {
29 
30 namespace Integration
31 {
32 namespace Log
33 {
34 class Filter;
35 }
36 }
37 
38 namespace TizenPlatform
39 {
40 
45 {
53  Integration::ResourceTypeId loadedType,
54  Integration::ResourcePointer loadedResource)
55  : id(loadedId),
56  type(loadedType),
57  resource(loadedResource)
58  {
59  }
60 
63  : id(loaded.id),
64  type(loaded.type),
65  resource(loaded.resource)
66  {
67  }
68 
71  {
72  if( this != &rhs )
73  {
74  id = rhs.id;
75  type = rhs.type;
76  resource = rhs.resource;
77  }
78  return *this;
79  }
80 
84 };
85 
90 {
92  id(resourceId),
93  failureType(failure)
94  {
95  }
96 
99  : id(failed.id),
100  failureType(failed.failureType)
101  {
102  }
103 
106  {
107  if( this != &rhs )
108  {
109  id = rhs.id;
110  failureType = rhs.failureType;
111  }
112  return *this;
113  }
114 
117 };
118 
126 {
127 public:
128 
133  ResourceLoader();
134 
139  ~ResourceLoader();
140 
144  void Pause();
145 
149  void Resume();
150 
155  bool IsTerminating();
156 
161  void AddLoadedResource(LoadedResource& resource);
162 
167  void AddFailedLoad(FailedResource& resource);
168 
169  // From PlatformAbstraction
170 
174  void LoadResource(const Integration::ResourceRequest& request);
175 
180 
185 
189  bool LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const;
190  bool LoadFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const;
191 
195  std::string LoadFile(const std::string& filename) const;
196 
200  static bool SaveFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes );
201 
202 private:
203 
204  // Undefined
205  ResourceLoader( const ResourceLoader& resourceLoader );
206 
207  // Undefined
208  ResourceLoader& operator=( const ResourceLoader& resourceLoader );
209 
210 private:
213 
214  volatile int mTerminateThread;
215 
216 };
217 
218 } // namespace TizenPlatform
219 
220 } // namespace Dali
221 
222 #endif // __DALI_TIZEN_PLATFORM_RESOURCE_LOADER_H_
Dali Docs Home
Read more about Dali