Free Electron
JsonReader.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __json_JsonReader_h__
8 #define __json_JsonReader_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 namespace data
16 {
17 
18 //* NOTE wiring logic copied from AsciiStream
19 //* TODO refactor to share overlapping code
20 
21 /**************************************************************************//**
22  @brief Stream intrepreter for reading JSON files
23 
24  @ingroup json
25 *//***************************************************************************/
26 class FE_DL_EXPORT JsonReader : public fe::data::AsciiReader
27 {
28  public:
29  JsonReader(sp<Scope> spScope);
30 virtual ~JsonReader(void);
31 virtual sp<RecordGroup> input(std::istream &istrm);
32 
33  private:
34 
35  void fail(const String &a_message);
36  void handleGroup(String a_key,
37  const Json::Value& a_jsonBlock);
38  void handleAttribute(String a_key,
39  const Json::Value& a_jsonBlock);
40  void handleLayout(String a_key,
41  const Json::Value& a_jsonBlock);
42  void handleTemplate(String a_key,
43  const Json::Value& a_jsonBlock);
44  void handleRecord(String a_layout,String a_key,
45  const Json::Value& a_jsonBlock);
46  void handleInfo(const Json::Value& a_jsonInfo);
47 
48  private:
49  sp<JsonValue> m_spJsonRoot;
50 };
51 
52 } /* namespace data */
53 
54 } /* namespace ext */
55 } /* namespace fe */
56 
57 #endif /* __json_JsonReader_h__ */
kernel
Definition: namespace.dox:3
Represents a JSON value.
Definition: value.h:194
Stream intrepreter for reading JSON files.
Definition: JsonReader.h:26
Automatically reference-counted string container.
Definition: String.h:128