btool
A parser/converter/transpiler for .bib files
TranslationTable.hpp
Go to the documentation of this file.
1 #ifndef BIBPARSER_TRANSLATIONTABLE_HPP
2 #define BIBPARSER_TRANSLATIONTABLE_HPP
3 
4 #include <boost/property_tree/ptree.hpp>
5 #include <boost/filesystem/path.hpp>
6 #include <StyleProperties.hpp>
7 #include <optional>
8 #include <iostream>
9 #include <sstream>
10 #include <vector>
11 
17  boost::property_tree::ptree contents;
18  std::vector<StyleProperties> styleProperties;
19 
20  [[nodiscard]] static auto parseStyle(const boost::property_tree::ptree &style) noexcept -> StyleProperties;
21 
22  [[nodiscard]] auto parseStyles() const -> std::vector<StyleProperties>;
23 
24  public:
25 
26  explicit TranslationTable(std::optional<std::stringstream> file);
27 
28  explicit TranslationTable(const std::optional<boost::filesystem::path> &path);
29 
30  auto printAll(std::ostream &out = std::cout) const -> void;
31 
32  [[nodiscard]] auto getStyleProperties() const noexcept -> const std::vector<StyleProperties> &;
33 
34  [[nodiscard]] auto stylePropertiesOf(const std::string &name) const noexcept -> std::optional<StyleProperties>;
35 
36  [[nodiscard]] auto stylePropertiesOf(
37  const std::vector<std::string> &names
38  ) const noexcept -> std::vector<StyleProperties>;
39 };
40 
41 #endif
StyleProperties
style-properties-container
Definition: StyleProperties.hpp:11
TranslationTable::stylePropertiesOf
auto stylePropertiesOf(const std::string &name) const noexcept -> std::optional< StyleProperties >
Definition: TranslationTable.cpp:127
TranslationTable::parseStyles
auto parseStyles() const -> std::vector< StyleProperties >
Definition: TranslationTable.cpp:97
name
char const *const name
Definition: HtmlGenerator.hpp:53
TranslationTable::parseStyle
static auto parseStyle(const boost::property_tree::ptree &style) noexcept -> StyleProperties
Definition: TranslationTable.cpp:62
TranslationTable::getStyleProperties
auto getStyleProperties() const noexcept -> const std::vector< StyleProperties > &
Definition: TranslationTable.cpp:118
TranslationTable::styleProperties
std::vector< StyleProperties > styleProperties
parsed style-properties
Definition: TranslationTable.hpp:18
TranslationTable::contents
boost::property_tree::ptree contents
pointer to parsed json-tree
Definition: TranslationTable.hpp:17
TranslationTable
api to interact with translation-table resource
Definition: TranslationTable.hpp:16
StyleProperties.hpp
TranslationTable::printAll
auto printAll(std::ostream &out=std::cout) const -> void
Definition: TranslationTable.cpp:53