PVData C++  8.0.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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 
30 namespace epics{namespace pvData{
31 
32 class BitSet;
33 
41 struct epicsShareClass JSONPrintOptions
43 {
44  bool multiLine;
46  unsigned indent;
47  bool json5;
49 };
50 
56 epicsShareFunc
57 void printJSON(std::ostream& strm,
58  const PVStructure& val,
59  const BitSet& mask,
60  const JSONPrintOptions& opts = JSONPrintOptions());
61 
65 epicsShareFunc
66 void printJSON(std::ostream& strm,
67  const PVField& val,
68  const JSONPrintOptions& opts = JSONPrintOptions());
69 
70 // To be deprecated in favor of previous form
71 FORCE_INLINE
72 void printJSON(std::ostream& strm,
73  const PVField::const_shared_pointer& val,
74  const JSONPrintOptions& opts = JSONPrintOptions())
75 {
76  printJSON(strm, *val, opts);
77 }
78 
87 epicsShareFunc
88 PVStructure::shared_pointer parseJSON(std::istream& strm);
89 
103 epicsShareFunc
104 void parseJSON(std::istream& strm,
105  PVField& dest,
106  BitSet *assigned=0);
107 
108 // To be deprecated in favor of previous form
109 FORCE_INLINE
110 void parseJSON(std::istream& strm,
111  const PVField::shared_pointer& dest,
112  BitSet *assigned=0)
113 {
114  parseJSON(strm, *dest, assigned);
115 }
116 
117 
130 epicsShareFunc
132  yajl_handle handle);
133 
134 namespace yajl {
135 // undef implies API version 0
136 #ifndef EPICS_YAJL_VERSION
137 typedef long integer_arg;
138 typedef unsigned size_arg;
139 #else
140 typedef long long integer_arg;
141 typedef size_t size_arg;
142 #endif
143 } // namespace epics::pvData::yajl
144 
147 }} // namespace epics::pvData
148 
149 #endif // PV_JSON_H
bool json5
Output extended JSON (eg. NaN).
Definition: json.h:47
unsigned indent
Initial indentation (# of spaces)
Definition: json.h:46
bool yajl_parse_helper(std::istream &src, yajl_handle handle)
Data interface for a structure,.
Definition: pvData.h:712
bool ignoreUnprintable
ignore union/union array when encountered
Definition: json.h:45
bool multiLine
include new lines
Definition: json.h:44
Options used during printing.
Definition: json.h:42
PVField is the base class for each PVData field.
Definition: pvData.h:152
void printJSON(std::ostream &strm, const PVStructure &val, const BitSet &mask, const JSONPrintOptions &opts=JSONPrintOptions())
PVStructure::shared_pointer parseJSON(std::istream &strm)
A vector of bits.
Definition: bitSet.h:56