OLD | NEW |
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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 /** | 63 /** |
64 * Default callback type for asynchronous filesystem calls. | 64 * Default callback type for asynchronous filesystem calls. |
65 * @param An error string. Empty is success. | 65 * @param An error string. Empty is success. |
66 */ | 66 */ |
67 typedef std::function<void(const std::string&)> Callback; | 67 typedef std::function<void(const std::string&)> Callback; |
68 | 68 |
69 /** | 69 /** |
70 * Callback type for the asynchronous Read call. | 70 * Callback type for the asynchronous Read call. |
71 * @param Output char array with file content. | 71 * @param Output char array with file content. |
72 * @param An error string. Empty if success. | |
73 */ | 72 */ |
74 typedef std::function<void(IOBuffer&&, | 73 typedef std::function<void(IOBuffer&&)> ReadCallback; |
75 const std::string&)> ReadCallback; | |
76 | 74 |
77 /** | 75 /** |
78 * Reads from a file. | 76 * Reads from a file. |
79 * @param fileName File name. | 77 * @param fileName File name. |
80 * @param callback The function called on completion with the input data. | 78 * @param doneCallback The function called on completion with the input |
| 79 * data. If this function throws then the implementation should call |
| 80 * `errorCallback`. |
| 81 * @param errorCallback The function called if an error occured. |
81 */ | 82 */ |
82 virtual void Read(const std::string& fileName, | 83 virtual void Read(const std::string& fileName, |
83 const ReadCallback& callback) const = 0; | 84 const ReadCallback& doneCallback, |
| 85 const Callback& errorCallback) const = 0; |
84 | 86 |
85 /** | 87 /** |
86 * Writes to a file. | 88 * Writes to a file. |
87 * @param fileName File name. | 89 * @param fileName File name. |
88 * @param data The data to write. | 90 * @param data The data to write. |
89 * @param callback The function called on completion. | 91 * @param callback The function called on completion. |
90 */ | 92 */ |
91 virtual void Write(const std::string& fileName, | 93 virtual void Write(const std::string& fileName, |
92 const IOBuffer& data, | 94 const IOBuffer& data, |
93 const Callback& callback) = 0; | 95 const Callback& callback) = 0; |
(...skipping 30 matching lines...) Expand all Loading... |
124 const StatCallback& callback) const = 0; | 126 const StatCallback& callback) const = 0; |
125 }; | 127 }; |
126 | 128 |
127 /** | 129 /** |
128 * Unique smart pointer to to a `IFileSystem` instance. | 130 * Unique smart pointer to to a `IFileSystem` instance. |
129 */ | 131 */ |
130 typedef std::unique_ptr<IFileSystem> FileSystemPtr; | 132 typedef std::unique_ptr<IFileSystem> FileSystemPtr; |
131 } | 133 } |
132 | 134 |
133 #endif | 135 #endif |
OLD | NEW |