resonance 1.0.1
Loading...
Searching...
No Matches
Tools Namespace Reference

Host tools that the build runs. More...

Namespaces

namespace  BuildImage
 Writer of a FreQuency disc image with the built executable and module in place.
namespace  CreditsAvatar
 Generator of the credits avatar header.
namespace  NameIrx
 Writer of the module name into the .iopmod header of an IRX.

Classes

struct  Error
 Failure returned through std::expected. More...

Enumerations

enum class  ErrorCode { InvalidInput , Io , Network , Process }
 Kind of failure a tool reports. More...

Functions

std::expected< std::vector< std::uint8_t >, Error > readFile (const std::filesystem::path &path)
 Read a whole file.
std::expected< void, Error > writeFile (const std::filesystem::path &path, std::span< const std::uint8_t > data)
 Replace a file with the given bytes.
std::expected< void, Error > writeFile (const std::filesystem::path &path, std::string_view text)
 Replace a file with the given text, written as is.
void setupLogging (bool debug)
 Send log messages to standard error as LEVEL: message, the format of Python's logging.basicConfig(format='%(levelname)s: %(message)s').

Detailed Description

Host tools that the build runs.

Enumeration Type Documentation

◆ ErrorCode

enum class Tools::ErrorCode
strong

Kind of failure a tool reports.

Enumerator
InvalidInput 

An input file does not have the expected format.

Io 

Reading or writing a file failed.

Network 

A download failed.

Process 

A child process failed.

Function Documentation

◆ readFile()

std::expected< std::vector< std::uint8_t >, Error > Tools::readFile ( const std::filesystem::path & path)

Read a whole file.

Parameters
pathFile to read.
Returns
The file contents, or an ErrorCode::Io error.

◆ writeFile() [1/2]

std::expected< void, Error > Tools::writeFile ( const std::filesystem::path & path,
std::span< const std::uint8_t > data )

Replace a file with the given bytes.

Parameters
pathFile to write.
dataNew contents.
Returns
Nothing, or an ErrorCode::Io error.

◆ writeFile() [2/2]

std::expected< void, Error > Tools::writeFile ( const std::filesystem::path & path,
std::string_view text )

Replace a file with the given text, written as is.

Parameters
pathFile to write.
textNew contents.
Returns
Nothing, or an ErrorCode::Io error.

◆ setupLogging()

void Tools::setupLogging ( bool debug)

Send log messages to standard error as LEVEL: message, the format of Python's logging.basicConfig(format='%(levelname)s: %(message)s').

Parameters
debugWhether debug messages are shown. Information and higher levels are always shown.