| Index: include/AdblockPlus/FileSystem.h |
| =================================================================== |
| --- a/include/AdblockPlus/FileSystem.h |
| +++ b/include/AdblockPlus/FileSystem.h |
| @@ -62,59 +62,77 @@ |
| /** |
| * POSIX time of the last modification. |
| */ |
| int64_t lastModified; |
| }; |
| virtual ~FileSystem() {} |
| + typedef std::function<void (void)> Callback; |
|
sergei
2017/05/26 13:32:04
Not sure whether we use a space between return typ
sergei
2017/05/26 13:32:04
We need a documentation for public things.
sergei
2017/05/26 13:32:04
Could you please not use (void), it's equivalent t
hub
2017/06/02 16:04:16
I would put a space, but then elsewhere it doesn't
hub
2017/06/02 16:04:16
Acknowledged.
|
| + typedef std::function<void (std::shared_ptr<std::istream>)> ReadCallback; |
|
sergei
2017/05/26 13:32:04
I would propose to change the signature to
std::fu
|
| + |
| /** |
| * Reads from a file. |
| * @param path File path. |
| * @return Input stream with the file's contents. |
| */ |
| virtual std::shared_ptr<std::istream> |
| Read(const std::string& path) const = 0; |
| + virtual void Read(const std::string& path, |
| + const ReadCallback& callback) const = 0; |
| /** |
| * Writes to a file. |
| * @param path File path. |
| * @param data Input stream with the data to write. |
| */ |
| virtual void Write(const std::string& path, |
| std::istream& data) = 0; |
| + virtual void Write(const std::string& path, |
| + std::istream& data, |
| + const Callback& callback) = 0; |
| /** |
| * Moves a file (i.e.\ renames it). |
| * @param fromPath Current path to the file. |
| * @param toPath New path to the file. |
| */ |
| virtual void Move(const std::string& fromPath, |
| const std::string& toPath) = 0; |
| + virtual void Move(const std::string& fromPath, |
| + const std::string& toPath, |
| + const Callback& callback) = 0; |
| /** |
| * Removes a file. |
| * @param path File path. |
| */ |
| virtual void Remove(const std::string& path) = 0; |
| + virtual void Remove(const std::string& path, const Callback& callback) = 0; |
| + typedef std::function<void (const StatResult&)> StatCallback; |
| /** |
| * Retrieves information about a file. |
| * @param path File path. |
| * @return File information. |
| */ |
| virtual StatResult Stat(const std::string& path) const = 0; |
| + virtual void Stat(const std::string& path, |
| + const StatCallback& callback) const = 0; |
| + typedef std::function<void (const std::string&)> ResolveCallback; |
| /** |
| * Returns the absolute path to a file. |
| * @param path File path (can be relative or absolute). |
| * @return Absolute file path. |
| */ |
| virtual std::string Resolve(const std::string& path) const = 0; |
| + virtual void Resolve(const std::string& path, |
|
sergei
2017/05/26 13:32:04
I'm not sure whether resolve should be asynchronou
hub
2017/06/02 16:04:16
I thought twice about that. I looked at NodeJS for
|
| + const ResolveCallback& callback) const = 0; |
| }; |
| /** |
| * Shared smart pointer to a `FileSystem` instance. |
| */ |
| typedef std::shared_ptr<FileSystem> FileSystemPtr; |
| } |