btool
A parser/converter/transpiler for .bib files
HtmlGenerator Struct Reference

#include <HtmlGenerator.hpp>

+ Inheritance diagram for HtmlGenerator:
+ Collaboration diagram for HtmlGenerator:

Public Types

enum  HtmlTag {
  HtmlTag::TABLE, HtmlTag::TABLE_BODY, HtmlTag::TABLE_HEADING, HtmlTag::TABLE_ENTRY,
  HtmlTag::TABLE_ROW, HtmlTag::LINK, HtmlTag::SCRIPT, HtmlTag::META,
  HtmlTag::TITLE, HtmlTag::H1, HtmlTag::H5, HtmlTag::DIV,
  HtmlTag::BUTTON
}
 

Public Member Functions

auto fail (const std::string &message, const std::string &type) -> void override
 
auto write () -> std::string override
 
auto fillContainer (CTML::Node &parent) const noexcept -> void
 
 HtmlGenerator (const std::vector< BibElement > &elements)
 
- Public Member Functions inherited from AbstractGenerator
 AbstractGenerator (std::vector< BibElement > elements)
 
- Public Member Functions inherited from Generator
virtual ~Generator ()=default
 

Static Public Member Functions

static auto appendCard (CTML::Node &parent, const BibElement &element) noexcept -> void
 
static auto appendTable (CTML::Node &parent, const BibElement &element) noexcept -> void
 
- Static Public Member Functions inherited from AbstractGenerator
static auto uniqueFieldsOf (const std::vector< BibElement > &values) noexcept -> std::unordered_set< std::string >
 
static auto sortedFields (const std::vector< Field > &set) noexcept -> std::vector< Field >
 

Additional Inherited Members

- Protected Attributes inherited from AbstractGenerator
std::vector< BibElementelements
 Elements to write. More...
 

Detailed Description

HTML-Generator

Examples
/github/workspace/test/GeneratorFixtureTest.cpp.

Definition at line 11 of file HtmlGenerator.hpp.

Member Enumeration Documentation

◆ HtmlTag

Enum that contains all known HTML tags.

Enumerator
TABLE 
TABLE_BODY 
TABLE_HEADING 
TABLE_ENTRY 
TABLE_ROW 
LINK 
SCRIPT 
META 
TITLE 
H1 
H5 
DIV 
BUTTON 

Definition at line 16 of file HtmlGenerator.hpp.

Constructor & Destructor Documentation

◆ HtmlGenerator()

HtmlGenerator::HtmlGenerator ( const std::vector< BibElement > &  elements)
explicit

Constructor.

Parameters
elementsthe elements to write.

Definition at line 78 of file HtmlGenerator.cpp.

References AbstractGenerator::elements.

Member Function Documentation

◆ appendCard()

auto HtmlGenerator::appendCard ( CTML::Node &  parent,
const BibElement element 
) -> void
staticnoexcept

Creates A Card for an element and appends it to the Parent

Parameters
parent[out]the node the Card gets appended to
elementthe element to create the Card for

Definition at line 99 of file HtmlGenerator.cpp.

References Field::value.

◆ appendTable()

auto HtmlGenerator::appendTable ( CTML::Node &  parent,
const BibElement element 
) -> void
staticnoexcept

Appends a table of all Element-Atrributes to a node

Parameters
parent[out]the node to append the table to
elementthe element to create the table for

Definition at line 145 of file HtmlGenerator.cpp.

◆ fail()

auto HtmlGenerator::fail ( const std::string &  message,
const std::string &  type 
) -> void
overridevirtual

Throws a HTML-Generator-Exception

Parameters
messagethe message to append

Reimplemented from AbstractGenerator.

Definition at line 8 of file HtmlGenerator.cpp.

References AbstractGenerator::fail().

+ Here is the call graph for this function:

◆ fillContainer()

void HtmlGenerator::fillContainer ( CTML::Node &  parent) const -> void
noexcept

Fills the Main Container-Div of the Page-Body

Parameters
parent[out]The Parent node (Container-Div)

Definition at line 84 of file HtmlGenerator.cpp.

◆ write()

auto HtmlGenerator::write ( ) -> std::string
overridevirtual

Writes all elements as HTML-Document (wrapped by Bootstrap)

Returns
the written document as String
Exceptions
FileWriterExceptionon error

Reimplemented from AbstractGenerator.

Examples
/github/workspace/test/GeneratorFixtureTest.cpp.

Definition at line 17 of file HtmlGenerator.cpp.

Referenced by main(), and TEST_F().

+ Here is the caller graph for this function:

The documentation for this struct was generated from the following files: