Jpp
19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
software
JSon
JSon/JComparator.hh
Go to the documentation of this file.
1
#ifndef __JSON__JCOMPARATOR__
2
#define __JSON__JCOMPARATOR__
3
4
#include <ostream>
5
#include <iomanip>
6
7
#include "
JSon/JSon.hh
"
8
9
10
/**
11
* \author mdejong
12
*/
13
14
namespace
JSON
{}
15
namespace
JPP
{
using namespace
JSON
; }
16
17
namespace
JSON
{
18
19
/**
20
* Auxiliary data structure to compare (part of) JSon data.
21
*
22
* The key can be used to specify which part of the JSon data to print.\n
23
* For example:
24
* <pre>
25
* "Error.Code"
26
* </pre>
27
* will compare the error codes some specific JSon data.
28
*/
29
struct
JComparator
{
30
31
char
SEPARATOR
=
'.'
;
32
33
/**
34
* Defaut constructor.
35
*/
36
JComparator
()
37
{}
38
39
40
/**
41
* Auxiliary method to compare (part of) JSon data.
42
*
43
* \param ja JSon data
44
* \param jb JSon data
45
* \param key key
46
*/
47
inline
json
operator()
(
const
json& ja,
const
json& jb,
const
std::string& key)
const
48
{
49
using namespace
std
;
50
51
const
size_t
pos = key.find(
SEPARATOR
);
52
53
if
(pos != string::npos) {
54
return
(*
this
)(ja[key.substr(0,pos)], ja[key.substr(0,pos)], key.substr(pos + 1));
55
}
else
if
(key !=
""
) {
56
return
json::diff(ja[key], jb[key]);
57
}
else
{
58
return
json::diff(ja, jb);
59
}
60
}
61
};
62
}
63
64
#endif
JSon.hh
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition
JAAnetToolkit.hh:43
JSON
Auxiliary classes and methods for detector calibration.
Definition
JSon/JComparator.hh:14
std
Definition
JSTDTypes.hh:14
JSON::JComparator
Auxiliary data structure to compare (part of) JSon data.
Definition
JSon/JComparator.hh:29
JSON::JComparator::SEPARATOR
char SEPARATOR
Definition
JSon/JComparator.hh:31
JSON::JComparator::operator()
json operator()(const json &ja, const json &jb, const std::string &key) const
Auxiliary method to compare (part of) JSon data.
Definition
JSon/JComparator.hh:47
JSON::JComparator::JComparator
JComparator()
Defaut constructor.
Definition
JSon/JComparator.hh:36
Generated by
1.12.0