Porytiles
Loading...
Searching...
No Matches
porytiles Namespace Reference

Classes

class  AnyMap
 
class  ArtifactMetadata
 ArtifactMetadata provides a POD-like class for Operation to declare input and output artifact info. More...
 
class  Bgr15
 
class  BgrInternalTile
 
class  BgrPal
 
class  Bin
 
class  CImgPng
 Implementation of Png using the CImg image processing library. More...
 
class  DiagConsumer
 A customizable consumer for diagnostic messages. More...
 
class  DiagEngine
 Coordinates the generation and consumption of diagnostic messages. More...
 
class  DiagTempl
 Defines a reusable template for standardized diagnostic reporting. More...
 
class  FieldmapConfig2
 
class  FreeMetadata
 
class  IgnoreConsumer
 A DiagConsumer implementation that simply ignores the provided diagnostic. More...
 
class  InFlightDiag
 Represents an in-flight diagnostic. More...
 
class  LayeredMetadata
 
class  Operation
 
class  Pipeline
 
class  Png
 An image in PNG format. More...
 
class  PorymapLayout
 
class  PorymapTileset
 
class  PorytilesLayout
 
class  PorytilesTileset
 
class  Rgba32
 
class  RgbaAnim
 
class  RgbaMetatile
 
class  RgbaTile
 
class  StderrConsumer
 A DiagConsumer implementation that pushes diagnostic messages to stderr. More...
 
struct  StringViewSourceLoc
 A wrapper for std::string_view with a taggable std::source_location. More...
 
class  Tile
 A single 8x8 pixel tile with an arbitrary pixel data type. More...
 
class  VectorConsumer
 A DiagConsumer implementation that pushes diagnostic messages to an internal vector. More...
 
class  view_ptr
 A smart pointer that represents a non-owning view of a resource. More...
 
class  VramAnim
 
class  VramMetatile
 
class  VramTile
 

Typedefs

using DynamicMsgBuilder = std::function< std::vector< std::string >(const DiagEngine &eng, DiagLevel in_flight_level, const std::vector< std::any > &args)>
 An alias for a dynamic diagnostic message builder function.
 
using TileMetadata = std::variant< std::monostate, FreeMetadata, LayeredMetadata >
 

Enumerations

enum class  TilesPalMode { kTrueColor , kGreyscale }
 
enum class  DiagLevel {
  kIgnored , kNote , kRemark , kWarning ,
  kError , kFatal
}
 
enum class  TileType {
  kVram , kFree , kLayered , kAnim ,
  kPrimer , kOverride
}
 

Functions

auto format_as (const Bgr15 &bgr)
 
auto format_as (const Rgba32 &rgba)
 
std::optional< TilesPalModeTilesPalModeFromStr (const std::string &str)
 
std::string TilesPalModeToStr (const TilesPalMode m)
 
std::ostream & operator<< (std::ostream &os, const TilesPalMode m)
 
std::string LevelToStr (DiagLevel level)
 
fmt::terminal_color ColorForLevel (DiagLevel level)
 
int LevelPriority (DiagLevel level)
 
DiagTempl DiagFor (std::string_view name)
 Retrieves the DiagTempl corresponding to a given diagnostic name.
 
std::vector< const char * > AllDiagNames ()
 Gets an iterable view of all DiagTempl names in the internal table.
 
std::vector< const char * > AllDiagNames (DiagLevel level)
 Get an iterable view of all DiagTempl names for a given DiagLevel.
 
void PanicImpl (const char *s) noexcept
 
void Panic (const StringViewSourceLoc &s) noexcept
 
void AssertOrPanic (const bool condition, const StringViewSourceLoc &s)
 
template<typename T >
std::expected< T, std::string > ParseInt (std::string_view int_string, const int base)
 
template<typename T >
std::expected< T, std::string > ParseInt (std::string_view int_string)
 
template<typename T1 , typename T2 >
bool operator== (const view_ptr< T1 > &lhs, const view_ptr< T2 > &rhs)
 
template<typename T1 , typename T2 >
bool operator!= (const view_ptr< T1 > &lhs, const view_ptr< T2 > &rhs)
 
template<typename T >
bool operator== (const view_ptr< T > &lhs, std::nullptr_t) noexcept
 
