📄 staffilesystem.h
字号:
};// STAFFSEntry - This class represents an object that exists (or, at least, has// existed at some time) in the file system.//// Given an instance of this class, you can obtain various details// about the entry, as well as remove (a.k.a, delete), copy, and// rename the entry. You may also obtain an enumeration of this// entries sub-entries (if it is a directory).class STAFFSEnumeration;typedef STAFRefPtr<STAFFSEnumeration> STAFFSEnumPtr;class STAFFSEntry{public: STAFFSEntry(STAFFSEntry_t entry) : fEntry(entry) { /* Do Nothing */ } typedef std::pair<unsigned int, unsigned int> FileSize; // XXX: Add a trueType() function for differentiating symlinks // XXX: Add a linkedTo() function to get name of entry linked to // Informational methods STAFFSPath path() const; STAFFSEntryType_t type() const; FileSize size() const; STAFTimestamp modTime() const; unsigned int isLink() const; STAFString linkTarget() const; // Lock methods void readLock(); void readUnlock(); void writeLock(); void writeUnlock(); // Manipulation methods void remove(); STAFRC_t remove(unsigned int *osRC); void copy(const STAFString &toName); void move(const STAFString &toName); void rename(const STAFString &toName); // Enumeration methods STAFFSEnumPtr enumerate(const STAFString &namePat = STAFString(kUTF8_STAR), const STAFString &extPat = STAFString(kUTF8_STAR), STAFFSEntryType_t types = kSTAFFSNormal, STAFFSSortBy_t sortBy = kSTAFFSNoSort, STAFFSCaseSensitive_t caseSensitivity = kSTAFFSCaseDefault) const; // Data methods STAFFSEntry_t getImpl() const; STAFFSEntry_t adoptImpl(); ~STAFFSEntry();private: // Disallow copy construction and assignment STAFFSEntry(const STAFFSEntry &); STAFFSEntry &operator=(const STAFFSEntry &); STAFFSEntry_t fEntry;};// STAFFSEntryRLock - This class is used to acquire and automatically// release the read lock on a STAFFSEntry objectclass STAFFSEntryRLock{public: STAFFSEntryRLock(STAFFSEntryPtr &theEntry) : fEntry(theEntry) { fEntry->readLock(); } ~STAFFSEntryRLock() { fEntry->readUnlock(); }private: // Disallow copy construction and assignment STAFFSEntryRLock(const STAFFSEntryRLock &); STAFFSEntryRLock &operator=(const STAFFSEntryRLock &); STAFFSEntryPtr fEntry;};// STAFFSEntryWLock - This class is used to acquire and automatically// release the write lock on a STAFFSEntry objectclass STAFFSEntryWLock{public: STAFFSEntryWLock(STAFFSEntryPtr &theEntry) : fEntry(theEntry) { fEntry->writeLock(); } ~STAFFSEntryWLock() { fEntry->writeUnlock(); }private: // Disallow copy construction and assignment STAFFSEntryWLock(const STAFFSEntryWLock &); STAFFSEntryWLock &operator=(const STAFFSEntryWLock &); STAFFSEntryPtr fEntry;};// STAFFSEnumeration - This class represents the collection of entries that// reside within a given directory.//// You may retrieve the current entry, move to the next// entry, and determine if the enumeration is still valid.class STAFFSEnumeration{public: STAFFSEnumeration(STAFFSEnumHandle_t handle); unsigned int isValid() const; STAFFSEntryPtr entry() const; STAFFSEnumeration &next(); ~STAFFSEnumeration();private: // Disallow copy construction and assignment STAFFSEnumeration(const STAFFSEnumeration &); STAFFSEnumeration &operator=(const STAFFSEnumeration &); STAFFSEnumHandle_t fHandle; unsigned int fIsValid; STAFFSEntryPtr fCurrEntry;};// STAFFSCurrentDirectoryLock - This class provides a wrapper around the// current directory locking mechanism//// In general, you would create an instance of// this class before setting the current directory.class STAFFSCurrentDirectoryLock{public: STAFFSCurrentDirectoryLock(); ~STAFFSCurrentDirectoryLock();private: // Disallow copy construction and assignment STAFFSCurrentDirectoryLock(const STAFFSCurrentDirectoryLock &); STAFFSCurrentDirectoryLock &operator=(const STAFFSCurrentDirectoryLock &);};// STAFFileSystem - This class provides some utility functions for interfacing// with the file system.//// You may get and set the current directory, as well as// obtain certain information about the underlying file system.class STAFFileSystem{public: static STAFString getInfo(STAFFSInfoType_t type); static unsigned int matchesWildcards( const STAFString &stringToCheck, const STAFString &wildcardString, STAFFSCaseSensitive_t sensitive = kSTAFFSCaseDefault); static STAFFSComparePathResult_t comparePaths( const STAFString &path1, const STAFString &path2, STAFFSCaseSensitive_t sensitive = kSTAFFSCaseDefault); // Note: You should own the current directory lock before setting the // current directory static STAFString getCurrentDirectory(); static void setCurrentDirectory(const STAFString &dirName);private: // Disallow copy construction and assignment STAFFileSystem(const STAFFileSystem &); STAFFileSystem &operator=(const STAFFileSystem &);};// Begin C++ exception definitionsSTAF_EXCEPTION_DEFINITION(STAFFSException, STAFException);// Now include inline definitions#ifndef STAF_NATIVE_COMPILER#include "STAFFileSystemInlImpl.cpp"#endif// End C++ language definitions// End #ifdef __cplusplus#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -