home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ool_main.zip / ool / include / XFILE.H < prev    next >
C/C++ Source or Header  |  1998-04-06  |  3KB  |  90 lines

  1. #ifndef __OOL_XFILE_H__
  2. #define __OOL_XFILE_H__
  3.  
  4. /*===========================================================================*/
  5. /* OOL ------------------- the Open Object Library ------------------- r 1.0 */
  6. /*===========================================================================*/
  7. /*                              class: XFile                                 */
  8. /*                       derived from: XIO                                   */
  9. /*                        last update: 11/96                                 */
  10. /*                      programmed by: Stefan von Brauk (sbrauk@gwdg.de)     */
  11. /*===========================================================================*/
  12.  
  13. #include "xio.h"
  14.  
  15.  
  16. class XFileInfo;
  17.  
  18.  
  19. class XEA: public XObject
  20. {
  21.    public:
  22.       XEA() { value = NULL; valueSize = 0;}
  23.       ~XEA();
  24.       XString name;
  25.       void * value;
  26.       USHORT valueSize;
  27.       SHORT type;
  28.       USHORT GetType()
  29.       {
  30.          if( valueSize == 0)
  31.             return 0;
  32.          USHORT *pusPtr = (USHORT *) value;
  33.          return *pusPtr;
  34.       }
  35. };
  36.  
  37.  
  38. // TBO
  39. class _export_ XEAList: public XObject
  40. {
  41.    friend class XFile;
  42.       XEA ** list;
  43.       USHORT count;
  44.       void ClearList();
  45.    public:
  46.       XEAList() {list = NULL; count = 0;}
  47.       ~XEAList() { ClearList(); }
  48.       XEA* GetEA( const USHORT index ) const { return index < count ? list[index] : NULL; }
  49.       USHORT GetEACount() const { return count; }
  50. };
  51.  
  52.  
  53. class _export_ XFile: public XIO
  54. {
  55. #ifdef OOL_FOR_WIN32_X86
  56.    XString path;
  57. #endif
  58.    public:
  59.       XFile() { };
  60.       static ULONG Copy( const char* from, const char * to) { return DosCopy( (PSZ) from, (PSZ) to, 0); }
  61.       static ULONG CreateDirectory( const char * path);
  62.       static ULONG DeleteDirectory( const char * path);
  63.       static ULONG GetEA( const char * path, XEA * buffer, const char * entryName);
  64.       static ULONG GetEAList( const char * path, XEAList * buffer);
  65.       static ULONG SetEA( const char * path, const XEA * buffer);
  66.       static ULONG SetEAList( const char * path, const XEAList * buffer);
  67.       static BOOL IsDriveAvaible( const char );
  68.       static ULONG Move( const char* from, const char * to) { return DosMove( (PSZ) from, (PSZ) to); }
  69.       ULONG Open( const char * filename, const ULONG modeForOpen = XFILE_FAIL_IF_NEW|XFILE_OPEN_EXISTING, const ULONG modeForAcces = XFILE_READWRITE, const ULONG modeShare = XFILE_SHARE_DENYREADWRITE, const ULONG size=0, const EAOP2 * ealist=NULL);
  70.       static void GetCurrentDirectory( XString * buffer);
  71.       static void GetCurrentDisk( char& buffer);
  72.       LONG GetFileInfo( XFileInfo *);
  73.       static LONG GetPathInfo( const char * path, XFileInfo*);
  74.       static BOOL Remove( const char* path) { return ( DosDelete((PSZ) path) == 0 ? TRUE : FALSE); }
  75.       LONG ResetBuffer( void ) const { return DosResetBuffer(handle); }
  76.       static BOOL SetCurrentDirectory( const char * path) { if( DosSetCurrentDir( (PSZ) path) != 0) return FALSE; else return TRUE; }
  77.       static BOOL SetDefaultDisk( const char );
  78.       LONG SetFileInfo( const XFileInfo*);
  79.       static LONG SetPathInfo( const char * path, const XFileInfo*);
  80.       static ULONG SetMaxFiles( ULONG handles );
  81. };
  82.  
  83.  
  84. #endif
  85.  
  86.  
  87.  
  88.  
  89.  
  90.