template<typename T >
bool operator== (std::nullptr_t, const view_ptr< T > &rhs) noexcept
 
template<typename T >
bool operator!= (const view_ptr< T > &lhs, std::nullptr_t) noexcept
 
template<typename T >
bool operator!= (std::nullptr_t, const view_ptr< T > &rhs) noexcept
 
template<typename T >
 view_ptr (T *) -> view_ptr< T >
 
template<typename T >
parseInteger (const char *integerString, const int base)
 
template<typename T >
parseInteger (const char *integerString)
 
std::vector< std::string > split (std::string input, const std::string &delimiter)
 
bool checkFullStringMatch (const std::string &str, const std::string &pattern)
 
void trim (std::string &string)
 
std::filesystem::path getTmpfilePath (const std::filesystem::path &parentDir, const std::string &fileName)
 
std::filesystem::path createTmpdir ()
 
std::string palIndexToFileName (std::size_t index)
 

Variables

constexpr Rgba32 kRgbaBlack {0, 0, 0, Rgba32::kAlphaOpaque}
 
constexpr Rgba32 kRgbaWhite {255, 255, 255, Rgba32::kAlphaOpaque}
 
constexpr Rgba32 kRgbaGrey {128, 128, 128, Rgba32::kAlphaOpaque}
 
constexpr Rgba32 kRgbaRed {255, 0, 0, Rgba32::kAlphaOpaque}
 
constexpr Rgba32 kRgbaGreen {0, 255, 0, Rgba32::kAlphaOpaque}
 
constexpr Rgba32 kRgbaBlue {0, 0, 255, Rgba32::kAlphaOpaque}
 
constexpr Rgba32 kRgbaYellow {255, 255, 0, Rgba32::kAlphaOpaque}
 
constexpr Rgba32 kRgbaMagenta {255, 0, 255, Rgba32::kAlphaOpaque}
 
constexpr Rgba32 kRgbaCyan {0, 255, 255, Rgba32::kAlphaOpaque}
 
constexpr Rgba32 kRgbaPurple {128, 0, 255, Rgba32::kAlphaOpaque}
 
constexpr Rgba32 kRgbaLime {128, 255, 128, Rgba32::kAlphaOpaque}
 
constexpr auto NoteGeneric = "note-generic"
 
constexpr auto WarnColorPrecisionLoss = "color-precision-loss"
 
constexpr auto WarnKeyFrameNoMatchingTile = "key-frame-no-matching-tile"
 
constexpr auto WarnKeyFrameMissingColors = "key-frame-missing-colors"
 
constexpr auto WarnAttributeFormatMismatch = "attribute-format-mismatch"
 
constexpr auto WarnMissingAttributesCsv = "missing-attributes-csv"
 
constexpr auto WarnUnusedAttribute = "unused-attribute"
 
constexpr auto WarnTransparencyCollapse = "transparency-collapse"
 
constexpr auto WarnUnusedManualPalColor = "unused-manual-pal-color"
 
constexpr auto WarnTileIndexOutOfRange = "tile-index-out-of-range"
 
constexpr auto WarnPaletteIndexOutOfRange = "palette-index-out-of-range"
 
constexpr auto ErrGeneric = "error-generic"
 
constexpr auto FatalGeneric = "error-fatal-generic"
 
constexpr std::size_t kTileSideLength = 8
 
constexpr std::size_t kTileSize = kTileSideLength * kTileSideLength
 

Typedef Documentation

◆ DynamicMsgBuilder

using porytiles::DynamicMsgBuilder = typedef std::function<std::vector<std::string>(const DiagEngine &eng, DiagLevel in_flight_level, const std::vector<std::any> &args)>

An alias for a dynamic diagnostic message builder function.

DynamicMsgBuilder defines a function signature for building diagnostic messages dynamically. The function signature accepts:

  1. A boolean flag indicating whether the output is directed to a TTY (terminal).
  2. A DiagLevel noting the actual in-flight level of the diagnostic.
  3. A vector of additional parameters (type std::any) that are used to customize the diagnostic message. It returns a vector of formatted strings representing the final diagnostic message. Each element in the vector represents a single line of output for a DiagConsumer to consume.

Definition at line 51 of file diagnostics.hpp.

◆ TileMetadata

using porytiles::TileMetadata = typedef std::variant<std::monostate, FreeMetadata, LayeredMetadata>

Definition at line 39 of file tile_metadata.hpp.

Enumeration Type Documentation

◆ DiagLevel

enum class porytiles::DiagLevel
strong
Enumerator
kIgnored 

Foo.

kNote 

Bar.

kRemark 
kWarning 
kError 
kFatal 

Definition at line 19 of file diagnostics.hpp.

◆ TilesPalMode

enum class porytiles::TilesPalMode
strong
Enumerator
kTrueColor 
kGreyscale 

Definition at line 10 of file tiles_pal_mode.hpp.

◆ TileType

enum class porytiles::TileType
strong
Enumerator
kVram 
kFree 
kLayered 
kAnim 
kPrimer 
kOverride 

Definition at line 7 of file tile_metadata.hpp.

Function Documentation

◆ AllDiagNames() [1/2]

std::vector< const char * > porytiles::AllDiagNames ( )

Gets an iterable view of all DiagTempl names in the internal table.

The names returned from this function can then be used for lookup via DiagFor. This may be useful for range-based for-loops, or other use cases where the user wants to perform an action for some or all diagnostics.

Definition at line 466 of file diagnostics.cpp.

◆ AllDiagNames() [2/2]

std::vector< const char * > porytiles::AllDiagNames ( DiagLevel  level)

Get an iterable view of all DiagTempl names for a given DiagLevel.

Definition at line 475 of file diagnostics.cpp.

◆ AssertOrPanic()

void porytiles::AssertOrPanic ( const bool  condition,
const StringViewSourceLoc s 
)
inline

Definition at line 36 of file panic.hpp.

◆ checkFullStringMatch()

bool porytiles::checkFullStringMatch ( const std::string &  str,
const std::string &  pattern 
)

Definition at line 30 of file utilities.cpp.

◆ ColorForLevel()

fmt::terminal_color porytiles::ColorForLevel ( DiagLevel  level)

Definition at line 153 of file diagnostics.cpp.

◆ createTmpdir()

std::filesystem::path porytiles::createTmpdir ( )

Definition at line 51 of file utilities.cpp.

◆ DiagFor()

DiagTempl porytiles::DiagFor ( std::string_view  name)

Retrieves the DiagTempl corresponding to a given diagnostic name.

This function searches an internal table for the provided diagnostic name. If a DiagTempl with this name is found, the corresponding DiagTempl is returned. If not, the function triggers a panic with an error message indicating an unknown diagnostic name.

Parameters
nameA std::string_view of the diagnostic name.
Returns
The DiagTempl associated with the given name.
Note
The function will terminate the program if the diagnostic name is invalid.

Definition at line 461 of file diagnostics.cpp.

◆ format_as() [1/2]

auto porytiles::format_as ( const Bgr15 bgr)
inline

Provide a simple way for fmtlib to format Bgr15: https://fmt.dev/11.1/api/#formatting-user-defined-types

Definition at line 48 of file bgr15.hpp.

◆ format_as() [2/2]

auto porytiles::format_as ( const Rgba32 rgba)
inline

Provide a simple way for fmtlib to format Rgba32: https://fmt.dev/11.1/api/#formatting-user-defined-types

Definition at line 52 of file rgba32.hpp.

◆ getTmpfilePath()

std::filesystem::path porytiles::getTmpfilePath ( const std::filesystem::path &  parentDir,
const std::string &  fileName 
)

Definition at line 47 of file utilities.cpp.

◆ LevelPriority()

int porytiles::LevelPriority ( DiagLevel  level)

Definition at line 171 of file diagnostics.cpp.

◆ LevelToStr()

std::string porytiles::LevelToStr ( DiagLevel  level)

Definition at line 134 of file diagnostics.cpp.

◆ operator!=() [1/3]

template<typename T >
bool porytiles::operator!= ( const view_ptr< T > &  lhs,
std::nullptr_t   
)
noexcept

Definition at line 94 of file view_ptr.hpp.

◆ operator!=() [2/3]

template<typename T1 , typename T2 >
bool porytiles::operator!= ( const view_ptr< T1 > &  lhs,
const view_ptr< T2 > &  rhs 
)

