Program Listing for File streamable_parser.hpp
↰ Return to documentation for file (rcppsw/config/streamable_parser.hpp
)
#pragma once
/*******************************************************************************
* Includes
******************************************************************************/
#include <string>
#include "rcppsw/rcppsw.hpp"
/*******************************************************************************
* Namespaces/Decls
******************************************************************************/
namespace rcppsw::config {
/*******************************************************************************
* Class Definitions
******************************************************************************/
class streamable_parser {
virtual ~streamable_parser(void) = default;
static constexpr size_t kColumnWidth = 100;
static constexpr size_t kHeader1 = 1;
static constexpr size_t kHeader2 = 2;
static constexpr size_t kHeader3 = 3;
static constexpr size_t kHeader4 = 4;
explicit streamable_parser(size_t level) : m_level(level) {}
virtual void show(std::ostream&) const = 0;
std::string header_build(const std::string& xml_root) const;
std::string footer_build(const std::string& xml_root) const;
size_t level(void) const { return m_level; }
friend std::ostream& operator<<(std::ostream& stream,
const streamable_parser& parser) {
parser.show(stream);
return stream;
} /* operator<<() */
private:
/* clang-format off */
size_t m_level;
/* clang-format on */
};
} /* namespace rcppsw::config */