ChessPlusPlus  WIP
cplusplus.com Community Project
chesspp::config::BoardConfig Class Reference

Holds configuration values for the board (layout, metadata, etc) More...

#include <BoardConfig.hpp>

Inheritance diagram for chesspp::config::BoardConfig:
chesspp::config::Configuration

Public Types

using BoardSize_t = std::uint8_t
 
using CellSize_t = std::uint16_t
 
using Position_t = util::Position< BoardSize_t >
 
using PieceClass_t = std::string
 
using SuitClass_t = std::string
 
using Layout_t = std::map< Position_t, std::pair< PieceClass_t, SuitClass_t >>
 
using Textures_t = std::map< BoardConfig::SuitClass_t, std::map< BoardConfig::PieceClass_t, std::string >>
 

Public Member Functions

 BoardConfig (ResourcesConfig &res)
 Loads board configuration from "config/chesspp/board.json". More...
 
virtual ~BoardConfig ()=default
 
BoardSize_t boardWidth () const noexcept
 
BoardSize_t boardHeight () const noexcept
 
Layout_t const & initialLayout () const noexcept
 
CellSize_t cellWidth () const noexcept
 
CellSize_t cellHeight () const noexcept
 
Textures_t const & texturePaths () const noexcept
 
template<typename... Args>
util::JsonReader::NestedValue metadata (Args const &...path) const
 Get metadata for the board pieces. More...
 
- Public Member Functions inherited from chesspp::config::Configuration
 Configuration (std::string const &configFile) noexcept(false)
 Loads the configuration from the given file path. More...
 
virtual ~Configuration ()=default
 
template<typename... Path>
auto setting (Path const &...path) -> decltype(reader.navigate(path...))
 Access values in the configuration. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from chesspp::config::Configuration
static std::string executablePath ()
 Get the path to the directory the executable is in. More...
 
- Protected Attributes inherited from chesspp::config::Configuration
std::string res_path
 Stores the path to the directory where configuration paths are relative to. More...
 
util::JsonReader reader
 The chessp::util::JsonReader for reading the configuration values. More...
 

Detailed Description

Holds configuration values for the board (layout, metadata, etc)

Member Typedef Documentation

Constructor & Destructor Documentation

chesspp::config::BoardConfig::BoardConfig ( ResourcesConfig res)
inline

Loads board configuration from "config/chesspp/board.json".

Parameters
TheResourcesConfig to use for resource configuration.
virtual chesspp::config::BoardConfig::~BoardConfig ( )
virtualdefault

Member Function Documentation

BoardSize_t chesspp::config::BoardConfig::boardHeight ( ) const
inlinenoexcept
BoardSize_t chesspp::config::BoardConfig::boardWidth ( ) const
inlinenoexcept
CellSize_t chesspp::config::BoardConfig::cellHeight ( ) const
inlinenoexcept
CellSize_t chesspp::config::BoardConfig::cellWidth ( ) const
inlinenoexcept
Layout_t const& chesspp::config::BoardConfig::initialLayout ( ) const
inlinenoexcept
template<typename... Args>
util::JsonReader::NestedValue chesspp::config::BoardConfig::metadata ( Args const &...  path) const
inline

Get metadata for the board pieces.

Equivalent to calling setting("board", "metadata", ...)

See also
setting()
Textures_t const& chesspp::config::BoardConfig::texturePaths ( ) const
inlinenoexcept

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