| LEFT | RIGHT |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 * File system interface. | 31 * File system interface. |
| 32 */ | 32 */ |
| 33 class FileSystem | 33 class FileSystem |
| 34 { | 34 { |
| 35 public: | 35 public: |
| 36 virtual ~FileSystem() {} | 36 virtual ~FileSystem() {} |
| 37 | 37 |
| 38 /** | 38 /** |
| 39 * Reads from a file. | 39 * Reads from a file. |
| 40 * @param path File path. | 40 * @param path File path. |
| 41 * @return Input stream with the file's contents. | 41 * @return Buffer with the file content. |
| 42 */ | 42 */ |
| 43 virtual std::shared_ptr<std::istream> | 43 virtual IFileSystem::IOBuffer Read(const std::string& path) const = 0; |
| 44 Read(const std::string& path) const = 0; | |
| 45 | 44 |
| 46 /** | 45 /** |
| 47 * Writes to a file. | 46 * Writes to a file. |
| 48 * @param path File path. | 47 * @param path File path. |
| 49 * @param data Input stream with the data to write. | 48 * @param data Buffer with the data to write. |
| 50 */ | 49 */ |
| 51 virtual void Write(const std::string& path, | 50 virtual void Write(const std::string& path, |
| 52 std::istream& data) = 0; | 51 const IFileSystem::IOBuffer& data) = 0; |
| 53 | 52 |
| 54 /** | 53 /** |
| 55 * Moves a file (i.e.\ renames it). | 54 * Moves a file (i.e.\ renames it). |
| 56 * @param fromPath Current path to the file. | 55 * @param fromPath Current path to the file. |
| 57 * @param toPath New path to the file. | 56 * @param toPath New path to the file. |
| 58 */ | 57 */ |
| 59 virtual void Move(const std::string& fromPath, | 58 virtual void Move(const std::string& fromPath, |
| 60 const std::string& toPath) = 0; | 59 const std::string& toPath) = 0; |
| 61 | 60 |
| 62 /** | 61 /** |
| (...skipping 17 matching lines...) Expand all Loading... |
| 80 virtual std::string Resolve(const std::string& path) const = 0; | 79 virtual std::string Resolve(const std::string& path) const = 0; |
| 81 }; | 80 }; |
| 82 | 81 |
| 83 /** | 82 /** |
| 84 * Shared smart pointer to a `FileSystem` instance. | 83 * Shared smart pointer to a `FileSystem` instance. |
| 85 */ | 84 */ |
| 86 typedef std::shared_ptr<FileSystem> FileSystemSyncPtr; | 85 typedef std::shared_ptr<FileSystem> FileSystemSyncPtr; |
| 87 } | 86 } |
| 88 | 87 |
| 89 #endif | 88 #endif |
| LEFT | RIGHT |