The data sectors of an ISO9660 volume, from a disc image or built from a disc root.
More...
#include <volume.h>
|
| 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 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 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.
|
The data sectors of an ISO9660 volume, from a disc image or built from a disc root.
◆ Sector
The data bytes of one sector.
◆ ~Volume()
| virtual Tools::Common::Volume::~Volume |
( |
| ) |
|
|
virtualdefault |
◆ 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
-
| name | File 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.
Implemented in Tools::BuildImage::DirectoryVolume, and Tools::Common::SourceImage.
◆ readSector()
| virtual std::expected< void, Error > Tools::Common::Volume::readSector |
( |
std::uint32_t | lba, |
|
|
std::span< std::uint8_t, kSectorData > | sector ) |
|
pure virtual |
◆ 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
-
| lba | First sector number. |
| sectors | Destination, a whole number of sectors long. |
- Returns
- Number of sectors read in full, or an error when a source file cannot be read.
Reimplemented in Tools::Common::SourceImage.
◆ volumeSectors()
| virtual std::uint32_t Tools::Common::Volume::volumeSectors |
( |
| ) |
const |
|
nodiscardpure virtual |
◆ 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
-
| data | Contents 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
-
- 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
-
- 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
-
- 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
-
| name | The name looked up. |
| matches | Paths 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
-
- Returns
- The error.
◆ 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: