PVData C++  8.0.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Classes | Functions
JSON print/parse

Classes

struct  epics::pvData::JSONPrintOptions
 Options used during printing. More...
 

Functions

void epics::pvData::printJSON (std::ostream &strm, const PVStructure &val, const BitSet &mask, const JSONPrintOptions &opts=JSONPrintOptions())
 
void epics::pvData::printJSON (std::ostream &strm, const PVField &val, const JSONPrintOptions &opts=JSONPrintOptions())
 
void epics::pvData::printJSON (std::ostream &strm, const PVField::const_shared_pointer &val, const JSONPrintOptions &opts=JSONPrintOptions())
 
PVStructure::shared_pointer epics::pvData::parseJSON (std::istream &strm)
 
void epics::pvData::parseJSON (std::istream &strm, PVField &dest, BitSet *assigned=0)
 
void epics::pvData::parseJSON (std::istream &strm, const PVField::shared_pointer &dest, BitSet *assigned=0)
 
bool epics::pvData::yajl_parse_helper (std::istream &src, yajl_handle handle)
 

Detailed Description

Printing PVField as JSON and parsing JSON into PVField.

Function Documentation

PVStructure::shared_pointer epics::pvData::parseJSON ( std::istream strm)

Parse JSON text into a PVStructure

Restrictions:

  • Top level must be {} dict/object
  • field values must be number, string, array, or dict/object
  • array values must be number or string
void epics::pvData::parseJSON ( std::istream strm,
PVField &  dest,
BitSet *  assigned = 0 
)

Parse JSON and store into the provided PVStructure.

Restrictions:

  • array of union not supported
  • Only scalar value assigned to union
Parameters
strmRead JSON text from stream
destStore in fields of this structure
assignedWhich fields of dest were assigned. (Optional)
Exceptions
std::runtime_erroron failure. dest and assigned may be modified.
Version
Overload added after 7.0.0
void epics::pvData::printJSON ( std::ostream strm,
const PVStructure &  val,
const BitSet &  mask,
const JSONPrintOptions &  opts = JSONPrintOptions() 
)

Print PVStructure as JSON

'mask' selects those fields which will be printed.

Version
Overload added after 7.0.0
void epics::pvData::printJSON ( std::ostream strm,
const PVField &  val,
const JSONPrintOptions &  opts = JSONPrintOptions() 
)

Print PVField as JSON

Version
Overload added after 7.0.0
bool epics::pvData::yajl_parse_helper ( std::istream src,
yajl_handle  handle 
)

Wrapper around yajl_parse()

Parse entire input stream. Errors if extranious non-whitespace found after the point were parsing completes.

Parameters
srcThe stream from which input charactors are read
handleA parser handle previously allocated with yajl_alloc(). Not free'd on success or failure.
Returns
true if parsing completes successfully. false if parsing cancelled by callback. throws other errors
Note
The form of this call depends on EPICS_YAJL_VERSION