-
Notifications
You must be signed in to change notification settings - Fork 0
/
json.h
50 lines (35 loc) · 1.06 KB
/
json.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once
#ifndef EL_JSON_H
# define EL_JSON_H
#include "common.h"
#include <QByteArray>
#include <QString>
#include <QStringLiteral>
#include <QVector>
namespace El {
/// Helper class for parsing JSON documents with Nord Pool price records
class Json {
public:
/// Parses the JSON document and returns a JSON class instance with prices
/// @param[in] json JSON document
/// @param[in] region Optional region (defaults to "ee")
/// @return Json class instance with prices
/// @throws Exception on errors
static Json from_json(QByteArray const &json, QString const ®ion = QStringLiteral(u"ee"));
/// Dtor
~Json();
/// Returns price blocks
inline auto const &prices() const noexcept { return _prices; }
private:
/// price blocks
PriceBlocks _prices;
/// Private ctor
Json();
/// Parses the JSON document
/// @param[in] region region
/// @param[in] json JSON document
/// @throws Exception on errors
void parse(QString const ®ion, QByteArray const &json);
};
} // namespace El
#endif