Avoid external access to treap
This commit is contained in:
parent
112e20f4b1
commit
53a53b7a03
1 changed files with 2 additions and 1 deletions
3
main.cpp
3
main.cpp
|
@ -32,6 +32,7 @@ void set(int r, int s, char ch) { file.find(file_offset+r)->text[s] = ch; }
|
||||||
void new_line(int r, string text = "") { file.insert(file_offset+r, text); }
|
void new_line(int r, string text = "") { file.insert(file_offset+r, text); }
|
||||||
void insert(int r, int s, string t) { file.find(file_offset+r)->text.insert(s, t); }
|
void insert(int r, int s, string t) { file.find(file_offset+r)->text.insert(s, t); }
|
||||||
void insert(int r, int s, char ch) { insert(r, s, string{ch}); }
|
void insert(int r, int s, char ch) { insert(r, s, string{ch}); }
|
||||||
|
void append(string t) { file.append(t); }
|
||||||
void remove(int r, int s, int len=1) { file.find(file_offset+r)->text.erase(s,len); }
|
void remove(int r, int s, int len=1) { file.find(file_offset+r)->text.erase(s,len); }
|
||||||
void remove(int r) { file.remove(file_offset+r); }
|
void remove(int r) { file.remove(file_offset+r); }
|
||||||
|
|
||||||
|
@ -53,7 +54,7 @@ bool load(string filename) {
|
||||||
|
|
||||||
string line;
|
string line;
|
||||||
while (std::getline(infile, line))
|
while (std::getline(infile, line))
|
||||||
file.append(line);
|
append(line);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// Save file from buffer
|
// Save file from buffer
|
||||||
|
|
Loading…
Reference in a new issue