../dali-toolkit/dali-toolkit-test-utils/toolkit-event-thread-callback.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-environment-variable.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-feedback-player.cpp
- ../dali-toolkit/dali-toolkit-test-utils/toolkit-file-loader.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-context.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-lifecycle-controller.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-native-image-source.cpp
+++ /dev/null
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <string>
-#include <dali-toolkit/public-api/dali-toolkit-common.h>
-#include <dali/public-api/object/base-handle.h>
-#include <dali/devel-api/adaptor-framework/file-loader.h>
-
-namespace Dali
-{
-
-namespace FileLoader
-{
-
-int ReadFile(
- const std::string& filename,
- Dali::Vector<char> & memblock,
- FileLoader::FileType fileType)
-{
- return 0;
-}
-
-int ReadFile(
- const std::string& filename,
- std::streampos& fileSize,
- Dali::Vector<char> & memblock,
- FileLoader::FileType fileType)
-{
- return 0;
-}
-
-std::streampos GetFileSize(const std::string& filename)
-{
- return 0;
-}
-
-}
-}
#include <stdio.h>
#include <unistd.h>
+#include <dali/devel-api/adaptor-framework/file-loader.h>
+
inline std::string ExpandPath(const std::string &name)
{
wordexp_t p;
inline std::string GetFileContents(const std::string &fn)
{
- std::ifstream t(fn.c_str());
- return std::string((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>());
+ std::streampos bufferSize = 0;
+ Dali::Vector<char> fileBuffer;
+ if( !Dali::FileLoader::ReadFile( fn, bufferSize, fileBuffer, Dali::FileLoader::FileType::BINARY ) )
+ {
+ return std::string();
+ }
+
+ return std::string( &fileBuffer[0], bufferSize );
}
#endif // DALI_TOOLKIT_INTERNAL_BUILDER_FILESYSTEM_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali-toolkit/internal/controls/scene3d-view/gltf-shader.h>
// EXTERNAL INCLUDES
-#include <fstream>
#include <dali/integration-api/debug.h>
#include <dali/devel-api/adaptor-framework/image-loading.h>
#include <dali/devel-api/adaptor-framework/file-loader.h>
template <typename T>
bool ReadBinFile( Vector<T> &dataBuffer, std::string url, int32_t offset, int32_t count )
{
- dataBuffer.Resize( count );
- FILE* fp = fopen( url.c_str(), "rb" );
- if( fp == NULL )
+ std::streampos bufferSize = 0;
+ Dali::Vector<char> fileBuffer;
+ if( !Dali::FileLoader::ReadFile( url, bufferSize, fileBuffer, FileLoader::FileType::BINARY ) )
{
return false;
}
+
+ FILE* fp = fmemopen( &fileBuffer[0], bufferSize, "rb" );
+ dataBuffer.Resize( count );
ssize_t result = -1;
if( !fseek( fp, offset, SEEK_SET ) )
{
bool Loader::ParseGltf( const std::string& filePath )
{
- std::ifstream fileStream( filePath.c_str() );
- std::string fileBuffer( ( std::istreambuf_iterator<char>( fileStream ) ),
- ( std::istreambuf_iterator<char>() ) );
- mParser = Dali::Toolkit::JsonParser::New();
+ std::streampos bufferSize = 0;
+ Dali::Vector<char> buffer;
+ std::string fileBuffer;
+ if( !Dali::FileLoader::ReadFile( filePath, bufferSize, buffer, FileLoader::FileType::BINARY ) )
+ {
+ return false;
+ }
+ fileBuffer.assign( &buffer[0], bufferSize );
+ mParser = Dali::Toolkit::JsonParser::New();
return mParser.Parse( fileBuffer );
}
#include <dali/devel-api/adaptor-framework/file-loader.h>
#include <dali/devel-api/scripting/enum-helper.h>
#include <dali/devel-api/scripting/scripting.h>
-#include <fstream>
//INTERNAL INCLUDES
#include <dali-toolkit/public-api/visuals/visual-properties.h>