OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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_FILE_SYSTEM_H | 18 #ifndef ADBLOCK_PLUS_FILE_SYSTEM_H |
19 #define ADBLOCK_PLUS_FILE_SYSTEM_H | 19 #define ADBLOCK_PLUS_FILE_SYSTEM_H |
20 | 20 |
21 #include <istream> | 21 #include <istream> |
| 22 #include <memory> |
22 #include <stdint.h> | 23 #include <stdint.h> |
23 #include <string> | 24 #include <string> |
24 | 25 |
25 #include "tr1_memory.h" | |
26 | |
27 namespace AdblockPlus | 26 namespace AdblockPlus |
28 { | 27 { |
29 class FileSystem | 28 class FileSystem |
30 { | 29 { |
31 public: | 30 public: |
32 struct StatResult | 31 struct StatResult |
33 { | 32 { |
34 StatResult() | 33 StatResult() |
35 { | 34 { |
36 exists = false; | 35 exists = false; |
37 isDirectory = false; | 36 isDirectory = false; |
38 isFile = false; | 37 isFile = false; |
39 lastModified = 0; | 38 lastModified = 0; |
40 } | 39 } |
41 | 40 |
42 bool exists; | 41 bool exists; |
43 bool isDirectory; | 42 bool isDirectory; |
44 bool isFile; | 43 bool isFile; |
45 int64_t lastModified; | 44 int64_t lastModified; |
46 }; | 45 }; |
47 | 46 |
48 virtual ~FileSystem() {} | 47 virtual ~FileSystem() {} |
49 virtual std::tr1::shared_ptr<std::istream> | 48 virtual std::shared_ptr<std::istream> |
50 Read(const std::string& path) const = 0; | 49 Read(const std::string& path) const = 0; |
51 virtual void Write(const std::string& path, | 50 virtual void Write(const std::string& path, |
52 std::tr1::shared_ptr<std::istream> data) = 0; | 51 std::shared_ptr<std::istream> data) = 0; |
53 virtual void Move(const std::string& fromPath, | 52 virtual void Move(const std::string& fromPath, |
54 const std::string& toPath) = 0; | 53 const std::string& toPath) = 0; |
55 virtual void Remove(const std::string& path) = 0; | 54 virtual void Remove(const std::string& path) = 0; |
56 virtual StatResult Stat(const std::string& path) const = 0; | 55 virtual StatResult Stat(const std::string& path) const = 0; |
57 virtual std::string Resolve(const std::string& path) const = 0; | 56 virtual std::string Resolve(const std::string& path) const = 0; |
58 }; | 57 }; |
59 | 58 |
60 typedef std::tr1::shared_ptr<FileSystem> FileSystemPtr; | 59 typedef std::shared_ptr<FileSystem> FileSystemPtr; |
61 } | 60 } |
62 | 61 |
63 #endif | 62 #endif |
OLD | NEW |