#include <FileSet.h>
Public Member Functions | |
bool | find (const char *pathname) |
int | finddirfor (const char *pathname) |
int | finddir (const char *dirname, int length=0) |
bool | find (int dirnumber, const char *filename) |
const std::vector< const char * > & | list (int dirnumber) |
const std::vector< const char * > & | list (const char *dirname) |
void | reload () |
Rather simple caching mechanism to see if a file you are interested in exists. Each time you look for a file, the entire directory that the file is in is added to the set. This makes checking for another file in the same directory much faster.
Warning: strict equality (like Unix) of the filenames is required.
bool DD::Image::FileSet::find | ( | const char * | pathname | ) |
int DD::Image::FileSet::finddirfor | ( | const char * | pathname | ) |
Return finddir of the directory that starts the name. Everything up to the last slash is used.
References finddir().
int DD::Image::FileSet::finddir | ( | const char * | dirname, |
int | length = 0 |
||
) |
Return an index number to identify the given directory. This can be used to look up names in that directory without having to paste them together in a buffer.
length is the offset of the '/' or one character after it that ends the directory name, this allows you to request a directory from a full path name without having to copy and null-terminate it. If length is zero then strlen(name) is used.
If this is a new directory, the actual scan of the disk is not done until a find() is done for a file that matches this directory.
Referenced by find(), and finddirfor().
bool DD::Image::FileSet::find | ( | int | dirnumber, |
const char * | filename | ||
) |
Return true if the file with the given name exists in the directory identified by dirnumber, this is a value returned by finddir().
const std::vector< const char * > & DD::Image::FileSet::list | ( | int | dirnumber | ) |
Return a vector of all the filenames (except "." and "..") in the given directory. Non-existent and empty directories both return an empty list. This is very fast the second time the directory is asked for.
Referenced by DD::Image::plugin_path_list().
void DD::Image::FileSet::reload | ( | ) |
Cause it to reload all directories in the FileSet.
Referenced by DD::Image::plugin_find().
©2024 The Foundry Visionmongers, Ltd. All Rights Reserved. |