Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

Protected Member Functions | Protected Attributes | Private Member Functions

PDirectory Class Reference

#include <pdirect.h>

Inheritance diagram for PDirectory:
Inheritance graph
[legend]
Collaboration diagram for PDirectory:
Collaboration graph
[legend]

List of all members.

Public Member Functions

Construction
 PDirectory ()
 Create a directory object of the current working directory.
 PDirectory (const char *cpathname)
 PDirectory (const PString &pathname)
PDirectoryoperator= (const PString &pathname)
PDirectoryoperator= (const char *cpathname)
Directory listing functions
virtual BOOL Open (int scanMask=PFileInfo::AllFiles)
virtual BOOL Restart (int scanMask=PFileInfo::AllFiles)
BOOL Next ()
virtual void Close ()
 Close the directory during or after a file list scan.
virtual PFilePathString GetEntryName () const
virtual BOOL IsSubDir () const
virtual BOOL GetInfo (PFileInfo &info) const
Overrides from class PObject
virtual PObjectClone () const
virtual Comparison Compare (const PObject &obj) const
virtual void PrintOn (ostream &strm) const
virtual void ReadFrom (istream &strm)
virtual PINDEX HashFunction () const
Overrides from class PContainer
virtual BOOL SetSize (PINDEX newSize)
virtual BOOL IsEmpty () const
virtual BOOL MakeUnique ()
Size/Length functions
BOOL MakeMinimumSize ()
PINLINE PINDEX GetLength () const
bool operator! () const
Comparison operators
bool operator*= (const PString &str) const
bool operator*= (const char *cstr) const
bool operator== (const PObject &str) const
bool operator== (const char *cstr) const
bool operator!= (const PObject &str) const
bool operator!= (const char *cstr) const
bool operator< (const PObject &str) const
bool operator< (const char *cstr) const
bool operator> (const PObject &str) const
bool operator> (const char *cstr) const
bool operator<= (const PObject &str) const
bool operator<= (const char *cstr) const
bool operator>= (const PObject &str) const
bool operator>= (const char *cstr) const
Comparison NumCompare (const PString &str, PINDEX count=P_MAX_INDEX, PINDEX offset=0) const
Comparison NumCompare (const char *cstr, PINDEX count=P_MAX_INDEX, PINDEX offset=0) const
Search & replace functions
PINDEX Find (char ch, PINDEX offset=0) const
PINDEX Find (const PString &str, PINDEX offset=0) const
PINDEX Find (const char *cstr, PINDEX offset=0) const
PINDEX FindLast (char ch, PINDEX offset=P_MAX_INDEX) const
PINDEX FindLast (const PString &str, PINDEX offset=P_MAX_INDEX) const
PINDEX FindLast (const char *cstr, PINDEX offset=P_MAX_INDEX) const
PINDEX FindOneOf (const PString &set, PINDEX offset=0) const
PINDEX FindOneOf (const char *cset, PINDEX offset=0) const
PINDEX FindRegEx (const PRegularExpression &regex, PINDEX offset=0) const
BOOL FindRegEx (const PRegularExpression &regex, PINDEX &pos, PINDEX &len, PINDEX offset=0, PINDEX maxPos=P_MAX_INDEX) const
void Replace (const PString &target, const PString &subs, BOOL all=FALSE, PINDEX offset=0)
void Splice (const PString &str, PINDEX pos, PINDEX len=0)
void Splice (const char *cstr, PINDEX pos, PINDEX len=0)
void Delete (PINDEX start, PINDEX len)
Sub-string functions
PString operator() (PINDEX start, PINDEX end) const
PString Left (PINDEX len) const
PString Right (PINDEX len) const
PString Mid (PINDEX start, PINDEX len=P_MAX_INDEX) const
PString LeftTrim () const
PString RightTrim () const
PString Trim () const
PString ToLower () const
PString ToUpper () const
PStringArray Tokenise (const PString &separators, BOOL onePerSeparator=TRUE) const
PStringArray Tokenise (const char *cseparators, BOOL onePerSeparator=TRUE) const
PStringArray Lines () const

