Deconstructs a numbered name into its prefix, number, and suffix components. More...
#include <numname.h>
Public Member Functions | |
| NumName ()=default | |
| Constructs an invalid (empty) NumName. | |
| NumName (const String &prefix, const String &suffix, int digits, bool padded) | |
| Constructs a NumName from explicit components. | |
| NumName (const String &str) | |
| Constructs a NumName by parsing a string. | |
| bool | isValid () const |
| Checks whether this NumName contains a valid numeric field. | |
| String | name (int val) const |
| Generates a full name string with the given numeric value. | |
| String | prefix () const |
| Returns the prefix portion of the name (text before the number). | |
| String | suffix () const |
| Returns the suffix portion of the name (text after the number). | |
| bool | isPadded () const |
| Checks whether the numeric field is zero-padded. | |
| int | digits () const |
| Returns the number of digits in the numeric field. | |
| String | filemask () const |
| Returns a C-style printf format mask for the numbered name. | |
| String | hashmask () const |
| Returns a hash-style mask for the numbered name. | |
| bool | operator== (const NumName &other) const |
| Returns true if both NumNames have identical components. | |
| bool | operator!= (const NumName &other) const |
| Returns true if the NumNames differ in any component. | |
| bool | isInSequence (const NumName &n) const |
| Checks whether another NumName belongs to the same sequence. | |
Static Public Member Functions | |
| static NumName | parse (const String &str, int *val=nullptr) |
| Parses a string into a NumName. | |
Deconstructs a numbered name into its prefix, number, and suffix components.
Parses strings like "fred-0001", "007 Bond", or "test.098.dpx" into a prefix, a numeric field (with optional zero-padding), and a suffix. Useful for working with numbered file sequences.
Constructs a NumName from explicit components.
| prefix | The string before the number. |
| suffix | The string after the number. |
| digits | The number of digits (including padding). |
| padded | True if the number is zero-padded. |
Constructs a NumName by parsing a string.
| str | The string to parse. |
|
inline |
Returns the number of digits in the numeric field.
|
inline |
Returns a C-style printf format mask for the numbered name.
For example, "file.1234.dpx" yields "file.%d.dpx" and "file.01234.dpx" yields "file.%05d.dpx".
|
inline |
Returns a hash-style mask for the numbered name.
For example, "file.1234.dpx" yields "file.#.dpx" and "file.01234.dpx" yields "file.#####.dpx".
|
inline |
Checks whether the numeric field is zero-padded.
|
inline |
Checks whether this NumName contains a valid numeric field.
|
inline |
Generates a full name string with the given numeric value.
| val | The number to insert into the name. |
|
inline |
Returns the prefix portion of the name (text before the number).
|
inline |
Returns the suffix portion of the name (text after the number).