Definition at line 79 of file view_ptr.hpp.

◆ operator!=() [3/3]

template<typename T >
bool porytiles::operator!= ( std::nullptr_t  ,
const view_ptr< T > &  rhs 
)
noexcept

Definition at line 99 of file view_ptr.hpp.

◆ operator<<()

std::ostream & porytiles::operator<< ( std::ostream &  os,
const TilesPalMode  m 
)
inline

Definition at line 32 of file tiles_pal_mode.hpp.

◆ operator==() [1/3]

template<typename T >
bool porytiles::operator== ( const view_ptr< T > &  lhs,
std::nullptr_t   
)
noexcept

Definition at line 84 of file view_ptr.hpp.

◆ operator==() [2/3]

template<typename T1 , typename T2 >
bool porytiles::operator== ( const view_ptr< T1 > &  lhs,
const view_ptr< T2 > &  rhs 
)
Todo:
make these members? pros vs. cons

Definition at line 74 of file view_ptr.hpp.

◆ operator==() [3/3]

template<typename T >
bool porytiles::operator== ( std::nullptr_t  ,
const view_ptr< T > &  rhs 
)
noexcept

Definition at line 89 of file view_ptr.hpp.

◆ palIndexToFileName()

std::string porytiles::palIndexToFileName ( std::size_t  index)

Definition at line 74 of file utilities.cpp.

◆ Panic()

void porytiles::Panic ( const StringViewSourceLoc s)
inlinenoexcept

Definition at line 31 of file panic.hpp.

◆ PanicImpl()

void porytiles::PanicImpl ( const char *  s)
noexcept

Definition at line 8 of file panic.cpp.

◆ ParseInt() [1/2]

template<typename T >
std::expected< T, std::string > porytiles::ParseInt ( std::string_view  int_string)

Definition at line 28 of file parsing.hpp.

◆ ParseInt() [2/2]

template<typename T >
std::expected< T, std::string > porytiles::ParseInt ( std::string_view  int_string,
const int  base 
)

Definition at line 10 of file parsing.hpp.

◆ parseInteger() [1/2]

template<typename T >
T porytiles::parseInteger ( const char *  integerString)

Definition at line 28 of file utilities.hpp.

◆ parseInteger() [2/2]

template<typename T >
T porytiles::parseInteger ( const char *  integerString,
const int  base 
)

Definition at line 11 of file utilities.hpp.

◆ split()

std::vector< std::string > porytiles::split ( std::string  input,
const std::string &  delimiter 
)

Definition at line 17 of file utilities.cpp.

◆ TilesPalModeFromStr()

std::optional< TilesPalMode > porytiles::TilesPalModeFromStr ( const std::string &  str)
inline

Definition at line 12 of file tiles_pal_mode.hpp.

◆ TilesPalModeToStr()

std::string porytiles::TilesPalModeToStr ( const TilesPalMode  m)
inline

Definition at line 22 of file tiles_pal_mode.hpp.

◆ trim()

void porytiles::trim ( std::string &  string)

Definition at line 39 of file utilities.cpp.

◆ view_ptr()

template<typename T >
porytiles::view_ptr ( T *  ) -> view_ptr< T >

Variable Documentation

◆ ErrGeneric

constexpr auto porytiles::ErrGeneric = "error-generic"
constexpr

ERRORS & FATALS

Definition at line 277 of file diagnostics.hpp.

◆ FatalGeneric

constexpr auto porytiles::FatalGeneric = "error-fatal-generic"
constexpr

Definition at line 278 of file diagnostics.hpp.

◆ kRgbaBlack

constexpr Rgba32 porytiles::kRgbaBlack {0, 0, 0, Rgba32::kAlphaOpaque}
constexpr

Definition at line 56 of file rgba32.hpp.

◆ kRgbaBlue

constexpr Rgba32 porytiles::kRgbaBlue {0, 0, 255, Rgba32::kAlphaOpaque}
constexpr

Definition at line 61 of file rgba32.hpp.

◆ kRgbaCyan

constexpr Rgba32 porytiles::kRgbaCyan {0, 255, 255, Rgba32::kAlphaOpaque}
constexpr

Definition at line 64 of file rgba32.hpp.

◆ kRgbaGreen

