Your Donations help keep my Software going!
I'm on a short vacation and will be back soon.
I'm selling some Homebrew Game Dev Devices. Check it out.
Table of Contents
FilePeer
Description
tFilePeer.h Provides peer methods for the file class. For those wishing to provide this class on other platforms, a certain design contract must be fulfilled.
Design Contract
inline void _convertToFullPathPeer(); inline bool existsPeer() const; inline void getParentDirPeer(tFile &newfile) const; inline bool isDirectoryPeer() const; inline void listPeer(vector<tFile> &newlist) const; inline bool mkdirPeer() const; inline bool removePeer() const; inline bool renamePeer(const tFile &newfile) const; inline tUInt32 sizePeer() const;
We'll use the word “Filename” to refer to the storage area for the path from within the File class.
| method | contract | on entry… |
|---|---|---|
| _convertToFullPathPeer | convert the Filename to its native equivalent and store it back in Filename; if you cannot do so, leave Filename unmodified | Filename may or may not exist |
| existsPeer | return true if Filename is a file(not a directory) and exists | Filename may or may not exist |
| getParentDirPeer | Place Filename's parent's Filename into newfile parameter(via char* construction) | Filename may or may not exist; assume it does exist and return what the parent would be |
| isDirectoryPeer | return true if Filename is a directory(not a file) and exists | Filename may or may not exist |
| listPeer | fill vector with all files and directory names in the current directory specified by Filename, except for ”.” and ”..”, in the vector provided | Filename is a directory, and the vector is already empty |
| mkdirPeer | return true if directory creation based on Filename succeeds | Filename definitely does not exist |
| removePeer | return true if directory/file removal is successful | Filename definitely exists |
| renamePeer | return true if rename directory/file based on newfile's Filename succeeds | Filename definitely exists, newfile definitely does not exist |
| sizePeer | return the size of the file | Filename definitely is a file |
Notes
- None