TDME2 1.9.121
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StandardFileSystem.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <vector>
5
6#include <tdme/tdme.h>
10
11using std::string;
12using std::vector;
13
16
17/**
18 * Standard file system implementation
19 * @author Andreas Drewke
20 */
22{
23
24public:
25 /**
26 * Public constructor
27 */
29
30 /**
31 * Public destructor
32 */
33 virtual ~StandardFileSystem();
34
35 // overridden methods
36 const string getFileName(const string& path, const string& fileName) override;
37 void list(const string& pathName, vector<string>& files, FileNameFilter* filter = nullptr, bool addDrives = false) override;
38 bool isPath(const string& pathName) override;
39 bool isDrive(const string& pathName) override;
40 bool fileExists(const string& fileName) override;
41 bool isExecutable(const string& pathName, const string& fileName) override;
42 void setExecutable(const string& pathName, const string& fileName) override;
43 uint64_t getFileSize(const string& pathName, const string& fileName) override;
44 const string getContentAsString(const string& pathName, const string& fileName) override;
45 void setContentFromString(const string& pathName, const string& fileName, const string& content) override;
46 void getContent(const string& pathName, const string& fileName, vector<uint8_t>& content) override;
47 void setContent(const string& pathName, const string& fileName, const vector<uint8_t>& content) override;
48 void getContentAsStringArray(const string& pathName, const string& fileName, vector<string>& content) override;
49 void setContentFromStringArray(const string& pathName, const string& fileName, const vector<string>& content) override;
50 const string getCanonicalPath(const string& pathName, const string& fileName) override;
51 const string getCurrentWorkingPathName() override;
52 void changePath(const string& pathName) override;
53 const string getPathName(const string& fileName) override;
54 const string getFileName(const string& fileName) override;
55 void createPath(const string& pathName) override;
56 void removePath(const string& pathName, bool recursive) override;
57 void removeFile(const string& pathName, const string& fileName) override;
58 bool getThumbnailAttachment(const string& pathName, const string& fileName, vector<uint8_t>& thumbnailAttachmentContent) override;
59 bool getThumbnailAttachment(const vector<uint8_t>& content, vector<uint8_t>& thumbnailAttachmentContent) override;
60};
Standard file system implementation.
const string getPathName(const string &fileName) override
Get path name.
bool isPath(const string &pathName) override
Check if file is a path.
uint64_t getFileSize(const string &pathName, const string &fileName) override
Return file size of given file.
void setContent(const string &pathName, const string &fileName, const vector< uint8_t > &content) override
Set file content.
void removeFile(const string &pathName, const string &fileName) override
Remove file.
void removePath(const string &pathName, bool recursive) override
Remove path.
virtual ~StandardFileSystem()
Public destructor.
void createPath(const string &pathName) override
Create path.
const string getCurrentWorkingPathName() override
Get current working path name.
const string getCanonicalPath(const string &pathName, const string &fileName) override
Get canonical path name.
void setExecutable(const string &pathName, const string &fileName) override
Set up file to be an executable file.
void changePath(const string &pathName) override
Change path.
void setContentFromString(const string &pathName, const string &fileName, const string &content) override
Set content from string.
void getContentAsStringArray(const string &pathName, const string &fileName, vector< string > &content) override
Get file content as string array.
void setContentFromStringArray(const string &pathName, const string &fileName, const vector< string > &content) override
Set file content as string array.
const string getFileName(const string &path, const string &fileName) override
Get file name.
bool fileExists(const string &fileName) override
Check if file exists.
bool isDrive(const string &pathName) override
Check if file is a drive (applies to Microsoft Windows only)
bool isExecutable(const string &pathName, const string &fileName) override
Returns if file is a executable file.
void list(const string &pathName, vector< string > &files, FileNameFilter *filter=nullptr, bool addDrives=false) override
List files for given path and filter by a file name filter if not null.
void getContent(const string &pathName, const string &fileName, vector< uint8_t > &content) override
Get file content.
bool getThumbnailAttachment(const string &pathName, const string &fileName, vector< uint8_t > &thumbnailAttachmentContent) override
Reads a thumbnail attachment from binary file.
const string getContentAsString(const string &pathName, const string &fileName) override
Get content as string.
File system file name filter interface.