btool
A parser/converter/transpiler for .bib files
AbstractGenerator.hpp
Go to the documentation of this file.
1 #ifndef BIBPARSER_SRC_ABSTRACTGENERATOR_HPP_
2 #define BIBPARSER_SRC_ABSTRACTGENERATOR_HPP_
3 
4 #include <boost/filesystem/path.hpp>
5 #include <BibElement.hpp>
6 #include <Generator.hpp>
7 #include <Field.hpp>
8 #include <string>
9 #include <vector>
10 
14 class AbstractGenerator : public Generator {
15  protected:
16  std::vector<BibElement> elements;
17 
18  [[noreturn]] virtual auto fail(const std::string &message, const std::string &type = "unknown") -> void;
19 
20  auto write() -> std::string override;
21 
22  public:
23  explicit AbstractGenerator(std::vector<BibElement> elements);
24 
25  static auto uniqueFieldsOf(const std::vector<BibElement> &values) noexcept -> std::unordered_set<std::string>;
26 
27  static auto sortedFields(const std::vector<Field> &set) noexcept -> std::vector<Field>;
28 };
29 
30 #endif
AbstractGenerator
Definition: AbstractGenerator.hpp:14
AbstractGenerator::write
auto write() -> std::string override
Definition: AbstractGenerator.cpp:29
set
set(SuiteName btoolTest) set(TEST_SOURCES TranslationTableFixtureTest.cpp FieldTest.cpp StylePropertiesTest.cpp BibElementFixtureTest.cpp ParserFixtureTest.cpp ParserStateFixtureTest.cpp GeneratorFixtureTest.cpp) add_executable($
Definition: CMakeLists.txt:1
AbstractGenerator::fail
virtual auto fail(const std::string &message, const std::string &type="unknown") -> void
Definition: AbstractGenerator.cpp:12
Field.hpp
AbstractGenerator::uniqueFieldsOf
static auto uniqueFieldsOf(const std::vector< BibElement > &values) noexcept -> std::unordered_set< std::string >
Definition: AbstractGenerator.cpp:33
Generator.hpp
AbstractGenerator::sortedFields
static auto sortedFields(const std::vector< Field > &set) noexcept -> std::vector< Field >
Definition: AbstractGenerator.cpp:55
BibElement.hpp
AbstractGenerator::AbstractGenerator
AbstractGenerator(std::vector< BibElement > elements)
Definition: AbstractGenerator.cpp:23
AbstractGenerator::elements
std::vector< BibElement > elements
Elements to write.
Definition: AbstractGenerator.hpp:16
Generator
Definition: Generator.hpp:7