labs-edaf30/lab1/editor.h

28 lines
644 B
C
Raw Normal View History

2021-10-27 15:15:47 +02:00
#ifndef EDITOR_H
#define EDITOR_H
#include <string>
class Editor {
2024-11-12 04:57:48 +01:00
public:
2021-10-27 15:15:47 +02:00
using size_type = std::string::size_type;
2024-11-12 04:57:48 +01:00
/* Creates a text editor containing the text t */
Editor(const std::string &t) : text(t) {}
2021-10-27 15:15:47 +02:00
/* Get the size of the current contents */
size_type get_size() const;
2024-11-12 04:57:48 +01:00
/*
* Text[pos] contains a right parentheses. Returns the position of
* the corresponding left parentheses, or string::npos if there
* is no match.
*/
size_type find_left_par(size_type pos) const;
2021-10-27 15:15:47 +02:00
2024-11-12 04:57:48 +01:00
// ... functions to edit the text (insert and delete characters)
private:
std::string text;
2021-10-27 15:15:47 +02:00
};
#endif