Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: include/AdblockPlus/IFileSystem.h

Issue 29731562: Issue 6477 - separate done and error callbacks in IFileSystem::Read (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git@c0a6434596a83383e37678ef3b6ecef00ed6a261
Patch Set: Created March 23, 2018, 10:58 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | include/AdblockPlus/JsEngine.h » ('j') | src/FileSystemJsObject.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | include/AdblockPlus/JsEngine.h » ('j') | src/FileSystemJsObject.cpp » ('J')

Powered by Google App Engine
This is Rietveld