wavelength 1.0.0
Loading...
Searching...
No Matches
Tools::BuildImage::Udf::Volume Class Referenceabstract

The data sectors of an ISO9660 volume, from a disc image or built from a disc root. More...

#include <volume.h>

Inheritance diagram for Tools::BuildImage::Udf::Volume:

Public Types

using Sector = std::array<std::uint8_t, kSectorData>
 The data bytes of one sector.

Public Member Functions

virtual ~Volume ()=default
 Release the medium.
virtual std::expected< LocatedFile, Error > find (const std::string &name)=0
 Locate a file by name anywhere in the tree, ignoring case.
virtual std::expected< void, Error > readSector (std::uint32_t lba, std::span< std::uint8_t, kSectorData > sector)=0
 Read the data bytes of one sector.
virtual std::expected< std::size_t, Error > readSectors (std::uint32_t lba, std::span< std::uint8_t > sectors)
 Read the data bytes of consecutive sectors, stopping where the medium ends.
virtual std::uint32_t volumeSectors () const=0
 Report the sector count of the volume.
std::expected< std::string, Error > bootExecutable ()
 Read the name of the executable the disc boots.

Static Public Member Functions

static std::expected< std::string, Error > parseBoot2 (std::span< const std::uint8_t > data)
 Read the executable name from the text of SYSTEM.CNF.
static std::uint32_t sectorsFor (std::uint64_t size)
 Count the sectors that a length in bytes occupies.
static std::string upperAscii (std::string_view text)
 Convert the ASCII letters of a text to upper case.
static std::string lowerAscii (std::string_view text)
 Convert the ASCII letters of a text to lower case.
static std::string ambiguousName (std::string_view name, const std::vector< std::filesystem::path > &matches)
 Describe a name that several files share once case is ignored.
static std::unexpected< Error > pastEnd (std::uint32_t lba)
 Report that a sector lies past the end of the medium.

Static Public Attributes

static constexpr std::size_t kSectorData = 2048
 Data bytes in one sector.
static constexpr std::uint32_t kPvdSector = 16
 Sector of the primary volume descriptor.
static constexpr std::string_view kPvdMagic = "CD001"
 Identifier of an ISO9660 volume descriptor.
static constexpr std::string_view kSystemCnf = "SYSTEM.CNF"
 Name of the boot configuration file.
static constexpr std::string_view kPalExecutable = "SCES_517.06"
 Executable of the European release.
static constexpr std::string_view kNtscExecutable = "SCUS_972.58"
 Executable of the North American release.

Detailed Description

The data sectors of an ISO9660 volume, from a disc image or built from a disc root.

Member Typedef Documentation

◆ Sector

using Tools::Common::Volume::Sector = std::array<std::uint8_t, kSectorData>

The data bytes of one sector.

Constructor & Destructor Documentation

◆ ~Volume()

virtual Tools::Common::Volume::~Volume ( )
virtualdefault

Release the medium.

Member Function Documentation

◆ find()

virtual std::expected< LocatedFile, Error > Tools::Common::Volume::find ( const std::string & name)
pure virtual

Locate a file by name anywhere in the tree, ignoring case.

Parameters
nameFile name without the version suffix.
Returns
Extent and containing directory of the match, or an error when the file is missing, several files have the name once case is ignored, or the file spans several extents.

◆ readSector()

virtual std::expected< void, Error > Tools::Common::Volume::readSector ( std::uint32_t lba,
std::span< std::uint8_t, kSectorData > sector )
pure virtual

Read the data bytes of one sector.

Parameters
lbaSector number.
sectorDestination of the 2048 data bytes.
Returns
Nothing, or an error when the medium ends before the sector.

◆ readSectors()

virtual std::expected< std::size_t, Error > Tools::Common::Volume::readSectors ( std::uint32_t lba,
std::span< std::uint8_t > sectors )
virtual

Read the data bytes of consecutive sectors, stopping where the medium ends.

Parameters
lbaFirst sector number.
sectorsDestination, a whole number of sectors long.
Returns
Number of sectors read in full, or an error when a source file cannot be read.

◆ volumeSectors()

virtual std::uint32_t Tools::Common::Volume::volumeSectors ( ) const
nodiscardpure virtual

Report the sector count of the volume.

Returns
Sectors described by the primary volume descriptor.

◆ bootExecutable()

std::expected< std::string, Error > Tools::Common::Volume::bootExecutable ( )

Read the name of the executable the disc boots.

Returns
File name from the BOOT2 line of SYSTEM.CNF, without the version suffix, or an error when SYSTEM.CNF does not boot a known release.

◆ parseBoot2()

std::expected< std::string, Error > Tools::Common::Volume::parseBoot2 ( std::span< const std::uint8_t > data)
static

Read the executable name from the text of SYSTEM.CNF.

Parameters
dataContents of SYSTEM.CNF.
Returns
File name from the BOOT2 line, without the version suffix, or an error when the text does not have a BOOT2 line or the line identifies an unknown executable.

◆ sectorsFor()

std::uint32_t Tools::Common::Volume::sectorsFor ( std::uint64_t size)
static

Count the sectors that a length in bytes occupies.

Parameters
sizeLength in bytes.
Returns
Sectors, rounded up.

◆ upperAscii()

std::string Tools::Common::Volume::upperAscii ( std::string_view text)
static

Convert the ASCII letters of a text to upper case.

Parameters
textText to convert.
Returns
The text with each ASCII letter in upper case.

◆ lowerAscii()

std::string Tools::Common::Volume::lowerAscii ( std::string_view text)
static

Convert the ASCII letters of a text to lower case.

Parameters
textText to convert.
Returns
The text with each ASCII letter in lower case.

◆ ambiguousName()

std::string Tools::Common::Volume::ambiguousName ( std::string_view name,
const std::vector< std::filesystem::path > & matches )
static

Describe a name that several files share once case is ignored.

Parameters
nameThe name looked up.
matchesPaths of the files with the name.
Returns
The error message.

◆ pastEnd()

std::unexpected< Error > Tools::Common::Volume::pastEnd ( std::uint32_t lba)
static

Report that a sector lies past the end of the medium.

Parameters
lbaSector number.
Returns
The error.

Member Data Documentation

◆ kSectorData

std::size_t Tools::Common::Volume::kSectorData = 2048
staticconstexpr

Data bytes in one sector.

◆ kPvdSector

std::uint32_t Tools::Common::Volume::kPvdSector = 16
staticconstexpr

Sector of the primary volume descriptor.

◆ kPvdMagic

std::string_view Tools::Common::Volume::kPvdMagic = "CD001"
staticconstexpr

Identifier of an ISO9660 volume descriptor.

◆ kSystemCnf

std::string_view Tools::Common::Volume::kSystemCnf = "SYSTEM.CNF"
staticconstexpr

Name of the boot configuration file.

◆ kPalExecutable

std::string_view Tools::Common::Volume::kPalExecutable = "SCES_517.06"
staticconstexpr

Executable of the European release.

◆ kNtscExecutable

std::string_view Tools::Common::Volume::kNtscExecutable = "SCUS_972.58"
staticconstexpr

Executable of the North American release.


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