📄 warfiledriver.h
字号:
/** */#ifndef WAR_FILE_DRIVER_H#define WAR_FILE_DRIVER_H/* SYSTEM INCLUDES *//* PROJECT INCLUDES */#ifndef WAR_TYPES_H# include "WarTypes.h"#endif#ifndef WAR_EXCEPTION_H# include "WarException.h"#endif#ifndef WAR_SMART_POINTER_H# include "WarSmartPointer.h"#endif#ifndef WAR_PTR_WRAPPER_H# include "WarPtrWrapper.h"#endif#ifndef WAR_URL_H# include "WarUrl.h"#endif#ifndef WAR_FILE_ENUMS# include "WarFileEnums.h"#endif#ifndef WAR_TRANSFER_BUFFER_H# include "WarTransferBuffer.h"#endif#ifndef WAR_TIME# include "WarTime.h"#endif/* LOCAL INCLUDES *//* FORWARD REFERENCES */class WarFileDriverFile;class WarDirList;#ifdef __cplusplusextern "C" {#endif/****************** BEGIN OLD STYLE C spesific ********//****************** END OLD STYLE C spesific **********/#ifdef __cplusplus }#endif/****************** BEGIN C++ spesific ****************/#ifdef __cplusplusclass WarFileDriver : public WarFileEnums, public WarSmartPointer{public: typedef WarPtrWrapper<WarFileDriver> driver_ptr_t; // LIFECYCLE /** Constructor * * @param driverName Name of the driver. The name * corresponds to the scheme (tag) name of a URL. * The default driver for local files must be * called "file". A driver implementimng the * FTP protocol will be called "ftp". The names * does not need to be a registered or well-known * sceme name, but mist consist of only letters * a-z. The name should be in lowercase. */ WarFileDriver(war_ccstr_t driverName) : mName(driverName) { } // OPERATORS bool operator == (const WarFileDriver& val) const { return mName == val.mName; } bool operator < (const WarFileDriver& val) const { return mName < val.mName; } // OPERATIONS virtual void WarListDirectory(const WarUrl& Path, WarDirList& listDestination) throw(WarException) { WarThrow(WarError(WAR_ERR_NOT_IMPLEMENTED), NULL); } /// virtual void WarDeleteFile(const WarUrl& Path) const throw(WarException) { WarThrow(WarError(WAR_ERR_NOT_IMPLEMENTED), NULL); } /// virtual void WarDeleteDirectory(const WarUrl& Path) const throw(WarException) { WarThrow(WarError(WAR_ERR_NOT_IMPLEMENTED), NULL); } /// virtual void WarCreateDirectory(const WarUrl& Path) const throw(WarException) { WarThrow(WarError(WAR_ERR_NOT_IMPLEMENTED), NULL); } /** Checks the paths and creates directorories as requiered. * This function expects that the Path is to a directory, * so any file-name on the ned of the original path must * be stripped off. */ virtual void WarGenericCreateDirectories(const WarUrl& Path) const throw(WarException); /// virtual void WarCopyFile(const WarUrl& From, const WarUrl& To) const throw(WarException) { WarThrow(WarError(WAR_ERR_NOT_IMPLEMENTED), NULL); } /// virtual void WarRenameDirectory(const WarUrl& From, const WarUrl& To) const throw(WarException) { WarThrow(WarError(WAR_ERR_NOT_IMPLEMENTED), NULL); } /// Try to move a file. If that fails, try to copy it. virtual void WarGenericMoveFile(const WarUrl& From, const WarUrl& To) const throw(WarException); /// virtual void WarMoveFile(const WarUrl& From, const WarUrl& To) const throw(WarException) { WarThrow(WarError(WAR_ERR_NOT_IMPLEMENTED), NULL); } /// virtual war_flen_t WarGetFreeSpaceOnPath(const WarUrl& Path) const throw(WarException) { WarThrow(WarError(WAR_ERR_NOT_IMPLEMENTED), NULL); } /// virtual war_flen_t WarGetSize(const WarUrl& Path) const throw(WarException) { WarThrow(WarError(WAR_ERR_NOT_IMPLEMENTED), NULL); } /// virtual void WarStat(const WarUrl& Path, war_stat_t& st) const throw(WarException) { WarThrow(WarError(WAR_ERR_NOT_IMPLEMENTED), NULL); } /// Examines a file. Does not throw. virtual FileTypeE WarExamine(const WarUrl& path, war_stat_t& st) const; /// virtual PathCmpTypeE WarGetCmpMode(const WarUrl& Path) const throw(WarException) { WarThrow(WarError(WAR_ERR_NOT_IMPLEMENTED), NULL); } /** Create directories in a path if requiered @param Path Path to expand @param TreatLastAsFileName true if the last path-segment is a file name. Elese, the full path will eventually be created. @exception WarException on error */ virtual void WarExpandPath(const WarUrl& Path, bool doTreatLastAsFileName = true) { WarThrow(WarError(WAR_ERR_NOT_IMPLEMENTED), NULL); } /// WarFile helper virtual WarFileDriverFile *WarCreateNewFileObject(const WarUrl& fileUrl) const throw(WarException) { WarThrow(WarError(WAR_ERR_NOT_IMPLEMENTED), NULL); }; // Override to return the proper file object /** Helper function when we need to try a logon to * a network path (URL's with hostnae and auth-info). * * @returns true if the network-login was successful. */ virtual bool LogonToUrl(const WarUrl& logonUrl) const { return false; } // ACCESS // INQUIRY const std::string& GetName() const { return mName; } // Override for better presicion than 1/1 second virtual void WarGetFileModTime(const WarUrl& fsysUrl, WarTime& outTime, size_t& outPrecision) const throw(WarException); virtual std::string WarExplainFags(war_uint32_t fileFlags) const; protected:private: std::string mName;};/* INLINE METHODS *//* EXTERNAL REFERENCES */#endif /* __cplusplus *//****************** END C++ spesific ******************/#endif /* WAR_FILE_DRIVER_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -