TUT/src/browser_v2.h
m1ngsama d80d0a1c6e feat: Implement TUT 2.0 with new rendering architecture
Major features:
- New modular architecture with Terminal, FrameBuffer, Renderer layers
- True Color (24-bit) support with warm, eye-friendly color scheme
- Unicode support with proper CJK character width handling
- Differential rendering for improved performance
- Page caching (LRU, 20 pages, 5-minute expiry)
- Search functionality with highlighting (/, n/N)
- Form rendering (input, button, checkbox, radio, select)
- Image placeholder support ([alt text] or [Image: filename])
- Binary data download via fetch_binary()
- Loading state indicators

New files:
- src/browser_v2.cpp/h - Browser with new rendering system
- src/main_v2.cpp - Entry point for tut2
- src/render/* - Terminal, FrameBuffer, Renderer, Layout, Image modules
- src/utils/unicode.cpp/h - Unicode handling utilities
- tests/* - Test programs for each module

Build with: cmake --build build_v2
Run: ./build_v2/tut2 [URL]
2025-12-26 14:56:17 +08:00

31 lines
660 B
C++

#pragma once
#include "http_client.h"
#include "html_parser.h"
#include "input_handler.h"
#include "render/terminal.h"
#include "render/renderer.h"
#include "render/layout.h"
#include <string>
#include <vector>
#include <memory>
/**
* BrowserV2 - 使用新渲染系统的浏览器
*
* 使用 Terminal + FrameBuffer + Renderer + LayoutEngine 架构
* 支持 True Color, Unicode, 差分渲染
*/
class BrowserV2 {
public:
BrowserV2();
~BrowserV2();
void run(const std::string& initial_url = "");
bool load_url(const std::string& url);
std::string get_current_url() const;
private:
class Impl;
std::unique_ptr<Impl> pImpl;
};