constexpr Rgba32 porytiles::kRgbaGreen {0, 255, 0, Rgba32::kAlphaOpaque}
constexpr

Definition at line 60 of file rgba32.hpp.

◆ kRgbaGrey

constexpr Rgba32 porytiles::kRgbaGrey {128, 128, 128, Rgba32::kAlphaOpaque}
constexpr

Definition at line 58 of file rgba32.hpp.

◆ kRgbaLime

constexpr Rgba32 porytiles::kRgbaLime {128, 255, 128, Rgba32::kAlphaOpaque}
constexpr

Definition at line 66 of file rgba32.hpp.

◆ kRgbaMagenta

constexpr Rgba32 porytiles::kRgbaMagenta {255, 0, 255, Rgba32::kAlphaOpaque}
constexpr

Definition at line 63 of file rgba32.hpp.

◆ kRgbaPurple

constexpr Rgba32 porytiles::kRgbaPurple {128, 0, 255, Rgba32::kAlphaOpaque}
constexpr

Definition at line 65 of file rgba32.hpp.

◆ kRgbaRed

constexpr Rgba32 porytiles::kRgbaRed {255, 0, 0, Rgba32::kAlphaOpaque}
constexpr

Definition at line 59 of file rgba32.hpp.

◆ kRgbaWhite

constexpr Rgba32 porytiles::kRgbaWhite {255, 255, 255, Rgba32::kAlphaOpaque}
constexpr

Definition at line 57 of file rgba32.hpp.

◆ kRgbaYellow

constexpr Rgba32 porytiles::kRgbaYellow {255, 255, 0, Rgba32::kAlphaOpaque}
constexpr

Definition at line 62 of file rgba32.hpp.

◆ kTileSideLength

constexpr std::size_t porytiles::kTileSideLength = 8
constexpr

Definition at line 11 of file tile.hpp.

◆ kTileSize

constexpr std::size_t porytiles::kTileSize = kTileSideLength * kTileSideLength
constexpr

Definition at line 12 of file tile.hpp.

◆ NoteGeneric

constexpr auto porytiles::NoteGeneric = "note-generic"
constexpr

STANDALONE NOTES

Definition at line 253 of file diagnostics.hpp.

◆ WarnAttributeFormatMismatch

constexpr auto porytiles::WarnAttributeFormatMismatch = "attribute-format-mismatch"
constexpr

Definition at line 263 of file diagnostics.hpp.

◆ WarnColorPrecisionLoss

constexpr auto porytiles::WarnColorPrecisionLoss = "color-precision-loss"
constexpr

WARNINGS

Definition at line 260 of file diagnostics.hpp.

◆ WarnKeyFrameMissingColors

constexpr auto porytiles::WarnKeyFrameMissingColors = "key-frame-missing-colors"
constexpr

Definition at line 262 of file diagnostics.hpp.

◆ WarnKeyFrameNoMatchingTile

constexpr auto porytiles::WarnKeyFrameNoMatchingTile = "key-frame-no-matching-tile"
constexpr

Definition at line 261 of file diagnostics.hpp.

◆ WarnMissingAttributesCsv

constexpr auto porytiles::WarnMissingAttributesCsv = "missing-attributes-csv"
constexpr

Definition at line 264 of file diagnostics.hpp.

◆ WarnPaletteIndexOutOfRange

constexpr auto porytiles::WarnPaletteIndexOutOfRange = "palette-index-out-of-range"
constexpr

Definition at line 269 of file diagnostics.hpp.

◆ WarnTileIndexOutOfRange

constexpr auto porytiles::WarnTileIndexOutOfRange = "tile-index-out-of-range"
constexpr

Definition at line 268 of file diagnostics.hpp.

◆ WarnTransparencyCollapse

constexpr auto porytiles::WarnTransparencyCollapse = "transparency-collapse"
constexpr

Definition at line 266 of file diagnostics.hpp.

◆ WarnUnusedAttribute

constexpr auto porytiles::WarnUnusedAttribute = "unused-attribute"
constexpr

Definition at line 265 of file diagnostics.hpp.

◆ WarnUnusedManualPalColor

constexpr auto porytiles::WarnUnusedManualPalColor = "unused-manual-pal-color"
constexpr

Definition at line 267 of file diagnostics.hpp.