Pyrogenesis  trunk
Typedefs | Enumerations | Functions
vfs Namespace Reference

Typedefs

typedef Status(* FileCallback) (const VfsPath &pathname, const CFileInfo &fileInfo, const uintptr_t cbData)
 called for files in a directory. More...
 
typedef Status(* DirCallback) (const VfsPath &pathname, const uintptr_t cbData)
 called for directories in a directory. More...
 

Enumerations

enum  DirFlags { DIR_RECURSIVE = 1 }
 

Functions

Status GetPathnames (const PIVFS &fs, const VfsPath &path, const wchar_t *filter, VfsPaths &pathnames)
 
Status ForEachFile (const PIVFS &fs, const VfsPath &path, FileCallback cb, uintptr_t cbData, const wchar_t *pattern=0, size_t flags=0, DirCallback dircb=NULL, uintptr_t dircbData=0)
 call back for each file in a directory tree, and optionally each directory. More...
 
void NextNumberedFilename (const PIVFS &fs, const VfsPath &pathnameFormat, size_t &nextNumber, VfsPath &nextPathname)
 Determine the next available pathname with a given format. More...
 

Typedef Documentation

typedef Status(* vfs::DirCallback) (const VfsPath &pathname, const uintptr_t cbData)

called for directories in a directory.

Parameters
pathnamefull pathname
cbDatauser-specified context
Returns
INFO::OK on success; any other value will immediately be returned to the caller (no more calls will be forthcoming).

CAVEAT: pathname only valid until the function returns!

typedef Status(* vfs::FileCallback) (const VfsPath &pathname, const CFileInfo &fileInfo, const uintptr_t cbData)

called for files in a directory.

Parameters
pathnamefull pathname (since CFileInfo only gives the name).
fileInfofile information
cbDatauser-specified context
Returns
INFO::OK on success; any other value will immediately be returned to the caller (no more calls will be forthcoming).

CAVEAT: pathname and fileInfo are only valid until the function returns!

Enumeration Type Documentation

Enumerator
DIR_RECURSIVE 

Function Documentation

Status vfs::ForEachFile ( const PIVFS fs,
const VfsPath path,
FileCallback  cb,
uintptr_t  cbData,
const wchar_t pattern = 0,
size_t  flags = 0,
DirCallback  dircb = NULL,
uintptr_t  dircbData = 0 
)

call back for each file in a directory tree, and optionally each directory.

Parameters
fs
path
cbFileCallback
cbData
patternthat file names must match. '*' and '&' wildcards are allowed. 0 matches everything.
flagsDirFlags
dircbDirCallback
dircbData
Returns
Status
Status vfs::GetPathnames ( const PIVFS fs,
const VfsPath path,
const wchar_t filter,
VfsPaths pathnames 
)
void vfs::NextNumberedFilename ( const PIVFS fs,
const VfsPath pathnameFormat,
size_t &  nextNumber,
VfsPath nextPathname 
)

Determine the next available pathname with a given format.

This is useful when creating new files without overwriting the previous ones (screenshots are a good example).

Parameters
fs
pathnameFormatFormat string for the pathname; must contain one format specifier for an integer. Example: "screenshots/screenshot%04d.png"
nextNumberin: the first number to try; out: the next number. If 0, numbers corresponding to existing files are skipped.
nextPathnamereceives the output.