Yayin Story Studio logo Yayin Story Studio 项目文档
回到主页 用户手册

ASERStudio::AStorySyntax::AStoryXPreprocessor Class

class ASERStudio::AStorySyntax::AStoryXPreprocessor

AStoryXPreprocessor是一个预处理器,用于在解析AStoryX之前对AStoryX进行预处理. 详情...

头文件: #include <AStoryXPreprocessor>
自以下版本: ASERStudio 2.0

公开成员函数

(自 ASERStudio 2.0 引入) AStoryXPreprocessor()
(自 ASERStudio 2.0 引入) AStoryXPreprocessor(const ASERStudio::AStorySyntax::AStoryXPreprocessor &other)
(自 ASERStudio 2.0 引入) AStoryXPreprocessor(ASERStudio::AStorySyntax::AStoryXPreprocessor &&other)
(自 ASERStudio 2.0 引入) ~AStoryXPreprocessor()
(自 ASERStudio 2.0 引入) QStringList getSupportedPreprocessors() const
(自 ASERStudio 2.0 引入) bool isPreprocessor(const QString &str)
(自 ASERStudio 2.0 引入) ASERStudio::AStorySyntax::AStoryXControllerParseData parse(const QString &str, qint32 cursorPosition = -1, bool diagnostic = false, qint32 lineIndex = -1)
(自 ASERStudio 2.0 引入) ASERStudio::AStorySyntax::AStoryXPreprocessor &operator=(ASERStudio::AStorySyntax::AStoryXPreprocessor &&other)
(自 ASERStudio 2.0 引入) ASERStudio::AStorySyntax::AStoryXPreprocessor &operator=(const ASERStudio::AStorySyntax::AStoryXPreprocessor &other)

详细说明

AStoryXPreprocessor包括AStoryX中所有以#开头的指令。

实际上,与其称之为预处理器,“上下文控制器“可能更为合适。不过由于ASE-Remake文档已经称之为预处理, 且#指令的语法与C语言预处理器指令类似,所以就沿用这个名字了。

AStoryXController不同,AStoryXPreprocessor在每个AStoryXRule中只有一个实例,用于处理全部情况。

你一般不需要独立使用它,除非你有特殊需求(比如你在确定场景下只解析预处理指令)。 针对任意文本的解析,应该使用ASERStudio::AStorySyntax::AStoryXRule::parseAStoryX函数。

有关AStoryXPreprocessor如何通过AStoryXControllerParseData存储解析结果的说明,请参见AStoryXControllerParseData的文档。

成员函数文档

[since ASERStudio 2.0] AStoryXPreprocessor::AStoryXPreprocessor()

构造函数。

这个function 从 ASERStudio 2.0 开始支持。

[since ASERStudio 2.0] AStoryXPreprocessor::AStoryXPreprocessor(const ASERStudio::AStorySyntax::AStoryXPreprocessor &other)

other 另一个AStoryXPreprocessor对象。

复制构造函数。

这个function 从 ASERStudio 2.0 开始支持。

[noexcept, since ASERStudio 2.0] AStoryXPreprocessor::AStoryXPreprocessor(ASERStudio::AStorySyntax::AStoryXPreprocessor &&other)

other 另一个AStoryXPreprocessor对象。

移动构造函数。

这个function 从 ASERStudio 2.0 开始支持。

[noexcept, since ASERStudio 2.0] AStoryXPreprocessor::~AStoryXPreprocessor()

析构函数。

这个function 从 ASERStudio 2.0 开始支持。

[since ASERStudio 2.0] QStringList AStoryXPreprocessor::getSupportedPreprocessors() const

return 支持的预处理指令列表。

这个function 从 ASERStudio 2.0 开始支持。

[since ASERStudio 2.0] bool AStoryXPreprocessor::isPreprocessor(const QString &str)

str 待判断的字符串

return 给定的字符串是否是一个预处理指令。

这个function 从 ASERStudio 2.0 开始支持。

[since ASERStudio 2.0] ASERStudio::AStorySyntax::AStoryXControllerParseData AStoryXPreprocessor::parse(const QString &str, qint32 cursorPosition = -1, bool diagnostic = false, qint32 lineIndex = -1)

解析给定的字符串,如果它是一个预处理指令的话。 str 待解析的字符串 cursorPosition 光标位置,用于确定光标位于哪个参数中 diagnostic 是否启用诊断信息 lineIndex 行索引,仅在启用诊断信息时有效

return 一个AStoryXControllerParseData对象,包含解析结果。

你一般不需要直接调用这个函数,除非你有特殊需求(比如你在确定场景下只解析预处理指令)。 针对任意文本的解析,应该使用ASERStudio::AStorySyntax::AStoryXRule::parseAStoryX函数, 该函数会根据所有控制器的规则来解析文本,并返回最合适的解析结果。

这个function 从 ASERStudio 2.0 开始支持。

[noexcept, since ASERStudio 2.0] ASERStudio::AStorySyntax::AStoryXPreprocessor &AStoryXPreprocessor::operator=(ASERStudio::AStorySyntax::AStoryXPreprocessor &&other)

other 另一个AStoryXPreprocessor对象。

移动赋值运算符。

这个function 从 ASERStudio 2.0 开始支持。

[since ASERStudio 2.0] ASERStudio::AStorySyntax::AStoryXPreprocessor &AStoryXPreprocessor::operator=(const ASERStudio::AStorySyntax::AStoryXPreprocessor &other)

other 另一个AStoryXPreprocessor对象。

复制赋值运算符。

这个function 从 ASERStudio 2.0 开始支持。