api to interact with translation-table resource More...
#include <TranslationTable.hpp>
Public Member Functions | |
TranslationTable (std::optional< std::stringstream > file) | |
TranslationTable (const std::optional< boost::filesystem::path > &path) | |
auto | printAll (std::ostream &out=std::cout) const -> void |
auto | getStyleProperties () const noexcept -> const std::vector< StyleProperties > & |
auto | stylePropertiesOf (const std::string &name) const noexcept -> std::optional< StyleProperties > |
auto | stylePropertiesOf (const std::vector< std::string > &names) const noexcept -> std::vector< StyleProperties > |
Private Member Functions | |
auto | parseStyles () const -> std::vector< StyleProperties > |
Static Private Member Functions | |
static auto | parseStyle (const boost::property_tree::ptree &style) noexcept -> StyleProperties |
Private Attributes | |
boost::property_tree::ptree | contents |
pointer to parsed json-tree More... | |
std::vector< StyleProperties > | styleProperties |
parsed style-properties More... | |
api to interact with translation-table resource
Handles interaction with the translation-table-file and does parsing of it
Definition at line 16 of file TranslationTable.hpp.
|
explicit |
Constructor.
file | contents of a file |
boost::property_tree::json_parser_error | whenever file is not JSON compliant |
Definition at line 13 of file TranslationTable.cpp.
References contents, parseStyles(), and styleProperties.
|
explicit |
Constructor.
path | path to a translation-table json-file |
std::invalid_argument | whenever path is no regular file or does not exist |
boost::property_tree::json_parser_error | whenever file is not JSON compliant |
Definition at line 29 of file TranslationTable.cpp.
References contents, parseStyles(), and styleProperties.
|
noexcept |
Provides all parsed style-properties
Definition at line 118 of file TranslationTable.cpp.
References styleProperties.
|
staticprivatenoexcept |
Parses a style from the styles json-pointer
style | the json-pointer to the style |
Definition at line 62 of file TranslationTable.cpp.
References name.
|
private |
Parses Styles of a top-level json-pointer (tree according to proposed structure)
std::logic_error | whenever the translation-table does not contain styles |
Definition at line 97 of file TranslationTable.cpp.
References contents.
Referenced by TranslationTable().
auto TranslationTable::printAll | ( | std::ostream & | out = std::cout | ) | const -> void |
Prints the content of contents
[out] | out | the ostream to print into |
Definition at line 53 of file TranslationTable.cpp.
|
noexcept |
Provides style-properties for a specific style
name | the style name to get properties for |
Definition at line 127 of file TranslationTable.cpp.
References name, and StyleProperties::name.
|
noexcept |
Provides style-properties for a collection of styles
names | the style names to get properties for |
Definition at line 141 of file TranslationTable.cpp.
|
private |
pointer to parsed json-tree
Definition at line 17 of file TranslationTable.hpp.
Referenced by parseStyles(), and TranslationTable().
|
private |
parsed style-properties
Definition at line 18 of file TranslationTable.hpp.
Referenced by getStyleProperties(), and TranslationTable().