AccurateRip IDs module
Calculate and manage AccurateRip identifier.
ARId is an AccurateRip identifier. It determines the request URL for an album and as well its canonical savefile name. ARIds are constructed by other IDs and metadata like offsets and track count. As a convenience, functions make_
A TOC is the validated table of content information from a compact disc. TOCs are exclusively constructed by functions make_
An InvalidMetadataException indicates that no valid TOC can be constructed from the input provided.
A NonstandardMetadataException indicates that the input is not conforming to the redbook standard. This exception can occurr in the internal validation mechanism but is currently not used in the public API.
Namespaces
- namespace arcstk::v_1_0_0::toc
- Functions assisting the management of TOCs.
Classes
- class arcstk::v_1_0_0::ARId
- AccurateRip-Identifier of a compact disc.
- class arcstk::v_1_0_0::InvalidMetadataException
- Reports invalid metadata for building a TOC.
- class arcstk::v_1_0_0::NonstandardMetadataException
- Reports metadata violating the redbook standard.
- class arcstk::v_1_0_0::TOC
- Table of contents of a compact disc.
Typedefs
-
template<typename T>using IsFilenameContainer = std::enable_if_t<details::is_filename_container<T>::value>
- Defined iff T is a container whose value_type IsFilenameType.
-
template<typename T>using IsFilenameType = std::enable_if_t<details::is_filename_type<T>::value>
- Defined iff T is a filename type, i.e. std::string or std::wstring.
-
template<typename T>using IsLBAContainer = std::enable_if_t<details::is_lba_container<T>::value>
- Defined iff T is a container whose value_type IsLBAType.
-
template<typename T>using IsLBAType = std::enable_if_t<details::is_lba_type<T>::value>
- Defined iff T is a numerical integer type of at least 32 bit size.
Functions
- auto make_arid(const std::unique_ptr<TOC>& toc) -> std::unique_ptr<ARId>
- Create an ARId from a complete() TOC.
- auto make_arid(const TOC& toc) -> std::unique_ptr<ARId>
- Create an ARId from a complete() TOC.
- auto make_arid(const TOC& toc, const lba_count_t leadout) -> std::unique_ptr<ARId>
- Create an ARId from a TOC and a specified leadout.
-
template<typename LBAContainer, typename = IsLBAContainer<LBAContainer>>auto make_arid(const TrackNo track_count, LBAContainer&& offsets, const lba_count_t leadout) -> std::unique_ptr<ARId>
- Create an ARId by track_count, offsets and leadout.
-
template<typename T, typename = IsLBAType<T>>auto make_arid(const TrackNo track_count, std::initializer_list<T> offsets, const lba_count_t leadout) -> std::unique_ptr<ARId>
- Create an ARId by track_count, offsets and leadout.
-
template<typename LBAContainer, typename = IsLBAContainer<LBAContainer>>auto make_arid(LBAContainer&& offsets, const lba_count_t leadout) -> std::unique_ptr<ARId>
- Create an ARId by offsets and leadout.
-
template<typename T, typename = IsLBAType<T>>auto make_arid(std::initializer_list<T> offsets, const lba_count_t leadout) -> std::unique_ptr<ARId>
- Create an ARId by offsets and leadout.
- auto make_empty_arid() -> std::unique_ptr<ARId> noexcept
- Create an empty() ARId.
-
template<typename LBAContainer, typename FilenameContainer = std::vector<std::string>, typename = IsLBAContainer<LBAContainer>, typename = IsFilenameContainer<FilenameContainer>>auto make_toc(const TrackNo track_count, LBAContainer&& offsets, const lba_count_t leadout, FilenameContainer&& files = {}) -> std::unique_ptr<TOC>
- Create a TOC by track count, offsets, leadout and optional filenames.
-
template<typename LBAContainer1, typename LBAContainer2, typename FilenameContainer = std::vector<std::string>, typename = IsLBAContainer<LBAContainer1>, typename = IsLBAContainer<LBAContainer2>, typename = IsFilenameContainer<FilenameContainer>>auto make_toc(const TrackNo track_count, LBAContainer1&& offsets, LBAContainer2&& lengths, FilenameContainer&& files = {}) -> std::unique_ptr<TOC>
- Create a TOC by track count, offsets, lengths and optional filenames.
-
template<typename LBAContainer, typename FilenameContainer = std::vector<std::string>, typename = IsLBAContainer<LBAContainer>, typename = IsFilenameContainer<FilenameContainer>>auto make_toc(LBAContainer&& offsets, const lba_count_t leadout, FilenameContainer&& files = {}) -> std::unique_ptr<TOC>
- Create a TOC by offsets, leadout and optional filenames.
-
template<typename LBAContainer1, typename LBAContainer2, typename FilenameContainer = std::vector<std::string>, typename = IsLBAContainer<LBAContainer1>, typename = IsLBAContainer<LBAContainer2>, typename = IsFilenameContainer<FilenameContainer>>auto make_toc(LBAContainer1&& offsets, LBAContainer2&& lengths, FilenameContainer&& files = {}) -> std::unique_ptr<TOC>
- Create a TOC by offsets, lengths and optional filenames.
Variables
Typedef documentation
#include <identifier.hpp>
template<typename T>
using IsFilenameContainer = std::enable_if_t<details::is_filename_container<T>::value>
Defined iff T is a container whose value_type IsFilenameType.
Template parameters | |
---|---|
T | The type to test |
To qualify as a FilenameContainer, the class must have const versions of begin() and end(), a const_iterator, a size() and a value_type that IsFilenameType.
#include <identifier.hpp>
template<typename T>
using IsFilenameType = std::enable_if_t<details::is_filename_type<T>::value>
Defined iff T is a filename type, i.e. std::string or std::wstring.
Template parameters | |
---|---|
T | The type to test |
#include <identifier.hpp>
template<typename T>
using IsLBAContainer = std::enable_if_t<details::is_lba_container<T>::value>
Defined iff T is a container whose value_type IsLBAType.
Template parameters | |
---|---|
T | The type to test |
To qualify as an LBAContainer, the class must have const versions of begin() and end(), a const_iterator, a size() and a value_type that IsLBAType.
#include <identifier.hpp>
template<typename T>
using IsLBAType = std::enable_if_t<details::is_lba_type<T>::value>
Defined iff T is a numerical integer type of at least 32 bit size.
Template parameters | |
---|---|
T | The type to test |
Function documentation
std::unique_ptr<ARId> make_arid(const std::unique_ptr<TOC>& toc)
#include <identifier.hpp>
Create an ARId from a complete() TOC.
Parameters | |
---|---|
toc in | TOC to use |
Returns | ARId corresponding to the input TOC |
Exceptions | |
InvalidMetadataException | If toc is not complete(). |
The toc
is validated.
std::unique_ptr<ARId> make_arid(const TOC& toc)
#include <identifier.hpp>
Create an ARId from a complete() TOC.
Parameters | |
---|---|
toc in | TOC to use |
Returns | ARId corresponding to the input TOC |
Exceptions | |
InvalidMetadataException | If toc is not complete(). |
The toc
is validated.
std::unique_ptr<ARId> make_arid(const TOC& toc,
const lba_count_t leadout)
#include <identifier.hpp>
Create an ARId from a TOC and a specified leadout.
Parameters | |
---|---|
toc in | TOC to use |
leadout in | Leadout LBA frame |
Returns | ARId |
Exceptions | |
InvalidMetadataException | If toc and leadout are inconsistent |
The input is validated.
Parameter toc
is allowed to be non-complete(). Parameter leadout
is intended to provide the value possibly missing in toc
.
If leadout
is 0, toc.leadout()
is used and leadout
is ignored. If leadout
is not 0, toc.leadout()
is ignored. If both values are 0 an InvalidMetadataException is thrown.
If leadout
is 0 and toc
cannot be validated, an InvalidMetadataException is thrown. If leadout
is not 0 and leadout
and toc
cannot be validated as consistent with each other, an InvalidMetadataException is thrown.
#include <identifier.hpp>
template<typename LBAContainer, typename = IsLBAContainer<LBAContainer>>
std::unique_ptr<ARId> make_arid(const TrackNo track_count,
LBAContainer&& offsets,
const lba_count_t leadout)
Create an ARId by track_count, offsets and leadout.
Template parameters | |
---|---|
LBAContainer | Container type of the offsets container |
Parameters | |
track_count in | Track count |
offsets in | Offsets |
leadout in | Leadout frame |
Returns | An ARId representing the specified information |
Exceptions | |
InvalidMetadataException | If the input forms no valid ARId |
#include <identifier.hpp>
template<typename T, typename = IsLBAType<T>>
std::unique_ptr<ARId> make_arid(const TrackNo track_count,
std::initializer_list<T> offsets,
const lba_count_t leadout)
Create an ARId by track_count, offsets and leadout.
Template parameters | |
---|---|
T | Type of the offsets |
Parameters | |
track_count in | Track count |
offsets in | Offsets |
leadout in | Leadout frame |
Returns | An ARId representing the specified information |
Exceptions | |
InvalidMetadataException | If the input forms no valid ARId |
#include <identifier.hpp>
template<typename LBAContainer, typename = IsLBAContainer<LBAContainer>>
std::unique_ptr<ARId> make_arid(LBAContainer&& offsets,
const lba_count_t leadout)
Create an ARId by offsets and leadout.
Template parameters | |
---|---|
LBAContainer | Container type of the offsets container |
Parameters | |
offsets in | Offsets |
leadout in | Leadout frame |
Returns | An ARId representing the specified information |
Exceptions | |
InvalidMetadataException | If the input forms no valid ARId |
#include <identifier.hpp>
template<typename T, typename = IsLBAType<T>>
std::unique_ptr<ARId> make_arid(std::initializer_list<T> offsets,
const lba_count_t leadout)
Create an ARId by offsets and leadout.
Template parameters | |
---|---|
T | Type of the offsets |
Parameters | |
offsets in | Offsets |
leadout in | Leadout frame |
Returns | An ARId representing the specified information |
Exceptions | |
InvalidMetadataException | If the input forms no valid ARId |
std::unique_ptr<ARId> make_empty_arid() noexcept
#include <identifier.hpp>
Returns | An empty() ARId |
---|
The implementation of make_
#include <identifier.hpp>
template<typename LBAContainer, typename FilenameContainer = std::vector<std::string>, typename = IsLBAContainer<LBAContainer>, typename = IsFilenameContainer<FilenameContainer>>
std::unique_ptr<TOC> make_toc(const TrackNo track_count,
LBAContainer&& offsets,
const lba_count_t leadout,
FilenameContainer&& files = {})
Create a TOC by track count, offsets, leadout and optional filenames.
Template parameters | |
---|---|
LBAContainer | Container type of the offsets container |
FilenameContainer | Container type of the optional filename container |
Parameters | |
track_count in | Number of tracks in this medium |
offsets in | Offsets (in LBA frames) for each track |
leadout in | Leadout frame |
files in | File name of each track |
Returns | A TOC representing the specified information |
Exceptions | |
InvalidMetadataException | If the input forms no valid TOC |
The input data is validated but the leadout is allowed to be 0. The returned TOC is therefore not guaranteed to be complete().
The value of track_count
must be equal to offsets().size()
and is just used for additional validation.
#include <identifier.hpp>
template<typename LBAContainer1, typename LBAContainer2, typename FilenameContainer = std::vector<std::string>, typename = IsLBAContainer<LBAContainer1>, typename = IsLBAContainer<LBAContainer2>, typename = IsFilenameContainer<FilenameContainer>>
std::unique_ptr<TOC> make_toc(const TrackNo track_count,
LBAContainer1&& offsets,
LBAContainer2&& lengths,
FilenameContainer&& files = {})
Create a TOC by track count, offsets, lengths and optional filenames.
Template parameters | |
---|---|
LBAContainer1 | Container type of the offsets container |
LBAContainer2 | Container type of the lengths container |
FilenameContainer | Container type of the optional filename container |
Parameters | |
track_count in | Number of tracks in this medium |
offsets in | Offsets (in LBA frames) of each track |
lengths in | Lengths (in LBA frames) of each track |
files in | File name of each track |
Returns | A TOC representing the specified information |
Exceptions | |
InvalidMetadataException | If the input forms no valid TOC |
The input data is validated but the length of the last track is allowed to be 0. The returned TOC is therefore not guaranteed to be complete().
The value of track_count
must be equal to offsets().size()
and is just used for additional validation.
Value offsets.size()
and lengths.size()
must be equal.
#include <identifier.hpp>
template<typename LBAContainer, typename FilenameContainer = std::vector<std::string>, typename = IsLBAContainer<LBAContainer>, typename = IsFilenameContainer<FilenameContainer>>
std::unique_ptr<TOC> make_toc(LBAContainer&& offsets,
const lba_count_t leadout,
FilenameContainer&& files = {})
Create a TOC by offsets, leadout and optional filenames.
Template parameters | |
---|---|
LBAContainer | Container type of the offsets container |
FilenameContainer | Container type of the optional filename container |
Parameters | |
offsets in | Offsets (in LBA frames) for each track |
leadout in | Leadout frame |
files in | File name of each track |
Returns | A TOC representing the specified information |
Exceptions | |
InvalidMetadataException | If the input forms no valid TOC |
The input data is validated but the leadout is allowed to be 0. The returned TOC is therefore not guaranteed to be complete().
Value offsets.size()
is assumed to be the total number of tracks.
#include <identifier.hpp>
template<typename LBAContainer1, typename LBAContainer2, typename FilenameContainer = std::vector<std::string>, typename = IsLBAContainer<LBAContainer1>, typename = IsLBAContainer<LBAContainer2>, typename = IsFilenameContainer<FilenameContainer>>
std::unique_ptr<TOC> make_toc(LBAContainer1&& offsets,
LBAContainer2&& lengths,
FilenameContainer&& files = {})
Create a TOC by offsets, lengths and optional filenames.
Template parameters | |
---|---|
LBAContainer1 | Container type of the offsets container |
LBAContainer2 | Container type of the lengths container |
FilenameContainer | Container type of the optional filename container |
Parameters | |
offsets in | Offsets (in LBA frames) of each track |
lengths in | Lengths (in LBA frames) of each track |
files in | File name of each track |
Returns | A TOC representing the specified information |
Exceptions | |
InvalidMetadataException | If the input forms no valid TOC |
The input data is validated but the length of the last track is allowed to be 0. The returned TOC is therefore not guaranteed to be complete().
Value offsets.size()
is assumed to be the total number of tracks.
Value offsets.size()
and lengths.size()
must be equal.
Variable documentation
const ARId EmptyARId
#include <identifier.hpp>
Global instance of an empty ARId.
This is for convenience since in most cases, the creation of an empty ARId can be avoided when a reference instance is at hand.
The instance is created using make_