src/tlv/parser

Types

Parser = ref object
  buf: seq[byte]             ## Stores the buffer to be parsed
  cursor: int                ## Stores the current position from which future values will be read
  
The main parser object. To initialize, call initParser and then setBuffer

Procs

proc extractBool(parser: Parser): bool {....raises: [], tags: [].}
Extracts a bool from the cursor's position
proc extractChar(parser: Parser): char {....raises: [], tags: [].}
Extracts the next char from the cursor's position
proc extractInt32(parser: Parser): int32 {....raises: [], tags: [].}
Extracts the next int32 from the cursor's position
proc extractString(parser: Parser): string {....raises: [], tags: [].}
Extracts a string from the cursor's position
proc getCursor(parser: Parser): int {....raises: [], tags: [].}
Returns the parser's cursor
proc initParser(): Parser {....raises: [], tags: [].}
Initializes the parser
proc initParser(builder: Builder): Parser {....raises: [], tags: [].}
Initializes the parser using a builder's buf
proc setBuffer(parser: Parser; buf: seq[byte]) {....raises: [], tags: [].}
Sets the parser buffer and resets the cursor to 0