ZNC  trunk
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
CFile Class Reference

#include <FileUtils.h>

+ Collaboration diagram for CFile:

Public Types

enum  EFileTypes {
  FT_REGULAR, FT_DIRECTORY, FT_CHARACTER, FT_BLOCK,
  FT_FIFO, FT_LINK, FT_SOCK
}
 
enum  EFileAttr {
  FA_Name, FA_Size, FA_ATime, FA_MTime,
  FA_CTime, FA_UID
}
 

Public Member Functions

 CFile ()
 
 CFile (const CString &sLongName)
 
 ~CFile ()
 
void SetFileName (const CString &sLongName)
 
bool IsReg (bool bUseLstat=false) const
 
bool IsDir (bool bUseLstat=false) const
 
bool IsChr (bool bUseLstat=false) const
 
bool IsBlk (bool bUseLstat=false) const
 
bool IsFifo (bool bUseLstat=false) const
 
bool IsLnk (bool bUseLstat=true) const
 
bool IsSock (bool bUseLstat=false) const
 
bool Exists () const
 
off_t GetSize () const
 
time_t GetATime () const
 
time_t GetMTime () const
 
time_t GetCTime () const
 
uid_t GetUID () const
 
gid_t GetGID () const
 
bool Delete ()
 
bool Move (const CString &sNewFileName, bool bOverwrite=false)
 
bool Copy (const CString &sNewFileName, bool bOverwrite=false)
 
bool Chmod (mode_t mode)
 
bool Seek (off_t uPos)
 
bool Truncate ()
 
bool Sync ()
 
bool Open (const CString &sFileName, int iFlags=O_RDONLY, mode_t iMode=0644)
 
bool Open (int iFlags=O_RDONLY, mode_t iMode=0644)
 
ssize_t Read (char *pszBuffer, int iBytes)
 
bool ReadLine (CString &sData, const CString &sDelimiter="\n")
 
bool ReadFile (CString &sData, size_t iMaxSize=512 *1024)
 
ssize_t Write (const char *pszBuffer, size_t iBytes)
 
ssize_t Write (const CString &sData)
 
void Close ()
 
void ClearBuffer ()
 
bool TryExLock (const CString &sLockFile, int iFlags=O_RDWR|O_CREAT)
 
bool TryExLock ()
 
bool ExLock ()
 
bool UnLock ()
 
bool IsOpen () const
 
CString GetLongName () const
 
CString GetShortName () const
 
CString GetDir () const
 
bool HadError () const
 
void ResetError ()
 

Static Public Member Functions

static bool IsReg (const CString &sLongName, bool bUseLstat=false)
 
static bool IsDir (const CString &sLongName, bool bUseLstat=false)
 
static bool IsChr (const CString &sLongName, bool bUseLstat=false)
 
static bool IsBlk (const CString &sLongName, bool bUseLstat=false)
 
static bool IsFifo (const CString &sLongName, bool bUseLstat=false)
 
static bool IsLnk (const CString &sLongName, bool bUseLstat=true)
 
static bool IsSock (const CString &sLongName, bool bUseLstat=false)
 
static bool FType (const CString &sFileName, EFileTypes eType, bool bUseLstat=false)
 
static bool Exists (const CString &sFile)
 
static off_t GetSize (const CString &sFile)
 
static time_t GetATime (const CString &sFile)
 
static time_t GetMTime (const CString &sFile)
 
static time_t GetCTime (const CString &sFile)
 
static uid_t GetUID (const CString &sFile)
 
static gid_t GetGID (const CString &sFile)
 
static int GetInfo (const CString &sFile, struct stat &st)
 
static bool Delete (const CString &sFileName)
 
static bool Move (const CString &sOldFileName, const CString &sNewFileName, bool bOverwrite=false)
 
static bool Copy (const CString &sOldFileName, const CString &sNewFileName, bool bOverwrite=false)
 
static bool Chmod (const CString &sFile, mode_t mode)
 
static void InitHomePath (const CString &sFallback)
 
static const CStringGetHomePath ()
 

Protected Attributes

CString m_sLongName
 Absolute filename (m_sPath + "/" + m_sShortName) More...
 
CString m_sShortName
 Filename alone, without path. More...
 

Member Enumeration Documentation

◆ EFileAttr

Enumerator
FA_Name 
FA_Size 
FA_ATime 
FA_MTime 
FA_CTime 
FA_UID 

◆ EFileTypes

Enumerator
FT_REGULAR 
FT_DIRECTORY 
FT_CHARACTER 
FT_BLOCK 
FT_FIFO 
FT_LINK 
FT_SOCK 

Constructor & Destructor Documentation

◆ CFile() [1/2]

CFile::CFile ( )

◆ CFile() [2/2]

CFile::CFile ( const CString sLongName)

◆ ~CFile()

CFile::~CFile ( )

Member Function Documentation

◆ Chmod() [1/2]

static bool CFile::Chmod ( const CString sFile,
mode_t  mode 
)
static

◆ Chmod() [2/2]

bool CFile::Chmod ( mode_t  mode)

◆ ClearBuffer()

void CFile::ClearBuffer ( )

◆ Close()

void CFile::Close ( )

◆ Copy() [1/2]

bool CFile::Copy ( const CString sNewFileName,
bool  bOverwrite = false 
)

◆ Copy() [2/2]

static bool CFile::Copy ( const CString sOldFileName,
const CString sNewFileName,
bool  bOverwrite = false 
)
static

◆ Delete() [1/2]

bool CFile::Delete ( )

◆ Delete() [2/2]

static bool CFile::Delete ( const CString sFileName)
static

◆ Exists() [1/2]

