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-2013 Eyeo GmbH | 3 * Copyright (C) 2006-2013 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 13 matching lines...) Expand all Loading... |
24 | 24 |
25 #include "tr1_memory.h" | 25 #include "tr1_memory.h" |
26 | 26 |
27 namespace AdblockPlus | 27 namespace AdblockPlus |
28 { | 28 { |
29 class FileSystem | 29 class FileSystem |
30 { | 30 { |
31 public: | 31 public: |
32 struct StatResult | 32 struct StatResult |
33 { | 33 { |
34 inline StatResult() | 34 StatResult() |
35 { | 35 { |
36 exists = false; | 36 exists = false; |
37 isDirectory = false; | 37 isDirectory = false; |
38 isFile = false; | 38 isFile = false; |
39 lastModified = false; | 39 lastModified = 0; |
40 } | 40 } |
41 | 41 |
42 bool exists; | 42 bool exists; |
43 bool isDirectory; | 43 bool isDirectory; |
44 bool isFile; | 44 bool isFile; |
45 int64_t lastModified; | 45 int64_t lastModified; |
46 }; | 46 }; |
47 | 47 |
48 virtual ~FileSystem() {} | 48 virtual ~FileSystem() {} |
49 virtual std::tr1::shared_ptr<std::istream> | 49 virtual std::tr1::shared_ptr<std::istream> |
50 Read(const std::string& path) const = 0; | 50 Read(const std::string& path) const = 0; |
51 virtual void Write(const std::string& path, | 51 virtual void Write(const std::string& path, |
52 std::tr1::shared_ptr<std::ostream> data) = 0; | 52 std::tr1::shared_ptr<std::ostream> data) = 0; |
53 virtual void Move(const std::string& fromPath, | 53 virtual void Move(const std::string& fromPath, |
54 const std::string& toPath) = 0; | 54 const std::string& toPath) = 0; |
55 virtual void Remove(const std::string& path) = 0; | 55 virtual void Remove(const std::string& path) = 0; |
56 virtual StatResult Stat(const std::string& path) const = 0; | 56 virtual StatResult Stat(const std::string& path) const = 0; |
57 virtual std::string Resolve(const std::string& path) const = 0; | 57 virtual std::string Resolve(const std::string& path) const = 0; |
58 }; | 58 }; |
59 | 59 |
60 typedef std::tr1::shared_ptr<FileSystem> FileSystemPtr; | 60 typedef std::tr1::shared_ptr<FileSystem> FileSystemPtr; |
61 } | 61 } |
62 | 62 |
63 #endif | 63 #endif |
OLD | NEW |