aboutsummaryrefslogtreecommitdiff
path: root/python/src/types/buffer.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/src/types/buffer.py')
-rw-r--r--python/src/types/buffer.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/python/src/types/buffer.py b/python/src/types/buffer.py
new file mode 100644
index 0000000..04e1def
--- /dev/null
+++ b/python/src/types/buffer.py
@@ -0,0 +1,16 @@
+from dataclasses import dataclass
+
+@dataclass
+class Buffer:
+ content: str
+
+ @property
+ def min_pos(self) -> int:
+ return 0
+
+ @property
+ def max_pos(self) -> int:
+ return len(self.content)
+
+ def valid_pos(self, pos : int) -> bool:
+ return self.min_pos <= pos < self.max_pos