Directory. More...

#include <rdir.h>

Inheritance diagram for RDir:
[legend]
Collaboration diagram for RDir:
[legend]

Public Member Functions

 RDir (const RURI &uri)
 
virtual void Open (RIO::ModeType mode=RIO::Read)
 
RCursor< RFileGetEntries (void) const
 
virtual void Close (void)
 
void Clear (void)
 
virtual ~RDir (void)
 
- Public Member Functions inherited from RFile
 RFile (void)
 
 RFile (const RURI &uri)
 
 RFile (const RFile &file)
 
void Open (const RURI &uri, RIO::ModeType mode)
 
int Compare (const RFile &file) const
 
int Compare (const RFile *file) const
 
int Compare (const RString &uri) const
 
const RURIGetURI (void) const
 
void SetURI (const RURI &uri)
 
const RString GetFileName (void) const
 
virtual ~RFile (void)
 

Static Public Member Functions

static void CreateDirIfNecessary (const RString &dir, bool cascade=true)
 
- Static Public Member Functions inherited from RFile
static RChar GetDirSeparator (void)
 
static void RemoveFile (const RURI &uri)
 
static void RenameFile (const RURI &olduri, const RURI &newuri)
 
static RURI GetTempFile (void)
 
static bool Exists (const RURI &uri)
 
static bool IsDir (const RURI &uri)
 

Private Member Functions

void OpenEntries (void)
 

Private Attributes

Internal * Data
 
RContainer< RFile, true, true > Entries
 

Additional Inherited Members

- Protected Attributes inherited from RFile
RIO::ModeType Mode
 
RURI URI
 

Detailed Description

Directory.

The RDir class represents a generic directory. Here is an example:

#include <rdir.h>
using namespace R;
RDir Dir("/home/user/data");
Dir.Open(RIO::Read);
RCursor<RFile> Files(Dir.GetEntries());
for(Files.Start();!Files.End();Files.Next())
cout<<Files()->GetURI()()<<endl;

Constructor & Destructor Documentation

RDir ( const RURI uri)

Construct a directory.

Parameters
uriURI of the directory.
virtual ~RDir ( void  )
virtual

Destruct the directory object.

Member Function Documentation

virtual void Open ( RIO::ModeType  mode = RIO::Read)
virtual

Open the directory in a given mode.

Parameters
modeThe open mode for the file.

Reimplemented from RFile.

void OpenEntries ( void  )
private

Read the entries of the directory.

RCursor<RFile> GetEntries ( void  ) const

Get a cursor on the entries of the directory.

virtual void Close ( void  )
virtual

Close the file.

Reimplemented from RFile.

void Clear ( void  )

Remove the all files in the directory.

static void CreateDirIfNecessary ( const RString dir,
bool  cascade = true 
)
static

Create if a directory if it does not exist.

Parameters
dirDirectory to create.
cascadeIf true, all not existing parent directories are created too.

Field Documentation

Internal* Data
private

Internal structure representing a directory.

RContainer<RFile,true,true> Entries
private

Entries of the directory.