OLD | NEW |
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-2015 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_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 <stdint.h> | 22 #include <stdint.h> |
23 #include <string> | 23 #include <string> |
24 | 24 #include <memory> |
25 #include "tr1_memory.h" | |
26 | 25 |
27 namespace AdblockPlus | 26 namespace AdblockPlus |
28 { | 27 { |
29 /** | 28 /** |
30 * File system interface. | 29 * File system interface. |
31 */ | 30 */ |
32 class FileSystem | 31 class FileSystem |
33 { | 32 { |
34 public: | 33 public: |
35 /** | 34 /** |
(...skipping 30 matching lines...) Expand all Loading... |
66 int64_t lastModified; | 65 int64_t lastModified; |
67 }; | 66 }; |
68 | 67 |
69 virtual ~FileSystem() {} | 68 virtual ~FileSystem() {} |
70 | 69 |
71 /** | 70 /** |
72 * Reads from a file. | 71 * Reads from a file. |
73 * @param path File path. | 72 * @param path File path. |
74 * @return Input stream with the file's contents. | 73 * @return Input stream with the file's contents. |
75 */ | 74 */ |
76 virtual std::tr1::shared_ptr<std::istream> | 75 virtual std::shared_ptr<std::istream> |
77 Read(const std::string& path) const = 0; | 76 Read(const std::string& path) const = 0; |
78 | 77 |
79 /** | 78 /** |
80 * Writes to a file. | 79 * Writes to a file. |
81 * @param path File path. | 80 * @param path File path. |
82 * @param data Input stream with the data to write. | 81 * @param data Input stream with the data to write. |
83 */ | 82 */ |
84 virtual void Write(const std::string& path, | 83 virtual void Write(const std::string& path, |
85 std::tr1::shared_ptr<std::istream> data) = 0; | 84 std::shared_ptr<std::istream> data) = 0; |
86 | 85 |
87 /** | 86 /** |
88 * Moves a file (i.e.\ renames it). | 87 * Moves a file (i.e.\ renames it). |
89 * @param fromPath Current path to the file. | 88 * @param fromPath Current path to the file. |
90 * @param toPath New path to the file. | 89 * @param toPath New path to the file. |
91 */ | 90 */ |
92 virtual void Move(const std::string& fromPath, | 91 virtual void Move(const std::string& fromPath, |
93 const std::string& toPath) = 0; | 92 const std::string& toPath) = 0; |
94 | 93 |
95 /** | 94 /** |
(...skipping 13 matching lines...) Expand all Loading... |
109 * Returns the absolute path to a file. | 108 * Returns the absolute path to a file. |
110 * @param path File path (can be relative or absolute). | 109 * @param path File path (can be relative or absolute). |
111 * @return Absolute file path. | 110 * @return Absolute file path. |
112 */ | 111 */ |
113 virtual std::string Resolve(const std::string& path) const = 0; | 112 virtual std::string Resolve(const std::string& path) const = 0; |
114 }; | 113 }; |
115 | 114 |
116 /** | 115 /** |
117 * Shared smart pointer to a `FileSystem` instance. | 116 * Shared smart pointer to a `FileSystem` instance. |
118 */ | 117 */ |
119 typedef std::tr1::shared_ptr<FileSystem> FileSystemPtr; | 118 typedef std::shared_ptr<FileSystem> FileSystemPtr; |
120 } | 119 } |
121 | 120 |
122 #endif | 121 #endif |
OLD | NEW |