1 #ifndef __DALI_FILE_LOADER_H__
2 #define __DALI_FILE_LOADER_H__
5 * Copyright (c) 2015 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/public-api/common/dali-common.h>
22 #include <dali/public-api/object/base-handle.h>
30 * @brief File type formats
31 * The default format is binary
33 enum FileType ///< FileType format
35 BINARY, ///< File will be loaded as a binary
36 TEXT ///< File will be loaded as text
40 * @brief Load the file. It will load it either as a binary or as a text
42 * @param[in] filename Filename of the file to load.
43 * @param[in] memblock Dali::Vector containing the buffer loaded
44 * @param[in] fileType How we want to load the file. Binary or Text. Binary default
45 * @return error code. 0 - Error, 1 - Ok
49 DALI_IMPORT_API int ReadFile(const std::string& filename, Dali::Vector<char> & memblock, FileLoader::FileType fileType = BINARY);
52 * @brief Load the file. It will load it either as a binary or as a text
54 * @param[in] filename Filename of the file to load.
55 * @param[in] fileSize Size of the loaded file
56 * @param[in] memblock Dali::Vector containing the buffer loaded
57 * @param[in] fileType How we want to load the file. Binary or Text. Binary default
58 * @return error code. 0 - Error, 1 - Ok
61 DALI_IMPORT_API int ReadFile(const std::string& filename, std::streampos& fileSize, Dali::Vector<char> & memblock, FileLoader::FileType fileType = BINARY);
64 * @brief Get the file size of a file
66 * @param[in] filename Filename of the file to load.
67 * @return the size of the file or 0 if file not found
69 DALI_IMPORT_API std::streampos GetFileSize(const std::string& filename);
73 #endif // __DALI_FILE_LOADER_H__