VideoTools
|
Holds ribbon data that can be used to add a ribbon widget to a video stream display. More...
#include <gvribbon.h>
Classes | |
struct | Item |
A time bucket within a Gv::Ribbon. More... | |
Public Types | |
typedef std::vector< Item > | List |
Public Member Functions | |
Ribbon () | |
Default constructor for a zero-size() ribbon. | |
Ribbon (size_t size, const G::Path &base, const std::string &name, const Gv::Timezone &tz) | |
Constructor. More... | |
void | scan (const G::Path &path, size_t tpos) |
Does a complete scan for the day that encompases the given timestamped() file. More... | |
void | scan (const RibbonRange &range) |
Does a complete scan for the given day range. | |
bool | scanStart (G::FileTree &, const RibbonRange &range) |
Prepares for an iterative scan, with subsequent calls to scanSome(). More... | |
bool | scanStart (G::FileTree &, const G::Path &path, size_t tpos) |
Prepares for an iterative scan, with subsequent calls to scanSome(). More... | |
bool | scanSome (G::FileTree &, G::EpochTime interval) |
Does a partial scan, limited by the given time interval. More... | |
G::Path | find (size_t offset, bool before=false) const |
Finds the first scanned path at-or-after the given bucket position, or returns the last() path if there are no paths at-or-after the given position. More... | |
G::Path | last () const |
Returns the last scanned path. More... | |
G::Path | first () const |
Returns the first scanned path. More... | |
bool | apply (const G::Path &) |
Called when a possibly-new timestamped file is encountered, allowing the ribbon to update itself for that file. More... | |
size_t | size () const |
Returns the size of the list, as passed in to the constructor. | |
size_t | timepos (const G::Path &path) const |
Returns the timestamp position within the given path, or zero if none. | |
bool | timestamped (const G::Path &path) const |
Returns true if the given absolute path has a non-zero timepos(). | |
List::const_iterator | begin () const |
Returns the item list's begin iterator. | |
List::const_iterator | end () const |
Returns the item list's end iterator. | |
const RibbonRange & | range () const |
Returns the current day range. | |
RibbonRange | range (int day_offset) const |
Returns a day range that is offset from the current day. | |
void | mark (const G::Path &) |
Marks the bucket that contains the given path. More... | |
Static Public Member Functions | |
static int | height () |
Returns a suggested height of the ribbon, in pixels. | |
static size_t | timepos (const G::Path &path, const std::string &name) |
Returns the timestamp position within the given path, or zero if none. | |
Holds ribbon data that can be used to add a ribbon widget to a video stream display.
The ribbon is populated by searching the filesystem for files with a suitable 'timestampy' path, ie. like '/base/yyyy/mm/dd/hh/mm/ss.ext' or '/base/yyyy/mm/dd/hh/mm/ss/xxx.ext'. If the timestamp is in the relevant range the file is allocated into one of a number of time buckets.
Definition at line 103 of file gvribbon.h.
Gv::Ribbon::Ribbon | ( | size_t | size, |
const G::Path & | base, | ||
const std::string & | name, | ||
const Gv::Timezone & | tz | ||
) |
Constructor.
The size parameter is the number of time buckets, which is typically the number of horizontal pixels. The base directory and timezone parameters are used in scan()ning. Use scan() to populate the ribbon.
Definition at line 39 of file gvribbon.cpp.
bool Gv::Ribbon::apply | ( | const G::Path & | path | ) |
Called when a possibly-new timestamped file is encountered, allowing the ribbon to update itself for that file.
Returns true if the apply()d file is outside the existing day range, implying that the ribbon needs to be rescanned.
Definition at line 154 of file gvribbon.cpp.
G::Path Gv::Ribbon::find | ( | size_t | offset, |
bool | before = false |
||
) | const |
Finds the first scanned path at-or-after the given bucket position, or returns the last() path if there are no paths at-or-after the given position.
Alternatively, finds the first scanned path at-or-before the given position, or returns the first() path if there are no paths at-or-before the given position. Precondition: offset < size()
Definition at line 215 of file gvribbon.cpp.
G::Path Gv::Ribbon::first | ( | ) | const |
Returns the first scanned path.
Returns the empty path if all the buckets are empty.
Definition at line 198 of file gvribbon.cpp.
G::Path Gv::Ribbon::last | ( | ) | const |
Returns the last scanned path.
Returns the empty path if all the buckets are empty.
Definition at line 206 of file gvribbon.cpp.
void Gv::Ribbon::mark | ( | const G::Path & | ) |
Marks the bucket that contains the given path.
Marks on other buckets are cleared. See Gv::Ribbon::Item::marked().
void Gv::Ribbon::scan | ( | const G::Path & | path, |
size_t | tpos | ||
) |
Does a complete scan for the day that encompases the given timestamped() file.
Precondition: timestamped(path)
Definition at line 92 of file gvribbon.cpp.
bool Gv::Ribbon::scanSome | ( | G::FileTree & | file_tree, |
G::EpochTime | interval | ||
) |
Does a partial scan, limited by the given time interval.
Returns true if the scan is complete.
Definition at line 131 of file gvribbon.cpp.
bool Gv::Ribbon::scanStart | ( | G::FileTree & | file_tree, |
const RibbonRange & | range | ||
) |
Prepares for an iterative scan, with subsequent calls to scanSome().
The default-constructed G::FileTree object contains the scan state. Returns true if there is scanSome() work to do.
Definition at line 114 of file gvribbon.cpp.
bool Gv::Ribbon::scanStart | ( | G::FileTree & | file_tree, |
const G::Path & | path, | ||
size_t | tpos | ||
) |
Prepares for an iterative scan, with subsequent calls to scanSome().
The default-constructed G::FileTree object contains the scan state. Returns true if there is scanSome() work to do. Precondition: timestamped(path)
Definition at line 108 of file gvribbon.cpp.