Jpp
18.0.0
the software that should make you happy
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
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::JComparator::JComparator
JComparator()
Defaut constructor.
Definition:
JSon/JComparator.hh:36
JSon.hh
string
then awk string
Definition:
pre-calibration.sh:45
JSON::JComparator
Auxiliary data structure to compare (part of) JSon data.
Definition:
JSon/JComparator.hh:29
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::SEPARATOR
char SEPARATOR
Definition:
JSon/JComparator.hh:31
json
nlohmann::json json
Definition:
JSupernovaMonitor.cc:28
Generated by
1.8.5