bool CFile::Exists ( ) const

◆ Exists() [2/2]

static bool CFile::Exists ( const CString sFile)
static

◆ ExLock()

bool CFile::ExLock ( )

◆ FType()

static bool CFile::FType ( const CString sFileName,
EFileTypes  eType,
bool  bUseLstat = false 
)
static

◆ GetATime() [1/2]

time_t CFile::GetATime ( ) const

◆ GetATime() [2/2]

static time_t CFile::GetATime ( const CString sFile)
static

◆ GetCTime() [1/2]

time_t CFile::GetCTime ( ) const

◆ GetCTime() [2/2]

static time_t CFile::GetCTime ( const CString sFile)
static

◆ GetDir()

CString CFile::GetDir ( ) const

◆ GetGID() [1/2]

gid_t CFile::GetGID ( ) const

◆ GetGID() [2/2]

static gid_t CFile::GetGID ( const CString sFile)
static

◆ GetHomePath()

static const CString& CFile::GetHomePath ( )
inlinestatic

◆ GetInfo()

static int CFile::GetInfo ( const CString sFile,
struct stat &  st 
)
static

◆ GetLongName()

CString CFile::GetLongName ( ) const

◆ GetMTime() [1/2]

time_t CFile::GetMTime ( ) const

◆ GetMTime() [2/2]

static time_t CFile::GetMTime ( const CString sFile)
static

◆ GetShortName()

CString CFile::GetShortName ( ) const

◆ GetSize() [1/2]

off_t CFile::GetSize ( ) const

◆ GetSize() [2/2]

static off_t CFile::GetSize ( const CString sFile)
static

◆ GetUID() [1/2]

uid_t CFile::GetUID ( ) const

◆ GetUID() [2/2]

static uid_t CFile::GetUID ( const CString sFile)
static

◆ HadError()

bool CFile::HadError ( ) const
inline

◆ InitHomePath()

static void CFile::InitHomePath ( const CString sFallback)
static

◆ IsBlk() [1/2]

bool CFile::IsBlk ( bool  bUseLstat = false) const

◆ IsBlk() [2/2]

static bool CFile::IsBlk ( const CString sLongName,
bool  bUseLstat = false 
)
static

◆ IsChr() [1/2]

bool CFile::IsChr ( bool  bUseLstat = false) const

◆ IsChr() [2/2]

static bool CFile::IsChr ( const CString sLongName,
bool  bUseLstat = false 
)
static

◆ IsDir() [1/2]

bool CFile::IsDir ( bool  bUseLstat = false) const

◆ IsDir() [2/2]

static bool CFile::IsDir ( const CString sLongName,
bool  bUseLstat = false 
)
static

◆ IsFifo() [1/2]

bool CFile::IsFifo ( bool  bUseLstat = false) const

◆ IsFifo() [2/2]

static bool CFile::IsFifo ( const CString sLongName,
bool  bUseLstat = false 
)
static

◆ IsLnk() [1/2]

bool CFile::IsLnk ( bool  bUseLstat = true) const

◆ IsLnk() [2/2]

static bool CFile::IsLnk ( const CString sLongName,
bool  bUseLstat = true 
)
static

◆ IsOpen()

bool CFile::IsOpen ( ) const

◆ IsReg() [1/2]

bool CFile::IsReg ( bool  bUseLstat = false) const

◆ IsReg() [2/2]

static bool CFile::IsReg ( const CString sLongName,
bool  bUseLstat = false 
)
static

◆ IsSock() [1/2]

bool CFile::IsSock ( bool  bUseLstat = false) const

◆ IsSock() [2/2]

static bool CFile::IsSock ( const CString sLongName,
bool  bUseLstat = false 
)
static

◆ Move() [1/2]

bool CFile::Move ( const CString sNewFileName,
bool  bOverwrite = false 
)

◆ Move() [2/2]

static bool CFile::Move ( const CString sOldFileName,
const CString sNewFileName,
bool  bOverwrite = false 
)
static

◆ Open() [1/2]

bool CFile::Open ( const CString sFileName,
int  iFlags = O_RDONLY,
mode_t  iMode = 0644 
)

◆ Open() [2/2]

bool CFile::Open ( int  iFlags = O_RDONLY,
mode_t  iMode = 0644 
)

◆ Read()

ssize_t CFile::Read ( char *  pszBuffer,
int  iBytes 
)

◆ ReadFile()

bool CFile::ReadFile ( CString sData,
size_t  iMaxSize = 512 *1024 
)

◆ ReadLine()

bool CFile::ReadLine ( CString sData,
const CString sDelimiter = "\n" 
)

◆ ResetError()

void CFile::ResetError ( )
inline

◆ Seek()

bool CFile::Seek ( off_t  uPos)

◆ SetFileName()

void CFile::SetFileName ( const CString sLongName)

◆ Sync()

bool CFile::Sync ( )

◆ Truncate()

bool CFile::Truncate ( )

◆ TryExLock() [1/2]

bool CFile::TryExLock ( )

◆ TryExLock() [2/2]

bool CFile::TryExLock ( const CString sLockFile,
int  iFlags = O_RDWR|O_CREAT 
)

◆ UnLock()

bool CFile::UnLock ( )

◆ Write() [1/2]

ssize_t CFile::Write ( const char *  pszBuffer,
size_t  iBytes 
)

◆ Write() [2/2]

ssize_t CFile::Write ( const CString sData)

Member Data Documentation

◆ m_sLongName

CString CFile::m_sLongName
protected

Absolute filename (m_sPath + "/" + m_sShortName)

◆ m_sShortName

CString CFile::m_sShortName
protected

Filename alone, without path.


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