BrowseFiles Class Reference

#include <c4d_file.h>

详细描述

Helper to browse through files.

注意
Has to be created with Alloc() and destroyed with Free() 。使用 AutoAlloc to automate the allocation and destruction based on scope.

公共成员函数

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 模式, LocalFileTime *out)
Filename   GetFilename (void)

私有成员函数

  BrowseFiles ()
  ~BrowseFiles ()

Alloc/Free

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

构造函数 & 析构函数文档编制

◆  BrowseFiles()

BrowseFiles () private

◆  ~BrowseFiles()

~ BrowseFiles () private

成员函数文档编制

◆  Alloc()

static BrowseFiles * Alloc ( )
static

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

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

◆  Free()

static void Free ( BrowseFiles *&  bf )
static

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

参数
[in,out] bf The 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.

参数
[in] directory The directory to browse.
[in] flags The browser files flags: BROWSEFILES

◆  GetNext()

Bool GetNext ( void  )

Gets the next file or subdirectory in the browsed directory.

注意
To retrieve the first file call GetNext() once. Example: AutoAlloc<BrowseFiles> bf; if (bf == nullptr ) return ; bf-> Init (dir, BROWSEFILES_CALCSIZE ); while (bf-> GetNext ()) { GePrint (bf-> GetFilename (). GetString ()); }
返回
true if another file was found, otherwise false .

◆  GetSize()

Int64 GetSize ( void  )

Gets the size for the current file.

返回
The byte size of the file.
警告
Not valid for directories.

◆  IsDir()

Bool IsDir ( void  )

Checks if the current element is a directory.

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

◆  IsHidden()

Bool IsHidden ( void  )

Checks if the current file or directory is hidden.

返回
true if the current file is hidden, otherwise false .

◆  IsBundle()

Bool IsBundle ( void  )

Checks if the current file or directory is a bundle.

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

◆  IsReadOnly()

Bool IsReadOnly ( void  )

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

返回
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.

参数
[in] mode The file time mode: GE_FILETIME
[out] out Filled 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.

返回
The name of the current file or directory.
BrowseFiles::GetFilename
Filename GetFilename(void)
BROWSEFILES_CALCSIZE
#define BROWSEFILES_CALCSIZE
Specifies if BrowseFiles::GetSize() can be called later on. Only works for files, not for folders.
定义: c4d_file.h:900
GePrint
void GePrint(const maxon::String &str)
Filename::GetString
String GetString(void) const
BrowseFiles::Init
void Init(const Filename &directory, Int32 flags)
AutoAlloc
定义: ge_autoptr.h:36
BrowseFiles::GetNext
Bool GetNext(void)