From 617b10ded3722a8c2d615fbee5dd256f5f3c6a7f Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Sat, 11 Apr 2026 03:40:54 +0800 Subject: feat: implement terminal renderer and integrate into browser core --- include/ricochet/render/renderer.hh | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 include/ricochet/render/renderer.hh (limited to 'include') diff --git a/include/ricochet/render/renderer.hh b/include/ricochet/render/renderer.hh new file mode 100644 index 0000000..8a5c463 --- /dev/null +++ b/include/ricochet/render/renderer.hh @@ -0,0 +1,43 @@ +/* + * Ricochet - A minimalist CLI web browser for fast, distraction-free navigation. + * Copyright (C) 2026 Richard Qin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include "ricochet/parser/dom_tree.hh" + +namespace ricochet::render { + +class Renderer +{ +public: + Renderer() = default; + ~Renderer() = default; + + Renderer( const Renderer& ) = delete; + Renderer& operator=( const Renderer& ) = delete; + Renderer( Renderer&& ) = delete; + Renderer& operator=( Renderer&& ) = delete; + + /** + * @brief Traverse the DOM tree and output the formatted result to the terminal using ANSI escape codes + * @param node The root node of the DOM tree + */ + void render( const parser::DomNode& node ) const; +}; + +} // namespace ricochet::render \ No newline at end of file -- cgit v1.2.3