rllib  1
rljson.h
Go to the documentation of this file.
1 /***************************************************************************
2  rljson.h - description
3  -------------------
4  begin : Sat Jul 29 2023
5  copyright : (C) Lehrig Software Enigineering
6  email : lehrig@t-online.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This library is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as *
13  * published by the Free Software Foundation *
14  * *
15  ***************************************************************************/
16 #ifndef _RL_JSON_H_
17 #define _RL_JSON_H_
18 
19 #include "rldefine.h"
20 #include "rlstring.h"
21 
22 extern const char rlCRLF[];
23 
27 typedef struct
28 {
29  int startsWithText; // "text"
33  rlString text; // white space in front of the tag name is ignored
34  int optColon; // a colon must follow when text is a tag
35  int optOpenBracket; // a openBracket { might follow
36  int optBeginArray; // a beginArray [ might follow
37  int optParamType; // 0=default=text 1=integer 2=float
38  rlString param; // the parameter in text form
39  int intParam; // 0 if there is no integer number
40  float floatParam; // 0.0 if there is no floating point number
41  int optComma; // tells us that more elements follow
43 
47 class rlJSON
48 {
49 public:
53  rlJSON();
54 
58  virtual ~rlJSON();
59 
63  int initRecord(rlJSONrecord *record);
64 
68  int interpret(const char *line, rlJSONrecord *record);
69 
73  int print(FILE *fout, rlJSONrecord *record, const char *indent="");
74 };
75 
76 #endif
virtual ~rlJSON()
Definition: rljson.cpp:22
float floatParam
Definition: rljson.h:40
int print(FILE *fout, rlJSONrecord *record, const char *indent="")
Definition: rljson.cpp:121
rlString text
Definition: rljson.h:33
int startsWithText
Definition: rljson.h:29
int interpret(const char *line, rlJSONrecord *record)
Definition: rljson.cpp:44
int startsWithOpenBracket
Definition: rljson.h:30
int optOpenBracket
Definition: rljson.h:35
rlString param
Definition: rljson.h:38
int optComma
Definition: rljson.h:41
int intParam
Definition: rljson.h:39
rlJSON()
Definition: rljson.cpp:18
int optBeginArray
Definition: rljson.h:36
int startsWithEndArray
Definition: rljson.h:32
int startsWithCloseBracket
Definition: rljson.h:31
int optParamType
Definition: rljson.h:37
int initRecord(rlJSONrecord *record)
Definition: rljson.cpp:26
const char rlCRLF[]
Definition: rlstring.cpp:23
int optColon
Definition: rljson.h:34
Definition: rljson.h:47