File: ser_context.md

package info (click to toggle)
jsoncons 1.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 17,584 kB
  • sloc: cpp: 136,382; sh: 33; makefile: 5
file content (33 lines) | stat: -rw-r--r-- 1,406 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
### jsoncons::ser_context

```cpp
#include <jsoncons/ser_context.hpp>

class ser_context;
```

Provides contextual information for serializing and deserializing JSON and JSON-like data formats.
This information may be used for error reporting.

    virtual size_t line() const;
Returns the line number for the text being parsed.
Line numbers (if available) start at 1. The default implementation returns 0.

    virtual size_t column() const;
Returns the column number to the end of the text being parsed.
Column numbers (if available) start at 1. The default implementation returns 0.

    virtual size_t begin_position() const;                                             (since 1.3.1)
`position()` is defined for all JSON elements reported to the visitor, and indicates
the position of the character at the beginning of the element, e.g. '"' for a string
or the first digit for a positive number.
Currently only supported for the JSON parser.

    virtual size_t position() const;
Currently returns the same value as `begin_position()`. Since 1.3.1, prefer `begin_position()`. 

    virtual size_t end_position() const;
`end_position()` is defined for all JSON elements reported to the visitor, and indicates
the position after the character at the end of the element, e.g. one past the closing '"' for a string
or the one past the last digit for a number.
Currently only supported for the JSON parser.