return Dali::Internal::Adaptor::ReadFile(filename, memblock, fileType);
}
+int ReadFile(const std::string& filename, Dali::Vector<uint8_t>& memblock, FileLoader::FileType fileType)
+{
+ return Dali::Internal::Adaptor::ReadFile(filename, memblock, fileType);
+}
+
int ReadFile(const std::string& filename, std::streampos& fileSize, Dali::Vector<char>& memblock, FileLoader::FileType fileType)
{
return Dali::Internal::Adaptor::ReadFile(filename, fileSize, memblock, fileType);
* @brief Load the file. It will load it either as a binary or as a text
*
* @param[in] filename Filename of the file to load.
+ * @param[in] memblock Dali::Vector containing the buffer loaded
+ * @param[in] fileType How we want to load the file. Binary or Text. Binary default
+ * @return error code. 0 - Error, 1 - Ok
+ *
+ *
+ */
+DALI_ADAPTOR_API int ReadFile(const std::string& filename, Dali::Vector<uint8_t>& memblock, FileLoader::FileType fileType = BINARY);
+
+/**
+ * @brief Load the file. It will load it either as a binary or as a text
+ *
+ * @param[in] filename Filename of the file to load.
* @param[in] fileSize Size of the loaded file
* @param[in] memblock Dali::Vector containing the buffer loaded
* @param[in] fileType How we want to load the file. Binary or Text. Binary default
return Dali::Internal::Adaptor::ReadFile( filename, size, memblock, fileType);
}
+int ReadFile(const std::string& filename, Dali::Vector<uint8_t>& memblock, Dali::FileLoader::FileType fileType)
+{
+ std::streampos size;
+
+ return Dali::Internal::Adaptor::ReadFile( filename, size, memblock, fileType);
+}
+
inline bool hasPrefix(const std::string& prefix, const std::string& path)
{
return std::mismatch(prefix.begin(), prefix.end(), path.begin()).first == prefix.end();
return internalPath;
}
-int ReadFile(const std::string& filename, std::streampos& fileSize, Dali::Vector<char>& memblock, Dali::FileLoader::FileType fileType)
+template<typename T>
+int ReadFile(const std::string& filename, std::streampos& fileSize, Dali::Vector<T>& memblock, Dali::FileLoader::FileType fileType)
{
int errorCode = 0;
int length = 0;
length = AAsset_getLength( asset );
memblock.Resize( length + 1 ); // 1 for extra zero at the end
- char* buffer = &memblock[0];
+ char* buffer = reinterpret_cast<char*>(memblock.Begin());
errorCode = ( AAsset_read( asset, buffer, length ) != length ) ? 0 : 1;
fileSize = length;
//put last byte as 0, in case this is a text file without null-terminator
memblock[length] = 0;
- char* buffer = &memblock[0];
+ char* buffer = reinterpret_cast<char*>(memblock.Begin());
fseek( file, 0, SEEK_SET );
errorCode = ( fread( buffer, 1, length, file ) != length ) ? 0 : 1;
fileSize = length;
int ReadFile(const std::string& filename, Dali::Vector<char>& memblock, Dali::FileLoader::FileType fileType = Dali::FileLoader::BINARY);
-int ReadFile(const std::string& filename, std::streampos& fileSize, Dali::Vector<char>& memblock, Dali::FileLoader::FileType fileType = Dali::FileLoader::BINARY);
+int ReadFile(const std::string& filename, Dali::Vector<uint8_t>& memblock, Dali::FileLoader::FileType fileType = Dali::FileLoader::BINARY);
+
+template<typename T>
+int ReadFile(const std::string& filename, std::streampos& fileSize, Dali::Vector<T>& memblock, Dali::FileLoader::FileType fileType = Dali::FileLoader::BINARY);
std::streampos GetFileSize(const std::string& filename);
namespace Adaptor
{
-int ReadFile(const std::string& filename, Dali::Vector<char> & memblock, Dali::FileLoader::FileType fileType)
+int ReadFile(const std::string& filename, Dali::Vector<char>& memblock, Dali::FileLoader::FileType fileType)
{
std::streampos size;
return Dali::Internal::Adaptor::ReadFile( filename, size, memblock, fileType);
}
-int ReadFile(const std::string& filename, std::streampos& fileSize, Dali::Vector<char> & memblock, Dali::FileLoader::FileType fileType)
+int ReadFile(const std::string& filename, Dali::Vector<uint8_t>& memblock, Dali::FileLoader::FileType fileType)
+{
+ std::streampos size;
+
+ return Dali::Internal::Adaptor::ReadFile(filename, size, memblock, fileType);
+}
+
+template<typename T>
+int ReadFile(const std::string& filename, std::streampos& fileSize, Dali::Vector<T>& memblock, Dali::FileLoader::FileType fileType)
{
int errorCode = 0;
std::ifstream * file;
memblock.Resize( fileSize );
file->seekg (0, std::ios::beg);
- file->read( memblock.Begin(), fileSize );
+ file->read( reinterpret_cast<char*>(memblock.Begin()), fileSize );
file->close();
delete file;