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

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

Issue 5163715573841920: Issue 768 - Switch from TR1 to C++11 (Closed)
Left Patch Set: Created July 11, 2014, 2:24 p.m.
Right Patch Set: fix including of <memory> Created Aug. 7, 2015, 6:07 a.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 | « common.gypi ('k') | include/AdblockPlus/FileSystem.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 <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2015 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #ifndef ADBLOCK_PLUS_DEFAULT_FILE_SYSTEM_H 18 #ifndef ADBLOCK_PLUS_DEFAULT_FILE_SYSTEM_H
19 #define ADBLOCK_PLUS_DEFAULT_FILE_SYSTEM_H 19 #define ADBLOCK_PLUS_DEFAULT_FILE_SYSTEM_H
20 20
21 #include "FileSystem.h" 21 #include "FileSystem.h"
22 22
23 #ifdef _WIN32 23 #ifdef _WIN32
24 #define PATH_SEPARATOR '\\' 24 #define PATH_SEPARATOR '\\'
25 #else 25 #else
26 #define PATH_SEPARATOR '/' 26 #define PATH_SEPARATOR '/'
27 #endif 27 #endif
28 28
29 namespace AdblockPlus 29 namespace AdblockPlus
30 { 30 {
31 /**
32 * `FileSystem` implementation that interacts directly with the operating
33 * system's file system.
34 * All paths are considered relative to the base path, or to the current
35 * working directory if no base path is set (see `SetBasePath()`).
36 */
31 class DefaultFileSystem : public FileSystem 37 class DefaultFileSystem : public FileSystem
32 { 38 {
33 public: 39 public:
34 std::shared_ptr<std::istream> Read(const std::string& path) const; 40 std::shared_ptr<std::istream> Read(const std::string& path) const;
35 void Write(const std::string& path, 41 void Write(const std::string& path, std::shared_ptr<std::istream> data);
36 std::shared_ptr<std::istream> data); 42 void Move(const std::string& fromPath, const std::string& toPath);
37 void Move(const std::string& fromPath,
38 const std::string& toPath);
39 void Remove(const std::string& path); 43 void Remove(const std::string& path);
40 StatResult Stat(const std::string& path) const; 44 StatResult Stat(const std::string& path) const;
41 std::string Resolve(const std::string& path) const; 45 std::string Resolve(const std::string& path) const;
46
47 /**
48 * Sets the base path, all paths are considered relative to it.
49 * @param path Base path.
50 */
42 void SetBasePath(const std::string& path); 51 void SetBasePath(const std::string& path);
52
43 protected: 53 protected:
44 std::string basePath; 54 std::string basePath;
45 }; 55 };
46 } 56 }
47 57
48 #endif 58 #endif
LEFTRIGHT

Powered by Google App Engine
This is Rietveld