2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include "resource-loader.h"
26 #include <dali/devel-api/common/map-wrapper.h>
27 #include <dali/devel-api/threading/mutex.h>
30 #include <dali/integration-api/bitmap.h>
31 #include <dali/integration-api/debug.h>
32 #include <dali/public-api/common/dali-common.h>
33 #include <dali/devel-api/common/set-wrapper.h>
34 #include <dali/public-api/math/vector2.h>
35 #include "debug/resource-loader-debug.h"
37 using namespace Dali::Integration;
42 namespace TizenPlatform
45 /********************************************************************************/
46 /**************************** RESOURCE LOADER METHODS ************************/
47 /********************************************************************************/
48 ResourceLoader::ResourceLoader()
52 ResourceLoader::~ResourceLoader()
56 bool ResourceLoader::SaveFile(const std::string& filename, const unsigned char * buffer, unsigned int numBytes )
58 DALI_LOG_TRACE_METHOD(gLoaderFilter);
60 DALI_ASSERT_DEBUG( 0 != filename.length());
65 buf.open(filename.c_str(), std::ios::out | std::ios_base::trunc | std::ios::binary);
68 std::ostream stream(&buf);
70 // determine size of buffer
71 int length = static_cast<int>(numBytes);
73 // write contents of buffer to the file
74 stream.write(reinterpret_cast<const char*>(buffer), length);
78 DALI_LOG_INFO(gLoaderFilter, Debug::Verbose, "ResourceLoader::SaveFile(%s) - wrote %d bytes\n", filename.c_str(), length);
83 #if defined(DEBUG_BUILD)
86 DALI_LOG_INFO(gLoaderFilter, Debug::Verbose, "ResourceLoader::SaveFile(%s) - failed to load\n", filename.c_str());
93 } // namespace TizenPlatform