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: Rebased. Corrected most of the review issues. Created July 4, 2017, 7:57 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 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
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