Porytiles
Loading...
Searching...
No Matches
porytiles::ImageLoadError Class Referencefinal

#include <image_load_error.hpp>

Inheritance diagram for porytiles::ImageLoadError:
[legend]
Collaboration diagram for porytiles::ImageLoadError:
[legend]

Classes

struct  ChannelCount
 
struct  OtherLoadError
 

Public Types

enum class  Type { file_not_found , unsupported_channel_count , other_load_error }
 

Public Member Functions

 ImageLoadError (Type type, std::string filename, std::variant< std::monostate, ChannelCount, OtherLoadError > params)
 
Type type () const
 
const std::string & filename () const
 
const std::variant< std::monostate, ChannelCount, OtherLoadError > & params () const
 
std::vector< std::string > details (const TextFormatter &formatter) const override
 Returns a formatted multi-line string representation of the error.
 
std::unique_ptr< Errorclone () const override
 
- Public Member Functions inherited from porytiles::Error
virtual ~Error ()=default
 
virtual std::string join (const TextFormatter &formatter, const std::string &delimiter="\n") const
 

Static Public Member Functions

static ImageLoadError file_not_found (const std::string &filename)
 
static ImageLoadError unsupported_channel_count (const std::string &filename, int channel_count)
 
static ImageLoadError other_load_error (const std::string &filename, const std::string &error_msg)
 

Detailed Description

Definition at line 13 of file image_load_error.hpp.

Member Enumeration Documentation

◆ Type

Enumerator
file_not_found 
unsupported_channel_count 
other_load_error 

Definition at line 15 of file image_load_error.hpp.

Constructor & Destructor Documentation

◆ ImageLoadError()

porytiles::ImageLoadError::ImageLoadError ( Type  type,
std::string  filename,
std::variant< std::monostate, ChannelCount, OtherLoadError params 
)
inline

Definition at line 25 of file image_load_error.hpp.

Member Function Documentation

◆ clone()

std::unique_ptr< Error > porytiles::ImageLoadError::clone ( ) const
inlineoverridevirtual

Implements porytiles::Error.

Definition at line 83 of file image_load_error.hpp.

◆ details()

std::vector< std::string > porytiles::ImageLoadError::details ( const TextFormatter formatter) const
inlineoverridevirtual

Returns a formatted multi-line string representation of the error.

Each element in the returned vector represents one line of the error message. The TextFormatter controls whether ANSI styling codes are included based on TTY status.

Parameters
formatterThe TextFormatter to use for conditional formatting based on TTY status
Returns
A vector of formatted strings describing the error, one per line

Implements porytiles::Error.

Definition at line 59 of file image_load_error.hpp.

◆ file_not_found()

static ImageLoadError porytiles::ImageLoadError::file_not_found ( const std::string &  filename)
inlinestatic

Definition at line 31 of file image_load_error.hpp.

◆ filename()

const std::string & porytiles::ImageLoadError::filename ( ) const
inline

Definition at line 50 of file image_load_error.hpp.

◆ other_load_error()

static ImageLoadError porytiles::ImageLoadError::other_load_error ( const std::string &  filename,
const std::string &  error_msg 
)
inlinestatic

Definition at line 41 of file image_load_error.hpp.

◆ params()

const std::variant< std::monostate, ChannelCount, OtherLoadError > & porytiles::ImageLoadError::params ( ) const
inline

Definition at line 54 of file image_load_error.hpp.

◆ type()

Type porytiles::ImageLoadError::type ( ) const
inline

Definition at line 46 of file image_load_error.hpp.

◆ unsupported_channel_count()

static ImageLoadError porytiles::ImageLoadError::unsupported_channel_count ( const std::string &  filename,
int  channel_count 
)
inlinestatic

Definition at line 36 of file image_load_error.hpp.


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