Rhino C++ API
8.10
|
#include <opennurbs_file_utilities.h>
Public Member Functions | |
ON_FileIterator ()=default | |
~ON_FileIterator () | |
ON__UINT64 | CurrentItemCount () const |
const ON_wString | CurrentItemFullPathName () const |
bool | CurrentItemIsDirectory () const |
bool | CurrentItemIsFile () const |
bool | CurrentItemIsHidden () const |
ON__UINT64 | CurrentItemLastModifiedTime () const |
const ON_wString | CurrentItemName () const |
ON__UINT64 | CurrentItemSize () const |
const ON_wString | DirectoryName () const |
bool | FirstItem () |
bool | Initialize (const char *directory_name) |
bool | Initialize (const char *directory_name, const char *item_name_filter) |
bool | Initialize (const wchar_t *directory_name) |
bool | Initialize (const wchar_t *directory_name, const wchar_t *item_name_filter) |
bool | NextItem () |
void | Reset () |
Description: Iterates through every item in a file system directory.
|
default |
ON_FileIterator::~ON_FileIterator | ( | ) |
ON__UINT64 ON_FileIterator::CurrentItemCount | ( | ) | const |
Returns: Number of matching items iterated through.
const ON_wString ON_FileIterator::CurrentItemFullPathName | ( | ) | const |
bool ON_FileIterator::CurrentItemIsDirectory | ( | ) | const |
Returns true if the current item is a directory.
bool ON_FileIterator::CurrentItemIsFile | ( | ) | const |
Returns true if the current item is a file.
bool ON_FileIterator::CurrentItemIsHidden | ( | ) | const |
Returns true if the current file or directory is hidden. This means its name begins with a '.' or it's Windows hidden attribute is true.
ON__UINT64 ON_FileIterator::CurrentItemLastModifiedTime | ( | ) | const |
Returns: File last modified time in seconds since January 1, 1970 Remarks: The times returned by ON_FileIterator can differ from the time returned by ON_FileStream::GetFileInformation().
const ON_wString ON_FileIterator::CurrentItemName | ( | ) | const |
Current item query Returns: Current file or directory name in the directory being iterated. Use CurrentFullPathItemName() to get the full path name.
ON__UINT64 ON_FileIterator::CurrentItemSize | ( | ) | const |
Returns: If the current item is a file, then the size of the file in bytes is returned. If the current item is a directory, then 0 is returned.
const ON_wString ON_FileIterator::DirectoryName | ( | ) | const |
Returns: The name of the directory being iterated.
bool ON_FileIterator::FirstItem | ( | ) |
Iteration tools Description: Find the first matching item in the directory. Example: / Iterate through the files in a directory named "\rootdir\subdir" ON_FileIterator fit; fit.Initialize("\\rootdir\\subdir"); for ( bool bHaveItem = fit.FirstItem(); bHaveItem; bHaveItem = fit.NextItem() ) { if ( fit.CurrentFileIsDirectory() ) continue; ON_String fullpath = fit.CurrentItemFullPathName(); FILE* fp = ON_FileStream::Open(fullpath,"rb"); if ( 0 == fp ) { continue; } ... ON_FileStream::Close(fp); fp = 0; } }
Returns: true: The iterator is set to the first item. false: There are no matching items.
bool ON_FileIterator::Initialize | ( | const char * | directory_name | ) |
bool ON_FileIterator::Initialize | ( | const char * | directory_name, |
const char * | item_name_filter | ||
) |
bool ON_FileIterator::Initialize | ( | const wchar_t * | directory_name | ) |
Iteration initialization tools Description: Initialize where the search should occur. Parameters: directory_name - [in] The directory to look in. item_name_filter - [in] If this parameter is null, then the iteration includes all names in the directory. The item name to search for. This parameter can include wildcard characters, such as an asterisk (*) or a question mark (?). For example, "\rootdir\subdir\*.*" will iterate all files in the \rootdir\subdir\ directory.
Returns: true: The iterator is set to the first item. false: There are no matching items.
Remarks: Calling FirstItem() is equivalent to calling Initialize() and then calling NextItem().
bool ON_FileIterator::Initialize | ( | const wchar_t * | directory_name, |
const wchar_t * | item_name_filter | ||
) |
bool ON_FileIterator::NextItem | ( | ) |
Description: Find the next matching item in the directory. Returns: true: The iterator was advanced to the next item. false: There are no more matching items.
void ON_FileIterator::Reset | ( | ) |
Description: Reset this ON_FileIterator so it can be used again.