PVData C++ 8.0.7
Loading...
Searching...
No Matches
json.h
1/*
2 * Copyright information and license terms for this software can be
3 * found in the file LICENSE that is included with the distribution
4 */
5#ifndef PV_JSON_H
6#define PV_JSON_H
7
8#include <istream>
9#include <ostream>
10#include <string>
11#include <map>
12
13#include <pv/pvdVersion.h>
14#include <pv/pvData.h>
15
16#ifdef epicsExportSharedSymbols
17# define pvjson_epicsExportSharedSymbols
18# undef epicsExportSharedSymbols
19#endif
20
21#include <yajl_parse.h>
22
23#ifdef pvjson_epicsExportSharedSymbols
24# define epicsExportSharedSymbols
25# include "shareLib.h"
26#endif
27
28#include <shareLib.h>
29
30namespace epics{namespace pvData{
31
32class BitSet;
33
42struct epicsShareClass JSONPrintOptions
43{
44 bool multiLine;
46 unsigned indent;
47 bool json5;
49};
50
56epicsShareFunc
57void printJSON(std::ostream& strm,
58 const PVStructure& val,
59 const BitSet& mask,
60 const JSONPrintOptions& opts = JSONPrintOptions());
61
65epicsShareFunc
66void printJSON(std::ostream& strm,
67 const PVField& val,
68 const JSONPrintOptions& opts = JSONPrintOptions());
69
70// To be deprecated in favor of previous form
71FORCE_INLINE
72void printJSON(std::ostream& strm,
73 const PVField::const_shared_pointer& val,
74 const JSONPrintOptions& opts = JSONPrintOptions())
75{
76 printJSON(strm, *val, opts);
77}
78
87epicsShareFunc
88PVStructure::shared_pointer parseJSON(std::istream& strm);
89
103epicsShareFunc
104void parseJSON(std::istream& strm,
105 PVField& dest,
106 BitSet *assigned=0);
107
108// To be deprecated in favor of previous form
109FORCE_INLINE
110void parseJSON(std::istream& strm,
111 const PVField::shared_pointer& dest,
112 BitSet *assigned=0)
113{
114 parseJSON(strm, *dest, assigned);
115}
116
117
130epicsShareFunc
131bool yajl_parse_helper(std::istream& src,
132 yajl_handle handle);
133
134namespace yajl {
135// undef implies API version 0
136#ifndef EPICS_YAJL_VERSION
137typedef long integer_arg;
138typedef unsigned size_arg;
139#else
140typedef long long integer_arg;
141typedef size_t size_arg;
142#endif
143} // namespace epics::pvData::yajl
144
147}} // namespace epics::pvData
148
149#endif // PV_JSON_H
A vector of bits.
Definition bitSet.h:56
PVField is the base class for each PVData field.
Definition pvData.h:155
Data interface for a structure,.
Definition pvData.h:713
void printJSON(std::ostream &strm, const PVStructure &val, const BitSet &mask, const JSONPrintOptions &opts=JSONPrintOptions())
bool yajl_parse_helper(std::istream &src, yajl_handle handle)
PVStructure::shared_pointer parseJSON(std::istream &strm)
epics
Definition convert.h:21
Options used during printing.
Definition json.h:43
unsigned indent
Initial indentation (# of spaces)
Definition json.h:46
bool json5
Output extended JSON (eg. NaN).
Definition json.h:47
bool ignoreUnprintable
ignore union/union array when encountered
Definition json.h:45
bool multiLine
include new lines
Definition json.h:44