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

Delta Between Two Patch Sets: include/AdblockPlus/FileSystem.h

Issue 29449592: Issue 5183 - Provide async interface for FileSystem (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Left Patch Set: Make read write deal with binary buffers. Created July 6, 2017, 12:19 p.m.
Right Patch Set: Rebase on master. Last changes. Created July 7, 2017, 1:36 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « include/AdblockPlus/DefaultFileSystem.h ('k') | include/AdblockPlus/IFileSystem.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
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 Output 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::ostream& data) = 0; 51 const IFileSystem::IOBuffer& data) = 0;
sergei 2017/07/06 14:14:04 What do you think about making it in a separate co
hub 2017/07/06 14:33:31 This is needed because we write to that stream buf
sergei 2017/07/06 14:53:33 I see, but if we changed either std::istream or st
hub 2017/07/06 21:24:29 See https://codereview.adblockplus.org/29481704
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
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
LEFTRIGHT

Powered by Google App Engine
This is Rietveld