Windows C++ Library
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions
CFile Class Reference

#include <File.hpp>

Inheritance diagram for CFile:
CStream WCL::IInputStream WCL::IOutputStream WCL::IStreamBase WCL::IStreamBase

List of all members.

Public Member Functions

 CFile ()
 ~CFile ()
HANDLE Handle () const
CPath Path () const
void Create (const tchar *pszPath)
void Open (const tchar *pszPath, uint nMode)
void Close ()
virtual void Read (void *pBuffer, size_t iNumBytes)
 Read a number of bytes from the stream.
virtual void Write (const void *pBuffer, size_t iNumBytes)
 Write a number of bytes to the stream.
virtual WCL::StreamPos Seek (WCL::StreamPos lPos, SeekPos eFrom=BEGIN)
 Move the stream pointer.
virtual bool IsEOF ()
 Query if the End of File has been reached.
virtual void Throw (int eErrCode, DWORD dwLastError)
 Throw a stream specific exception with the specified error code.
void SetEOF ()
WCL::StreamPos Size ()

Static Public Member Functions

static bool QueryInfo (const tchar *pszPath, struct _stat &oInfo)
static ulong Size (const tchar *pszPath)
static bool Copy (const tchar *pszSrc, const tchar *pszDst, bool bOverwrite=false)
static bool Move (const tchar *pszSrc, const tchar *pszDst)
static bool Delete (const tchar *pszPath)
static bool CreateFolder (const tchar *pszPath, bool bCreatePath=false)
static bool DeleteFolder (const tchar *pszPath)
static bool CreateShortcut (const tchar *pszLink, const tchar *pszTarget, const tchar *pszDesc=NULL)
static size_t ReadFile (const tchar *pszPath, std::vector< byte > &vBuffer)
 Read the entire contents of a binary file.
static size_t ReadTextFile (const tchar *pszPath, CString &strContents, TextFormat &eFormat)
 Read the entire contents of a text file.
static tstring ReadTextFile (const tchar *pszPath)
 Read the entire contents of a text file.
static void WriteFile (const tchar *pszPath, const std::vector< byte > &vBuffer)
 Write the entire contents of a binary file.
static void WriteTextFile (const tchar *pszPath, const CString &strContents, TextFormat eFormat)
 Write the entire contents of a text file.

Protected Attributes

HANDLE m_hFile
CPath m_Path
WCL::StreamPos m_lEOF

Private Member Functions

 CFile (const CFile &)
CFileoperator= (const CFile &)

Constructor & Destructor Documentation

CFile::CFile ( const CFile ) [private]

Member Function Documentation

HANDLE CFile::Handle ( ) const [inline]
CPath CFile::Path ( ) const [inline]
void CFile::Create ( const tchar *  pszPath)
void CFile::Open ( const tchar *  pszPath,
uint  nMode 
)
void CFile::Close ( )
void CFile::Read ( void *  pBuffer,
size_t  iNumBytes 
) [virtual]

Read a number of bytes from the stream.

Implements WCL::IInputStream.

void CFile::Write ( const void *  pBuffer,
size_t  iNumBytes 
) [virtual]

Write a number of bytes to the stream.

Implements WCL::IOutputStream.

WCL::StreamPos CFile::Seek ( WCL::StreamPos  lPos,
SeekPos  eFrom = BEGIN 
) [virtual]

Move the stream pointer.

Implements WCL::IStreamBase.

bool CFile::IsEOF ( ) [virtual]

Query if the End of File has been reached.

Implements WCL::IInputStream.

void CFile::Throw ( int  eErrCode,
DWORD  dwLastError 
) [virtual]

Throw a stream specific exception with the specified error code.

Implements WCL::IStreamBase.

void CFile::SetEOF ( )
bool CFile::QueryInfo ( const tchar *  pszPath,
struct _stat &  oInfo 
) [static]
ulong CFile::Size ( const tchar *  pszPath) [static]
bool CFile::Copy ( const tchar *  pszSrc,
const tchar *  pszDst,
bool  bOverwrite = false 
) [static]
bool CFile::Move ( const tchar *  pszSrc,
const tchar *  pszDst 
) [static]
bool CFile::Delete ( const tchar *  pszPath) [static]
bool CFile::CreateFolder ( const tchar *  pszPath,
bool  bCreatePath = false 
) [static]
bool CFile::DeleteFolder ( const tchar *  pszPath) [static]
bool CFile::CreateShortcut ( const tchar *  pszLink,
const tchar *  pszTarget,
const tchar *  pszDesc = NULL 
) [static]
size_t CFile::ReadFile ( const tchar *  pszPath,
std::vector< byte > &  vBuffer 
) [static]

Read the entire contents of a binary file.

It returns the number of bytes read.

size_t CFile::ReadTextFile ( const tchar *  pszPath,
CString strContents,
TextFormat eFormat 
) [static]

Read the entire contents of a text file.

It returns the number of characters read.

tstring CFile::ReadTextFile ( const tchar *  pszPath) [static]

Read the entire contents of a text file.

void CFile::WriteFile ( const tchar *  pszPath,
const std::vector< byte > &  vBuffer 
) [static]

Write the entire contents of a binary file.

void CFile::WriteTextFile ( const tchar *  pszPath,
const CString strContents,
TextFormat  eFormat 
) [static]

Write the entire contents of a text file.

CFile& CFile::operator= ( const CFile ) [private]

Member Data Documentation

HANDLE CFile::m_hFile [protected]
CPath CFile::m_Path [protected]

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