mFrame
載入中...
搜尋中...
無符合項目
Scanner.h
1
7#ifndef MFRAME_0D9BA3BA_2E87_41FB_A948_02CAC4832E3B
8#define MFRAME_0D9BA3BA_2E87_41FB_A948_02CAC4832E3B
9
10/* ***************************************************************************************
11 * Include
12 */
13
14//----------------------------------------------------------------------------------------
15
16//----------------------------------------------------------------------------------------
17#include "./../io/ByteBuffer.h"
18#include "./../io/SimpleWriter.h"
19#include "./../lang/Markable.h"
20#include "./../lang/System.h"
21#include "./../util/LineReader.h"
22
23/* ***************************************************************************************
24 * Using Declarations
25 */
27
28/* ***************************************************************************************
29 * Namespace
30 */
31namespace ufm::util {
32 class Scanner;
33} // namespace ufm::util
34
35/* ***************************************************************************************
36 * Class/Interface/Struct/Enum
37 */
38
103 public ufm::lang::Markable {
104 /* *************************************************************************************
105 * Variable
106 */
107 protected:
109 int vMark;
110
111 /* *************************************************************************************
112 * Abstract Method
113 */
114
115 /* *************************************************************************************
116 * Construct Method
117 */
118 public:
127 Scanner(ufm::lang::Memory buffer) noexcept;
128
137 inline Scanner(Scanner&& other) noexcept
138 : LineReader(static_cast<LineReader&&>(other)),
139 vInsert(other.vInsert),
140 vMark(other.vMark) {
141 return;
142 }
143
150 virtual ~Scanner(void) override;
151
152 /* *************************************************************************************
153 * Operator Method
154 */
155
156 /* *************************************************************************************
157 * Override Method - ufm::lang::Appendable
158 */
159 public:
165 virtual int remaining(void) const override;
166
173 virtual int putByte(const char data) override;
174
183 virtual int put(ufm::lang::Readable& readable) override;
184
194 virtual int put(const void* pointer, int length) override;
195
196 /* *************************************************************************************
197 * Override Method - ufm::lang::Markable
198 */
199 public:
209 virtual void mark(void) override;
210
221 virtual void reset(void) override;
222
223 /* *************************************************************************************
224 * Public Method
225 */
226 public:
240 void compact(void);
241
248 void clear(void);
249
259 int setCursor(int insert);
260
269 inline int getCursor(void) {
270 return this->vInsert;
271 }
272
283 inline bool cursorRight(void) {
284 int target = this->vInsert - 1;
285 return (target == this->setCursor(target));
286 }
287
298 inline bool cursorLeft(void) {
299 int target = this->vInsert + 1;
300 return (target == this->setCursor(target));
301 }
302
313 bool backspace(void);
314
324 bool deleteChar(void);
325
326 /* *************************************************************************************
327 * Protected Method
328 */
329
330 /* *************************************************************************************
331 * Private Method
332 */
333
334 /* *************************************************************************************
335 * Static Variable
336 */
337
338 /* *************************************************************************************
339 * Static Method
340 */
341};
342
343/* ***************************************************************************************
344 * End of file
345 */
346
347#endif /* MFRAME_0D9BA3BA_2E87_41FB_A948_02CAC4832E3B */
動態記憶體管理類別
Definition Memory.h:38
系統核心入口
Definition System.h:67
行資料讀取器,提供從緩衝區解析多種資料類型的功能。
Definition LineReader.h:343
LineReader(ufm::lang::Memory buffer) noexcept
使用現有緩衝區構造 LineReader 物件
高階緩衝區資料解析器,提供多功能的資料流處理能力。
Definition Scanner.h:103
int setCursor(int insert)
設定下次寫入資料的插入位置。
Scanner(ufm::lang::Memory buffer) noexcept
使用現有緩衝區構造 Scanner 物件。
bool deleteChar(void)
刪除當前游標位置的字元。
virtual void mark(void) override
設定流標記位置。
bool cursorRight(void)
將游標向右移動一個位置。
Definition Scanner.h:283
Scanner(Scanner &&other) noexcept
移動建構子。
Definition Scanner.h:137
int vInsert
下次插入資料的緩衝區索引位置
Definition Scanner.h:108
bool backspace(void)
回退指定字元數。
bool cursorLeft(void)
將游標向左移動一個位置。
Definition Scanner.h:298
virtual void reset(void) override
重置流位置至上次標記點。
virtual int put(ufm::lang::Readable &readable) override
從 Readable 物件附加資料至緩衝區
virtual int remaining(void) const override
取得緩衝區剩餘空閒字節數。
virtual int put(const void *pointer, int length) override
從記憶體指標附加資料至緩衝區
virtual ~Scanner(void) override
解構子,釋放資源。
void compact(void)
將未讀取資料移至緩衝區開頭,釋放已消耗空間。
virtual int putByte(const char data) override
輸入單一字節至緩衝區
void clear(void)
清除 Scanner 緩衝區並重置狀態。
int getCursor(void)
取得目前的插入位置。
Definition Scanner.h:269
int vMark
標記位置,用於重置操作
Definition Scanner.h:109
Definition Iterable.h:28
資料附加介面 (Appendable)
Definition Appendable.h:43
[Interface] 定義可標記流介面
Definition Markable.h:40
[Interface] 定義資料讀取介面
Definition Readable.h:46