EventFilter
Utilities
interface
writer.h
Go to the documentation of this file.
1
#ifndef JSON_WRITER_H_INCLUDED
2
#define JSON_WRITER_H_INCLUDED
3
4
#include "
value.h
"
5
#include <vector>
6
#include <string>
7
#include <iostream>
8
9
namespace
Json
{
10
11
class
Value
;
12
15
class
JSON_API
Writer
{
16
public
:
17
virtual
~
Writer
();
18
19
virtual
std::string
write
(
const
Value
&
root
) = 0;
20
};
21
28
class
JSON_API
FastWriter
:
public
Writer
{
29
public
:
30
FastWriter
();
31
~FastWriter
()
override
{}
32
33
void
enableYAMLCompatibility();
34
35
public
:
// overridden from Writer
36
std::string
write
(
const
Value
&
root
)
override
;
37
38
private
:
39
void
writeValue
(
const
Value
&
value
);
40
41
std::string
document_
;
42
bool
yamlCompatiblityEnabled_
;
43
};
44
63
class
JSON_API
StyledWriter
:
public
Writer
{
64
public
:
65
StyledWriter
();
66
~StyledWriter
()
override
{}
67
68
public
:
// overridden from Writer
73
std::string
write
(
const
Value
&
root
)
override
;
74
75
private
:
76
void
writeValue
(
const
Value
&
value
);
77
void
writeArrayValue(
const
Value
&
value
);
78
bool
isMultineArray(
const
Value
&
value
);
79
void
pushValue(
const
std::string
&
value
);
80
void
writeIndent();
81
void
writeWithIndent(
const
std::string
&
value
);
82
void
indent
();
83
void
unindent();
84
void
writeCommentBeforeValue(
const
Value
&
root
);
85
void
writeCommentAfterValueOnSameLine(
const
Value
&
root
);
86
bool
hasCommentForValue(
const
Value
&
value
);
87
static
std::string
normalizeEOL(
const
std::string
&
text
);
88
89
typedef
std::vector<std::string>
ChildValues
;
90
91
ChildValues
childValues_
;
92
std::string
document_
;
93
std::string
indentString_
;
94
int
rightMargin_
;
95
int
indentSize_
;
96
bool
addChildValues_
;
97
};
98
119
class
JSON_API
StyledStreamWriter
{
120
public
:
121
StyledStreamWriter
(
std::string
indentation
=
"\t"
);
122
~StyledStreamWriter
() {}
123
124
public
:
130
void
write
(std::ostream &
out
,
const
Value
&
root
);
131
132
private
:
133
void
writeValue
(
const
Value
&
value
);
134
void
writeArrayValue(
const
Value
&
value
);
135
bool
isMultineArray(
const
Value
&
value
);
136
void
pushValue(
const
std::string
&
value
);
137
void
writeIndent();
138
void
writeWithIndent(
const
std::string
&
value
);
139
void
indent
();
140
void
unindent();
141
void
writeCommentBeforeValue(
const
Value
&
root
);
142
void
writeCommentAfterValueOnSameLine(
const
Value
&
root
);
143
bool
hasCommentForValue(
const
Value
&
value
);
144
static
std::string
normalizeEOL(
const
std::string
&
text
);
145
146
typedef
std::vector<std::string>
ChildValues
;
147
148
ChildValues
childValues_
;
149
std::ostream *
document_
;
150
std::string
indentString_
;
151
int
rightMargin_
;
152
std::string
indentation_
;
153
bool
addChildValues_
;
154
};
155
156
std::string
JSON_API
valueToString
(
Int
value
);
157
std::string
JSON_API
valueToString
(
UInt
value
);
158
std::string
JSON_API
valueToString
(
double
value
);
159
std::string
JSON_API
valueToString
(
bool
value
);
160
std::string
JSON_API
valueToQuotedString
(
const
char
*
value
);
161
164
std::ostream &
operator<<
(std::ostream &,
const
Value
&
root
);
165
166
}
// namespace Json
167
168
#endif // JSON_WRITER_H_INCLUDED
Json::StyledWriter::~StyledWriter
~StyledWriter() override
Definition:
writer.h:66
Json::valueToString
std::string valueToString(Int value)
Json::StyledWriter::indentString_
std::string indentString_
Definition:
writer.h:93
Json::StyledStreamWriter::rightMargin_
int rightMargin_
Definition:
writer.h:151
Json::StyledWriter::ChildValues
std::vector< std::string > ChildValues
Definition:
writer.h:89
Json::StyledWriter::indentSize_
int indentSize_
Definition:
writer.h:95
Json::StyledWriter::document_
std::string document_
Definition:
writer.h:92
Json::StyledStreamWriter::document_
std::ostream * document_
Definition:
writer.h:149
Json
JSON (JavaScript Object Notation).
Definition:
EvFDaqDirector.h:44
Json::StyledWriter
Writes a Value in JSON format in a human friendly way.
Definition:
writer.h:63
Json::StyledStreamWriter
Writes a Value in JSON format in a human friendly way, to a stream rather than to a string.
Definition:
writer.h:119
Json::StyledStreamWriter::~StyledStreamWriter
~StyledStreamWriter()
Definition:
writer.h:122
Json::Int
int Int
Definition:
forwards.h:16
Json::UInt
unsigned int UInt
Definition:
forwards.h:20
value
Definition:
value.py:1
root
Definition:
RooFitFunction.h:10
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
JSON_API
#define JSON_API
Definition:
config.h:40
Json::StyledStreamWriter::ChildValues
std::vector< std::string > ChildValues
Definition:
writer.h:146
writeEcalDQMStatus.write
write
Definition:
writeEcalDQMStatus.py:48
Json::StyledWriter::addChildValues_
bool addChildValues_
Definition:
writer.h:96
Json::FastWriter
Outputs a Value in JSON format without formatting (not human friendly).
Definition:
writer.h:28
Json::valueToQuotedString
std::string valueToQuotedString(const char *value)
util.rrClient.indent
indent
Definition:
rrClient.py:41
Json::operator<<
std::ostream & operator<<(std::ostream &, const Value &root)
Output using the StyledStreamWriter.
printContent_cfi.indentation
indentation
Definition:
printContent_cfi.py:10
Json::StyledWriter::rightMargin_
int rightMargin_
Definition:
writer.h:94
MillePedeFileConverter_cfg.out
out
Definition:
MillePedeFileConverter_cfg.py:31
reco::JetExtendedAssociation::Value
reco::JetExtendedAssociation::JetExtendedData Value
Definition:
JetExtendedAssociation.h:27
Json::StyledStreamWriter::addChildValues_
bool addChildValues_
Definition:
writer.h:153
runonSM.text
text
Definition:
runonSM.py:43
Json::StyledStreamWriter::indentation_
std::string indentation_
Definition:
writer.h:152
Json::StyledStreamWriter::childValues_
ChildValues childValues_
Definition:
writer.h:148
Json::Writer
Abstract class for writers.
Definition:
writer.h:15
Json::StyledStreamWriter::indentString_
std::string indentString_
Definition:
writer.h:150
value.h
edm::writeParameterValue::writeValue
void writeValue(std::ostream &os, int indentation, int const &value_, ValueFormat format)
Definition:
ParameterDescription.cc:639
Json::StyledWriter::childValues_
ChildValues childValues_
Definition:
writer.h:91
Json::FastWriter::~FastWriter
~FastWriter() override
Definition:
writer.h:31
Json::FastWriter::yamlCompatiblityEnabled_
bool yamlCompatiblityEnabled_
Definition:
writer.h:42
Json::Value
Represents a JSON value.
Definition:
value.h:99
Json::FastWriter::document_
std::string document_
Definition:
writer.h:41
Generated for CMSSW Reference Manual by
1.8.16