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

Unified Diff: include/AdblockPlus/FileSystem.h

Issue 29449592: Issue 5183 - Provide async interface for FileSystem (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Updated implementation. Created June 2, 2017, 3:49 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: include/AdblockPlus/FileSystem.h
===================================================================
--- a/include/AdblockPlus/FileSystem.h
+++ b/include/AdblockPlus/FileSystem.h
@@ -18,58 +18,26 @@
#ifndef ADBLOCK_PLUS_FILE_SYSTEM_H
#define ADBLOCK_PLUS_FILE_SYSTEM_H
#include <istream>
#include <stdint.h>
#include <string>
#include <memory>
+#include "IFileSystem.h"
+
namespace AdblockPlus
{
/**
* File system interface.
*/
class FileSystem
{
public:
- /**
- * Result of a stat operation, i.e.\ information about a file.
- */
- struct StatResult
- {
- StatResult()
- {
- exists = false;
- isDirectory = false;
- isFile = false;
- lastModified = 0;
- }
-
- /**
- * File exists.
- */
- bool exists;
-
- /**
- * File is a directory.
- */
- bool isDirectory;
-
- /**
- * File is a regular file.
- */
- bool isFile;
-
- /**
- * POSIX time of the last modification.
- */
- int64_t lastModified;
- };
-
virtual ~FileSystem() {}
/**
* Reads from a file.
* @param path File path.
* @return Input stream with the file's contents.
*/
virtual std::shared_ptr<std::istream>
@@ -97,25 +65,25 @@
*/
virtual void Remove(const std::string& path) = 0;
/**
* Retrieves information about a file.
* @param path File path.
* @return File information.
*/
- virtual StatResult Stat(const std::string& path) const = 0;
+ virtual IFileSystem::StatResult Stat(const std::string& path) const = 0;
/**
* Returns the absolute path to a file.
* @param path File path (can be relative or absolute).
* @return Absolute file path.
*/
virtual std::string Resolve(const std::string& path) const = 0;
};
/**
* Shared smart pointer to a `FileSystem` instance.
*/
- typedef std::shared_ptr<FileSystem> FileSystemPtr;
+ typedef std::shared_ptr<FileSystem> FileSystemSyncPtr;
}
#endif

Powered by Google App Engine
This is Rietveld