Protected Member Functions

void Construct ()
void Destruct ()
virtual Comparison InternalCompare (PINDEX offset, char c) const
virtual Comparison InternalCompare (PINDEX offset, PINDEX length, const char *cstr) const
void InternalFromUCS2 (const WORD *ptr, PINDEX len)

Protected Attributes

DIR * directory
struct dirent * entryBuffer
PFileInfoentryInfo
int scanMask
 Mask of file types that the directory scan will return.

Private Member Functions

 PCONTAINERINFO (PDirectory, PFilePathString)

Access functions

PDirectory GetParent () const
PFilePathString GetVolume () const
BOOL IsRoot () const
PDirectory GetRoot () const
PStringArray GetPath () const
BOOL GetVolumeSpace (PInt64 &total, PInt64 &free, DWORD &clusterSize) const
static PINLINE BOOL IsSeparator (char ch)

File system functions

BOOL Exists () const
BOOL Change () const
BOOL Create (int perm=PFileInfo::DefaultDirPerms) const
BOOL Remove ()
static BOOL Exists (const PString &path)
static BOOL Change (const PString &path)
static BOOL Create (const PString &p, int perm=PFileInfo::DefaultDirPerms)
static BOOL Remove (const PString &path)

Construction

virtual PStringMakeEmpty ()
static PString Empty ()
enum  ConversionType {
  Pascal, Basic, Literal, Signed,
  Unsigned, Decimal, Exponent, Printf,
  NumConversionTypes
}

Concatenation operators

PString operator+ (const PString &str) const
PString operator+ (const char *cstr) const
PString operator+ (char ch) const
PStringoperator+= (const PString &str)
PStringoperator+= (const char *cstr)
PStringoperator+= (char ch)
PString operator& (const PString &str) const
PString operator& (const char *cstr) const
PString operator& (char ch) const
PStringoperator&= (const PString &str)
PStringoperator&= (const char *cstr)
PStringoperator&= (char ch)
PString operator+ (const char *cstr, const PString &str)
PString operator+ (char c, const PString &str)
PString operator& (const char *cstr, const PString &str)
PString operator& (char ch, const PString &str)

Conversion functions

PStringsprintf (const char *cfmt,...)
PStringvsprintf (const PString &fmt, va_list args)
PStringvsprintf (const char *cfmt, va_list args)
long AsInteger (unsigned base=10) const
DWORD AsUnsigned (unsigned base=10) const
PInt64 AsInt64 (unsigned base=10) const
PUInt64 AsUnsigned64 (unsigned base=10) const
double AsReal () const
PWORDArray AsUCS2 () const
PBYTEArray ToPascal () const
PString ToLiteral () const
 operator const unsigned char * () const
PString psprintf (const char *cfmt,...)
PString pvsprintf (const char *cfmt, va_list args)
PString pvsprintf (const PString &fmt, va_list args)

Detailed Description

Class to represent a directory in the operating system file system. A directory is a special file that contains a list of file paths.

The directory paths are highly platform dependent and a minimum number of assumptions should be made.

The PDirectory object is a string consisting of a possible volume name, and a series directory names in the path from the volumes root to the directory that the object represents. Each directory is separated by the platform dependent separator character which is defined by the PDIR_SEPARATOR macro. The path always has a trailing separator.

Some platforms allow more than one character to act as a directory separator so when doing any processing the IsSeparator()# function should be used to determine if a character is a possible separator.

The directory may be opened to gain access to the list of files that it contains. Note that the directory does { not} contain the "." and ".." entries that some platforms support.

The ancestor class is dependent on the platform. For file systems that are case sensitive, eg Unix, the ancestor is PString#. For other platforms, the ancestor class is PCaselessString#.

Definition at line 315 of file pdirect.h.


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

Generated by  Doxygen 1.6.0   Back to index