1 #ifndef DALI_FILE_STREAM_H
2 #define DALI_FILE_STREAM_H
5 * Copyright (c) 2019 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.
29 #include <dali/public-api/common/dali-vector.h>
30 #include <dali/public-api/dali-adaptor-common.h>
35 class DALI_ADAPTOR_API FileStream
40 * @brief File type formats
41 * The default format is binary
43 enum FileMode ///< FileType format
45 BINARY = 0x1, ///< File stream will be opened as a binary
46 TEXT = 0x2, ///< File stream will be opened as text
47 READ = 0x4, ///< File stream will be opened for reading
48 WRITE = 0x8, ///< File stream will be opende for writing
53 * @param[in] filename Filename of the file to open the stream for
54 * @param[in] mode How we want to open the stream. Binary or Text, Read or Write. Binary & Read default
56 FileStream(const std::string& filename, uint8_t mode = BINARY | READ);
60 * @param[in] buffer Buffer to open the stream for.
61 * The buffer is not owned by FileStream and must be valid for entire lifetime of FileStream
62 * @param[in] dataSize The maximum size of the data in the buffer.
63 * @param[in] mode How we want to open the stream. Binary or Text, Read or Write. Binary & Read default
65 FileStream(uint8_t* buffer, size_t dataSize, uint8_t mode = BINARY | READ);
69 * @param[in] buffer Buffer to open the stream for.
70 * The buffer is not owned by FileStream and must be valid for entire lifetime of FileStream
71 * @param[in] dataSize The maximum size of the data in the buffer.
72 * @param[in] mode How we want to open the stream. Binary or Text, Read or Write. Binary & Read default
74 FileStream(Dali::Vector<uint8_t>& buffer, size_t dataSize, uint8_t mode = BINARY | READ);
77 * Default move constructor
79 FileStream(FileStream&&) = default;
84 FileStream(const FileStream&) = delete;
89 FileStream& operator=(const FileStream&) = delete;
94 FileStream& operator=(FileStream&&);
102 * @brief Returns the stream
103 * @return std::iostream.
105 std::iostream& GetStream();
108 * @brief Returns the file stream
116 std::unique_ptr<Impl> mImpl;
121 #endif // DALI_FILE_STREAM_H