BrowseFiles Class Reference

#include <c4d_file.h>

Detailed Description

Helper to browse through files.

Note
Has to be created with Alloc() and destroyed with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Public Member Functions

void Init (const Filename &directory, Int32 flags)
 
Bool GetNext (void)
 
Int64 GetSize (void)
 
Bool IsDir (void)
 
Bool IsHidden (void)
 
Bool IsBundle (void)
 
Bool IsReadOnly (void)
 
void GetFileTime (Int32 mode, LocalFileTime *out)
 
Filename GetFilename (void)
 

Private Member Functions

 BrowseFiles ()
 
 ~BrowseFiles ()
 

Alloc/Free

static BrowseFilesAlloc ()
 
static void Free (BrowseFiles *&bf)
 

Constructor & Destructor Documentation

§ BrowseFiles()

BrowseFiles ( )
private

§ ~BrowseFiles()

~BrowseFiles ( )
private

Member Function Documentation

§ Alloc()

static BrowseFiles* Alloc ( )
static

Allocates a file browser. Destroy the allocated file browser with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Returns
The allocated file browser, or nullptr if the allocation failed.

§ Free()

static void Free ( BrowseFiles *&  bf)
static

Destructs file browsers allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.

Parameters
[in,out]bfThe file browser to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

§ Init()

void Init ( const Filename directory,
Int32  flags 
)

Initializes the class to browse a certain directory.

Parameters
[in]directoryThe directory to browse.
[in]flagsThe browser files flags: BROWSEFILES

§ GetNext()

Bool GetNext ( void  )

Gets the next file or subdirectory in the browsed directory.

Note
To retrieve the first file call GetNext() once. Example: BrowseFiles *bf = AllocBrowseFiles(dir, false); if (bf) { while (bf->GetNext()) { GePrint(bf->GetFilename().GetString()); } FreeBrowseFiles(bf); }
Returns
true if another file was found, otherwise false.

§ GetSize()

Int64 GetSize ( void  )

Gets the size for the current file.

Returns
The byte size of the file.
Warning
Not valid for directories.

§ IsDir()

Bool IsDir ( void  )

Checks if the current element is a directory.

Returns
true if the current element is a directory, otherwise false.

§ IsHidden()

Bool IsHidden ( void  )

Checks if the current file or directory is hidden.

Returns
true if the current file is hidden, otherwise false.

§ IsBundle()

Bool IsBundle ( void  )

Checks if the current file or directory is a bundle.

Returns
true if the current file is a bundle, otherwise false.

§ IsReadOnly()

Bool IsReadOnly ( void  )

Checks if the current file or directory is read-only.

Returns
true if the current file is read-only, otherwise false.

§ GetFileTime()

void GetFileTime ( Int32  mode,
LocalFileTime out 
)

Gets a time for the current file or directory.

Parameters
[in]modeThe file time mode: GE_FILETIME
[out]outFilled with the retrieved file time. The caller owns the pointed file time.

§ GetFilename()

Filename GetFilename ( void  )

Gets the name of the current file or directory.

Returns
The name of the current file or directory.