Fileseq C++ API
A library for parsing file sequence strings commonly used in VFX and animation applications.
|
#include <frameset.h>
Public Member Functions | |
FrameSet (const std::string &frange, Status *ok=nullptr) | |
FrameSet () | |
FrameSet (const FrameSet &rhs) | |
FrameSet & | operator= (FrameSet rhs) |
bool | isValid () const |
Return whether the FrameSet is properly parsed and valid as a range. | |
std::string | string () const |
The string representation of the frame range. | |
operator std::string () const | |
size_t | length () const |
The number of frames in the range. | |
size_t | index (Frame frame) const |
Frame | frame (size_t index, Status *ok=nullptr) const |
void | frames (Frames &frames) const |
RangesIterator | iterFrames () const |
bool | hasFrame (Frame frame) const |
HasFrame returns true if the FrameSet contains the given frame value. | |
Frame | start () const |
The first frame of the range. | |
Frame | end () const |
The last frame in the range. | |
std::string | frameRange (int pad=0) const |
FrameSet | inverted () const |
std::string | invertedFrameRange (int pad) const |
FrameSet | normalized () const |
Normalize returns a new sorted and compacted FrameSet. | |
Friends | |
class | FileSequence |
void | swap (FrameSet &first, FrameSet &second) |
std::ostream & | operator<< (std::ostream &stream, const FrameSet &fs) |
FrameSet wraps a sequence of frames in container that exposes array-like operations and queries, after parsing the given frame range string.
|
explicit |
Create a new FrameSet from a given frame range string. If the frame range could not be parsed, the FrameSet.isValid() and the Status will be set.
fileseq::FrameSet::FrameSet | ( | ) |
Default Constructor - Invalid FrameSet
Frame fileseq::FrameSet::frame | ( | size_t | index, |
Status * | ok = nullptr |
||
) | const |
Frame returns the frame number value for a given index into the frame set. If the index is outside the bounds of the frame set range, then an error is returned as a Status
std::string fileseq::FrameSet::frameRange | ( | int | pad = 0 | ) | const |
FrameRange returns the range string that was used to initialize the FrameSet. If a pad value is given, return a range string with each number padded out with zeros to a given width
void fileseq::FrameSet::frames | ( | Frames & | frames | ) | const |
Frames returns a slice of the frame numbers that were parsed from the original frame range string.
Warning: This allocates a slice containing number of elements equal to the length() of the range. It is better to use iterFrames() for large ranges.
size_t fileseq::FrameSet::index | ( | Frame | frame | ) | const |
Index returns the index position of the frame value within the frame set. If the given frame does not exist, then return -1
FrameSet fileseq::FrameSet::inverted | ( | ) | const |
std::string fileseq::FrameSet::invertedFrameRange | ( | int | pad | ) | const |
InvertedFrameRange returns a new frame range string that represents all frames not within the current FrameSet. That is, it will create a range that "fills in" the current one.
RangesIterator fileseq::FrameSet::iterFrames | ( | ) | const |
Returns an iterator that can loop over all frame numbers that were parsed from the original frame range string. This is more efficient than calling frames() for larger sequences.
Examples: RangesIterator it = frameSet.iterFrames(); while(it.next()) { Frame f = *it; }