| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# CS::NumberedFilenameHelper Class Reference

Helper to deal with numbered filename. More...

`#include <cstool/numberedfilenamehelper.h>`

List of all members.

## Public Member Functions
csString | FindNextFilename (iVFS *vfs=0)
| Returns the next unused filename.
csString | NextFilename ()
| Returns the filename with the next higher number.
| NumberedFilenameHelper (const char *mask=0)
| Initialize helper.
void | Reset ()
| Resets the counter to 0.
void | SetMask (const char *mask)
| Set the mask for the filename.

## Detailed Description

Helper to deal with numbered filename.

Takes a mask for a filename, which can contain digits, as input and returns filenames with subsequently increasing numbers. Also can automatically pick an unused filename.

Definition at line 34 of file numberedfilenamehelper.h.

## Constructor & Destructor Documentation

CS::NumberedFilenameHelper::NumberedFilenameHelper | ( | const char * | mask = `0` | ) | `[inline]`

Initialize helper.

See SetMask() for the meaning of `mask`.

Definition at line 42 of file numberedfilenamehelper.h.

## Member Function Documentation

csString CS::NumberedFilenameHelper::FindNextFilename | ( | iVFS * | vfs = `0` | ) |

Returns the next unused filename.

Parameters:

  | vfs | Pointer to VFS interface which is used to test for file existance. If 0, the real filesystem is used.

csString CS::NumberedFilenameHelper::NextFilename | ( |  | ) | `[inline]`

Returns the filename with the next higher number.

Definition at line 63 of file numberedfilenamehelper.h.

void CS::NumberedFilenameHelper::Reset | ( |  | ) | `[inline]`

Resets the counter to 0.

Definition at line 50 of file numberedfilenamehelper.h.

void CS::NumberedFilenameHelper::SetMask | ( | const char * | mask | ) |

Set the mask for the filename.

The rightmost cluster of digits in the filename is replaced with the value of the counter. The format is chosen such that the digits are filled up with leading zeroes. If the filename does not contain any digits, the counter is inserted before the last dot or appended to the end of the name.

The documentation for this class was generated from the following file:

- cstool/numberedfilenamehelper.h