🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
BaseRenderer.hpp
1
20
21#pragma once
22
23#include "AstGlobal.h"
24#include "AstUtil/StringView.hpp"
25#include <string>
26
27AST_NAMESPACE_BEGIN
28
41class AST_UTIL_API BaseRenderer
42{
43public:
44 virtual ~BaseRenderer() = default;
45
49 std::string operator()(StringView chunk);
50
54 void print(StringView chunk);
55
59 virtual void feed(StringView chunk, std::string& accumulated) = 0;
60
62 virtual void end(std::string& remaining) = 0;
63
65 virtual void reset() = 0;
66};
67
68
71AST_NAMESPACE_END
流式文本格式转换器
定义 BaseRenderer.hpp:42
virtual void end(std::string &remaining)=0
停止渲染,并返回缓冲区中还未渲染的字符
virtual void reset()=0
重置渲染状态机
virtual void feed(StringView chunk, std::string &accumulated)=0
接受一个字符串,渲染为对应的字符串