#ifndef _TMFSHOOK_H_ #define _TMFSHOOK_H_ //Perforce headers are buggy #ifndef _P4_CLIENTAPI_H_ #define _P4_CLIENTAPI_H_ #include "clientapi.h" #endif #include "TMBO.h" class TMFSHook : public FileSys { public: //TM Extensions void SetTMBO ( TMBO * tmbo ) { this->tmbo = tmbo; } //main interface //Factory function. Initalises adapter. static TMFSHook *Create( FileSysType type ); //Not necessary, but for later extensions and other coders it is easier static TMFSHook *CreateTemp( FileSysType type ) { TMFSHook *f = TMFSHook::Create( type ); f->SetDeleteOnClose(); return f; } static TMFSHook *CreateGlobalTemp( FileSysType type ) { TMFSHook *f = TMFSHook::Create( type ); f->SetDeleteOnClose(); f->MakeGlobalTemp(); return f; } // Get/set name, perms, modtime char * Name() { return realFS->Name(); } StrBuf & Path() { return realFS->Path(); } void Perms( FilePerm p ) { realFS->Perms (p); } void ModTime( StrPtr *u ) { realFS->ModTime(u); } void ModTime( time_t t ) { realFS->ModTime(t); } // Get type info FileSysType GetType() { return realFS->GetType(); } int IsExec() { return realFS->IsExec(); } int IsTextual() { return realFS->IsTextual(); } int IsUnicode() { return realFS->IsUnicode(); } //ConDestructors TMFSHook(); virtual ~TMFSHook(); //Undocumented Interface virtual void Set( const StrPtr &name ) { this->path = name; realFS->Set(name); } virtual int DoIndirectWrites() { realFS->DoIndirectWrites(); } virtual void Translator( CharSetCvt * csc) { realFS->Translator(csc); } //Documented interface virtual void Open( FileOpenMode mode, Error *e ); virtual void Write( const char *buf, int len, Error *e ); virtual int Read( char *buf, int len, Error *e ); //This? virtual int ReadLine( StrBuf *buf, Error *e ); virtual void Close( Error *e ); virtual int Stat(); virtual int StatModTime(); virtual void Truncate( Error *e ); virtual void Unlink( Error *e = 0 ); virtual void Rename( FileSys *target, Error *e ); virtual void Chmod( FilePerm perms, Error *e ); virtual void ChmodTime( Error *e ); // NB: these for ReadFile only; interface will likely change virtual int GetFd() { return realFS->GetFd(); } virtual size_t GetSize() { return realFS->GetSize(); } virtual void Seek( off_t offset ) { realFS->Seek(offset); } // Convenience wrappers for above void Chmod( const char *perms, Error *e ) { realFS->Chmod(perms,e); } void Chmod( Error *e ) { Chmod( perms, e ); } void Set( const char *name ) { Set( StrRef( name ) ); } void Write( const StrPtr &b, Error *e ) { Write( b.Text(), b.Length(), e ); } void Write( const StrPtr *b, Error *e ) { Write( b->Text(), b->Length(), e ); } // Tempfile support void MakeGlobalTemp() { realFS->MakeGlobalTemp(); } void MakeLocalTemp( char *file ) { realFS->MakeLocalTemp(file);} int IsDeleteOnClose() { return realFS->IsDeleteOnClose(); } void SetDeleteOnClose() { realFS->SetDeleteOnClose(); } void ClearDeleteOnClose() { realFS->ClearDeleteOnClose(); } // Meta operations StrArray *ScanDir( Error *e ) { return realFS->ScanDir(e);} static void MkDir( const StrPtr &p, Error *e ) { FileSys::MkDir(p,e);} void MkDir( Error *e ) { realFS->MkDir(e); } static void RmDir( const StrPtr &p, Error *e ) { FileSys::RmDir(p,e);} void RmDir( Error *e = 0 ) { realFS->RmDir(e); } FileSysType CheckType() { return realFS->CheckType(); } # if defined ( OS_MACOSX ) FileSysType CheckTypeMac() { return realFS->CheckTypeMac(); } # endif // Type generic operations //Not virtual? //int ReadLine( StrBuf *buf, Error *e ) { return realFS->ReadLine(buf,e); } void ReadWhole( StrBuf *buf, Error *e ) { realFS->ReadWhole(buf,e); } // Type generic, whole file operations void ReadFile( StrBuf *buf, Error *e ) { realFS->ReadFile(buf,e); } void WriteFile( const StrPtr *buf, Error *e ) { realFS->WriteFile(buf,e); } int Compare( FileSys *other, Error *e ) { return realFS->Compare(other,e); } void Copy( FileSys *targetFile, FilePerm perms, Error *e ) { realFS->Copy(targetFile, perms, e); } void Digest( StrBuf *digest, Error *e ) { realFS->Digest(digest,e); } void Cleanup() { realFS->Cleanup(); } // Character Set operations static void SetCharSet( int x = 0 ) { FileSys::SetCharSet(x); } static int GetCharSet() { return FileSys::GetCharSet(); } virtual StrBuf & GetDescription (); //Unix chmod virtual void SetMode (mode_t st_mode, Error * e); virtual mode_t GetMode (Error * e); protected: FileSys * realFS; TMBO * tmbo; struct stat * attr; TMTools * tools; } ; #endif //_TMFSHOOK_H_
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 5056 | harald_strack |
Directory support. Serious bug concerned to not unzipped binaries removed. Some other small bugfixes. |
||
#4 | 4980 | harald_strack |
Since I am maintaining the stuff in a local repository, I did some copy errors in the last revisions. Fixed. |
||
#3 | 4978 | harald_strack |
ap4 integrate implemented. Octal format is now used to save permissions. NOT backwards compatible anymore!!! |
||
#2 | 4975 | harald_strack |
Permissions are now masked to 555, so no write is possible. If you edit the Makefile and give the parameter -DFULL_PERMS, you have the old behaviour. Bugfix in ap4 revert: Edited and changed files were not reverted correctly. |
||
#1 | 4948 | harald_strack | Initial revision. |