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

Side by Side Diff: src/DefaultFileSystem.h

Issue 29512648: Issue 5475 - Update adblockpluscore dependency to revision hg:b935a0402215 (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: Created Aug. 11, 2017, 12:36 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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 25 matching lines...) Expand all
36 * working directory if no base path is set (see `SetBasePath()`). 36 * working directory if no base path is set (see `SetBasePath()`).
37 */ 37 */
38 class DefaultFileSystemSync 38 class DefaultFileSystemSync
39 { 39 {
40 public: 40 public:
41 IFileSystem::IOBuffer Read(const std::string& path) const; 41 IFileSystem::IOBuffer Read(const std::string& path) const;
42 void Write(const std::string& path, const IFileSystem::IOBuffer& data); 42 void Write(const std::string& path, const IFileSystem::IOBuffer& data);
43 void Move(const std::string& fromPath, const std::string& toPath); 43 void Move(const std::string& fromPath, const std::string& toPath);
44 void Remove(const std::string& path); 44 void Remove(const std::string& path);
45 IFileSystem::StatResult Stat(const std::string& path) const; 45 IFileSystem::StatResult Stat(const std::string& path) const;
46 std::string Resolve(const std::string& path) const; 46 std::string Resolve(const std::string& fileName) const;
47 47
48 /** 48 /**
49 * Sets the base path, all paths are considered relative to it. 49 * Sets the base path, all paths are considered relative to it.
50 * @param path Base path. 50 * @param path Base path.
51 */ 51 */
52 void SetBasePath(const std::string& path); 52 void SetBasePath(const std::string& path);
53 53
54 protected: 54 protected:
55 std::string basePath; 55 std::string basePath;
56 }; 56 };
57 57
58 class DefaultFileSystem : public IFileSystem 58 class DefaultFileSystem : public IFileSystem
59 { 59 {
60 public: 60 public:
61 explicit DefaultFileSystem(const Scheduler& scheduler, std::unique_ptr<Defau ltFileSystemSync> syncImpl); 61 explicit DefaultFileSystem(const Scheduler& scheduler, std::unique_ptr<Defau ltFileSystemSync> syncImpl);
62 void Read(const std::string& path, 62 void Read(const std::string& fileName,
63 const ReadCallback& callback) const; 63 const ReadCallback& callback) const override;
64 void Write(const std::string& path, 64 void Write(const std::string& fileName,
65 const IOBuffer& data, 65 const IOBuffer& data,
66 const Callback& callback); 66 const Callback& callback) override;
67 void Move(const std::string& fromPath, 67 void Move(const std::string& fromFileName,
68 const std::string& toPath, 68 const std::string& toFileName,
69 const Callback& callback); 69 const Callback& callback) override;
70 void Remove(const std::string& path, const Callback& callback); 70 void Remove(const std::string& fileName, const Callback& callback) override;
71 void Stat(const std::string& path, 71 void Stat(const std::string& fileName,
72 const StatCallback& callback) const; 72 const StatCallback& callback) const override;
73 73
74 std::string Resolve(const std::string& path) const;
75 private: 74 private:
75 // Returns the absolute path to a file.
76 std::string Resolve(const std::string& fileName) const;
76 Scheduler scheduler; 77 Scheduler scheduler;
77 std::unique_ptr<DefaultFileSystemSync> syncImpl; 78 std::unique_ptr<DefaultFileSystemSync> syncImpl;
78 }; 79 };
79 } 80 }
80 81
81 #endif 82 #endif
OLDNEW
« libadblockplus.gyp ('K') | « libadblockplus.gyp ('k') | src/DefaultFileSystem.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld