aboutsummaryrefslogtreecommitdiff
path: root/docs/buff.rst
diff options
context:
space:
mode:
authorbozo.kopic <bozo@kopic.xyz>2022-08-02 01:20:12 +0200
committerbozo.kopic <bozo@kopic.xyz>2022-09-25 02:40:23 +0200
commit288727f09a1b3458c268497d111349e608c3f9fa (patch)
treed62565249fa3c7127856c65405752572fc41aca9 /docs/buff.rst
Diffstat (limited to 'docs/buff.rst')
-rw-r--r--docs/buff.rst29
1 files changed, 29 insertions, 0 deletions
diff --git a/docs/buff.rst b/docs/buff.rst
new file mode 100644
index 0000000..b052483
--- /dev/null
+++ b/docs/buff.rst
@@ -0,0 +1,29 @@
+String buffer
+=============
+
+While reading character data from input stream, buffer used for storing
+string of arbitrary length is required. `lsp_buff_t` provides preallocated
+limited temporary storage which is used as intermediary buffer in construction
+of `string` data with arbitrary size.
+
+After initialization with `lsp_buff_init`, characters are added to buffer
+with `lsp_buff_push` function. Once all characters are appended, single
+`string` data containing all previously appended characters, can be obtained
+with `lsp_buff_pop` function.
+
+
+Source code
+-----------
+
+buff.h
+''''''
+
+.. literalinclude:: ../src_c/buff.h
+ :language: c
+
+
+buff.c
+''''''
+
+.. literalinclude:: ../src_c/buff.c
+ :language: c