arcstk::v_1_0_0::TOC class final

Table of contents of a compact disc.

A TOC contains the total number of tracks, their offsets and optionally their lengths, their filenames and the index of the leadout frame. Offsets and lengths are represented in LBA frames.

A TOC is an object constructed from parsed data. It is therefore not modifiable.

TOCs can exclusively be built by build functions called make_toc(). Those functions guarantee to provide either a valid TOC or to throw an InvalidMetadataException. This entails that any concrete TOC provides the guarantee that its content is consistent.

Although an existing TOC is therefore always valid it might not be complete() i.e. it may lack information about the absolute size of the audio part and therefore no leadout information.

In some cases it may be reasonable to construct an incomplete TOC, i.e. a TOC without a leadout offset. Some toc formats (as for example CueSheet) may not provide the leadout but the parsed metadata is required. In this case, the leadout can be obtained from the actual audio data. However, also an incomplete TOC may never be inconsistent.

Constructors, destructors, conversion operators

TOC(const TOC& rhs)
Copy constructor.
TOC(TOC&& rhs) noexcept
Move constructor.
~TOC() noexcept
Default constructor.

Public functions

auto complete() const -> bool noexcept
Return TRUE iff TOC information is complete, otherwise FALSE.
auto filename(const TrackNo idx) const -> std::string
Return the file of the 1-based specified track, i.e. file(i) is the offset for track i iff i is a valid track number in this TOC.
auto leadout() const -> lba_count_t noexcept
Return the leadout frame LBA address.
auto offset(const TrackNo idx) const -> lba_count_t
Return the offset of the 1-based specified track in frames, i.e. offsets(i) is the offset for track i iff i is a valid track number in this TOC, otherwise 0.
auto parsed_length(const TrackNo idx) const -> lba_count_t
Return the length of the 1-based specified track in frames as parsed from the toc metadata input.
auto total_tracks() const -> int noexcept
Return the total number of tracks.
void update(const lba_count_t leadout)
Updates the leadout iff leadout validates.

Function documentation

arcstk::v_1_0_0::TOC::TOC(const TOC& rhs)

Copy constructor.

Parameters
rhs in Instance to copy

arcstk::v_1_0_0::TOC::TOC(TOC&& rhs) noexcept

Move constructor.

Parameters
rhs in Instance to move

bool arcstk::v_1_0_0::TOC::complete() const noexcept

Return TRUE iff TOC information is complete, otherwise FALSE.

Returns TRUE iff TOC information is complete, otherwise FALSE.

A TOC t is complete, if t.leadout() != 0, otherwise it is not complete.

std::string arcstk::v_1_0_0::TOC::filename(const TrackNo idx) const

Return the file of the 1-based specified track, i.e. file(i) is the offset for track i iff i is a valid track number in this TOC.

Parameters
idx in 1-based track number
Returns File of specified track

If all tracks are part of the same file, a call of file(i) will yield a string with identical content for any i.

If the file for this track is not specified, an empty string is returned.

lba_count_t arcstk::v_1_0_0::TOC::leadout() const noexcept

Return the leadout frame LBA address.

Returns The leadout frame index

Should be either 0 if unknown, or, if known, equal to the sum of offset(total_tracks()) and length(total_tracks()).

lba_count_t arcstk::v_1_0_0::TOC::offset(const TrackNo idx) const

Return the offset of the 1-based specified track in frames, i.e. offsets(i) is the offset for track i iff i is a valid track number in this TOC, otherwise 0.

Parameters
idx in 1-based track number
Returns Offset of specified track

lba_count_t arcstk::v_1_0_0::TOC::parsed_length(const TrackNo idx) const

Return the length of the 1-based specified track in frames as parsed from the toc metadata input.

Parameters
idx in 1-based track number
Returns Length of specified track

If the length for this track is not known, 0 is returned.

int arcstk::v_1_0_0::TOC::total_tracks() const noexcept

Return the total number of tracks.

Returns Number of tracks

void arcstk::v_1_0_0::TOC::update(const lba_count_t leadout)

Updates the leadout iff leadout validates.

Parameters
leadout in The new leadout to update the TOC with
Exceptions
InvalidMetadateException iff validation fails

If leadout does not validate against the existing values, an InvalidMetadataException is thrown.