31 lines
433 B
C++
31 lines
433 B
C++
#ifndef TEXTBUFFER_H
|
|
#define TEXTBUFFER_H
|
|
#include <iostream>
|
|
|
|
class TextBuffer
|
|
{
|
|
public:
|
|
TextBuffer();
|
|
|
|
void resetBuffer();
|
|
|
|
// cursor-related function
|
|
int getCursorPosition() const;
|
|
void setCursorPosition(int pos);
|
|
void moveCursorLeft();
|
|
void moveCursorRight();
|
|
|
|
// string-related function
|
|
std::string getText() const;
|
|
void insertText(char c);
|
|
|
|
|
|
|
|
private:
|
|
std::string buffer;
|
|
int cursor;
|
|
|
|
};
|
|
|
|
#endif // TEXTBUFFER_H
|