Fileseq C++ API
A library for parsing file sequence strings commonly used in VFX and animation applications.
fileseq::FrameSet Class Reference

#include <frameset.h>

Public Member Functions

 FrameSet (const std::string &frange, Status *ok=nullptr)
 
 FrameSet ()
 
 FrameSet (const FrameSet &rhs)
 
FrameSetoperator= (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)
 

Detailed Description

FrameSet wraps a sequence of frames in container that exposes array-like operations and queries, after parsing the given frame range string.

Constructor & Destructor Documentation

◆ FrameSet() [1/2]

fileseq::FrameSet::FrameSet ( const std::string &  frange,
Status ok = nullptr 
)
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.

◆ FrameSet() [2/2]

fileseq::FrameSet::FrameSet ( )

Default Constructor - Invalid FrameSet

Member Function Documentation

◆ frame()

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

Here is the call graph for this function:

◆ frameRange()

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

Here is the call graph for this function:

◆ frames()

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.

Here is the call graph for this function:

◆ index()

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

Here is the call graph for this function:

◆ inverted()

FrameSet fileseq::FrameSet::inverted ( ) const

Invert returns a new FrameSet that represents all frames not within the current FrameSet. That is, it will create a range that "fills in" the current one.

Here is the call graph for this function:

◆ invertedFrameRange()

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.

Here is the call graph for this function:

◆ iterFrames()

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; }

Here is the call graph for this function:

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