Add support for TaintedString

This commit is contained in:
Zahary Karadjov 2020-11-12 21:00:10 +02:00
parent 3b0c9eafa4
commit 32f75d93b0
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
2 changed files with 6 additions and 0 deletions

View File

@ -382,6 +382,9 @@ proc readValue*[T](r: var JsonReader, value: var T)
value = r.lexer.strVal value = r.lexer.strVal
r.lexer.next() r.lexer.next()
elif value is TaintedString:
value = TaintedString r.readValue(string)
elif value is seq[char]: elif value is seq[char]:
r.requireToken tkString r.requireToken tkString
value.setLen(r.lexer.strVal.len) value.setLen(r.lexer.strVal.len)

View File

@ -181,6 +181,9 @@ proc writeValue*(w: var JsonWriter, value: auto) =
append '"' append '"'
elif value is TaintedString:
writeValue(w, string value)
elif value is bool: elif value is bool:
append if value: "true" else: "false" append if value: "true" else: "false"