diff options
Diffstat (limited to 'src/io')
-rw-r--r-- | src/io/bufreader.nim | 5 | ||||
-rw-r--r-- | src/io/bufwriter.nim | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/io/bufreader.nim b/src/io/bufreader.nim index 6de269ac..3ee36208 100644 --- a/src/io/bufreader.nim +++ b/src/io/bufreader.nim @@ -6,6 +6,7 @@ import std/tables import io/dynstream import types/blob +import types/color import types/formdata import types/opt import types/url @@ -53,6 +54,7 @@ proc sread*(reader: var BufferedReader; part: var FormDataEntry) proc sread*(reader: var BufferedReader; blob: var Blob) proc sread*[T](reader: var BufferedReader; o: var Option[T]) proc sread*[T, E](reader: var BufferedReader; o: var Result[T, E]) +proc sread*(reader: var BufferedReader; c: var RGBAColor) {.inline.} proc readData(reader: var BufferedReader; buffer: pointer; len: int) = assert reader.bufIdx + len <= reader.buffer.len @@ -198,3 +200,6 @@ proc sread*[T, E](reader: var BufferedReader; o: var Result[T, E]) = o.err(e) else: o.err() + +proc sread*(reader: var BufferedReader; c: var RGBAColor) = + reader.sread(uint32(c)) diff --git a/src/io/bufwriter.nim b/src/io/bufwriter.nim index 75da4190..0957d3e8 100644 --- a/src/io/bufwriter.nim +++ b/src/io/bufwriter.nim @@ -6,11 +6,11 @@ import std/sets import std/tables import io/dynstream - import types/blob +import types/color import types/formdata -import types/url import types/opt +import types/url type BufferedWriter* = object stream: DynStream @@ -77,6 +77,7 @@ proc swrite*(writer: var BufferedWriter; part: FormDataEntry) proc swrite*(writer: var BufferedWriter; blob: Blob) proc swrite*[T](writer: var BufferedWriter; o: Option[T]) proc swrite*[T, E](writer: var BufferedWriter; o: Result[T, E]) +proc swrite*(writer: var BufferedWriter; c: RGBAColor) {.inline.} proc writeData(writer: var BufferedWriter; buffer: pointer; len: int) = let targetLen = writer.bufLen + len @@ -181,3 +182,6 @@ proc swrite*[T, E](writer: var BufferedWriter; o: Result[T, E]) = else: when not (E is void): writer.swrite(o.error) + +proc swrite*(writer: var BufferedWriter; c: RGBAColor) = + writer.swrite(uint32(c)) |