FileDesc Class Reference

#include <filemgr.h>

Collaboration diagram for FileDesc:
Collaboration graph
[legend]

List of all members.

Public Member Functions

int getFd ()
long read (void *buf, long count)
long seek (long offset, int whence)
long write (const void *buf, long count)

Public Attributes

int mode
char * path
int perms
bool tryDowngrade

Private Member Functions

 FileDesc (FileMgr *parent, const char *path, int mode, int perms, bool tryDowngrade)
virtual ~FileDesc ()

Private Attributes

int fd
FileDescnext
long offset
FileMgrparent

Friends

class FileMgr

Detailed Description

This class represents one file. It works with the FileMgr object.

Definition at line 45 of file filemgr.h.


Constructor & Destructor Documentation

FileDesc::FileDesc ( FileMgr parent,
const char *  path,
int  mode,
int  perms,
bool  tryDowngrade 
) [private]

Definition at line 112 of file filemgr.cpp.

00112                                                                                             {
00113     this->parent = parent;
00114     this->path = 0;
00115     stdstr(&this->path, path);
00116     this->mode = mode;
00117     this->perms = perms;
00118     this->tryDowngrade = tryDowngrade;
00119     offset = 0;
00120     fd = -77;
00121 }

FileDesc::~FileDesc (  )  [private, virtual]

Definition at line 124 of file filemgr.cpp.

00124                     {
00125     if (fd > 0)
00126         close(fd);
00127         
00128     if (path)
00129         delete [] path;
00130 }


Member Function Documentation

int FileDesc::getFd (  ) 
Returns:
File handle.

Definition at line 133 of file filemgr.cpp.

00133                     {
00134     if (fd == -77)
00135         fd = parent->sysOpen(this);
00136 //  if ((fd < -1) && (fd != -77))  // kludge to hand ce
00137 //      return 777;
00138     return fd;
00139 }

long FileDesc::read ( void *  buf,
long  count 
)

Definition at line 147 of file filemgr.cpp.

00147                                          {
00148     return ::read(getFd(), buf, count);
00149 }

long FileDesc::seek ( long  offset,
int  whence 
)

Definition at line 142 of file filemgr.cpp.

00142                                            {
00143     return lseek(getFd(), offset, whence);
00144 }

long FileDesc::write ( const void *  buf,
long  count 
)

Definition at line 152 of file filemgr.cpp.

00152                                                 {
00153     return ::write(getFd(), buf, count);
00154 }


Friends And Related Function Documentation

friend class FileMgr [friend]

Definition at line 47 of file filemgr.h.


Member Data Documentation

int FileDesc::fd [private]

Definition at line 50 of file filemgr.h.

File access mode.

Definition at line 71 of file filemgr.h.

Definition at line 52 of file filemgr.h.

long FileDesc::offset [private]

Definition at line 49 of file filemgr.h.

Definition at line 51 of file filemgr.h.

Path to file.

Definition at line 68 of file filemgr.h.

File permissions.

Definition at line 74 of file filemgr.h.

Definition at line 77 of file filemgr.h.


The documentation for this class was generated from the following files:

Generated on 18 Mar 2013 for The SWORD Project by  doxygen 1.6.1