JSON writer context.
More...
#include <writerContext.hpp>
JSON writer context.
Context is used to store mapping options and serialization buffers
- Author
- Vincent Lachenal
- Since
- 0.1
◆ WriterContext() [1/4]
anch::json::WriterContext::WriterContext |
( |
| ) |
|
|
delete |
◆ WriterContext() [2/4]
anch::json::WriterContext::WriterContext |
( |
const WriterContext & | context | ) |
|
|
delete |
Forbids WriterContext
copy constructor
- Parameters
-
context | the context not to copy |
◆ WriterContext() [3/4]
anch::json::WriterContext::WriterContext |
( |
WriterContext && | context | ) |
|
|
delete |
Forbids WriterContext
move constructor
- Parameters
-
context | the context not to move |
◆ WriterContext() [4/4]
WriterContext
constructor
- Parameters
-
os | the ouput stream to write in |
options | the mapping options to use |
◆ ~WriterContext()
virtual anch::json::WriterContext::~WriterContext |
( |
| ) |
|
|
virtualnoexcept |
◆ beginArray()
void anch::json::WriterContext::beginArray |
( |
| ) |
|
Write begin array ('[') and push first field in context
◆ beginObject()
void anch::json::WriterContext::beginObject |
( |
| ) |
|
Write begin array ('{') and push first field in context
◆ endArray()
void anch::json::WriterContext::endArray |
( |
| ) |
|
Write end array (']') and pop first field from context
◆ endObject()
void anch::json::WriterContext::endObject |
( |
| ) |
|
Write end array ('}') and pop first field from context
◆ next()
void anch::json::WriterContext::next |
( |
| ) |
|
Write field/value delimiter (',') according to context (first field or not)
◆ writeEmptyArray()
bool anch::json::WriterContext::writeEmptyArray |
( |
const std::string & | field | ) |
|
Write empty collection according to options.
When serialize, it will be serialized as '"<field>":[]'
- Parameters
-
◆ writeEmptyObject()
bool anch::json::WriterContext::writeEmptyObject |
( |
const std::string & | field | ) |
|
Write empty object (map) according to options.
When serialize, it will be serialized as '"<field>":{}'
- Parameters
-
◆ writeField()
void anch::json::WriterContext::writeField |
( |
const std::string & | field | ) |
|
Write field and add ':' into output stream.
Call next()
to add ',' or not before field
- Parameters
-
◆ writeNull()
bool anch::json::WriterContext::writeNull |
( |
const std::string & | field | ) |
|
Write null
value or not according to options
- Parameters
-
- Returns
true
when null
value has been serialize, false
otherwise
◆ output
std::ostream& anch::json::WriterContext::output |
The input stream to parse
The documentation for this class was generated from the following file: