edbee - Qt Editor Library
jsonparser.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <QVariant>
9 
10 class QIODevice;
11 
12 namespace edbee {
13 
18 {
19 public:
20  JsonParser();
21  virtual ~JsonParser();
22 
23  bool parse( const QString& fileName);
24  bool parse( QIODevice* device );
25  bool parse( const QByteArray& bytesIn );
26 
27  QVariant result();
28 
29  void clearErrors();
30 
31  QString errorMessage() const;
32  int errorLine() const;
33  int errorColumn() const;
34 
35  QString fullErrorMessage() const;
36 
37 protected:
38 
39  QByteArray stripCommentsFromJson( const QByteArray& bytesIn );
40 
41 private:
42 
43  QString errorMessage_;
44  int errorOffset_;
45  int errorLine_;
46  int errorColumn_;
47 
48  QVariant result_;
49 
50 };
51 
52 } //edbee
QString fullErrorMessage() const
Returns the full eror message.
Definition: jsonparser.cpp:141
JsonParser()
Constructs the jsonparser.
Definition: jsonparser.cpp:20
int errorLine() const
returns the line number of the error
Definition: jsonparser.cpp:127
QByteArray stripCommentsFromJson(const QByteArray &bytesIn)
reads all bytes from the io device, while removing comments and keeping the number of lines quick and...
Definition: jsonparser.cpp:150
QVariant result()
Returns the result of the json parsing.
Definition: jsonparser.cpp:105
int errorColumn() const
Returns the error column.
Definition: jsonparser.cpp:134
bool parse(const QString &fileName)
loads the given keymap file returns true on success
Definition: jsonparser.cpp:39
QString errorMessage() const
Returns the errormessage.
Definition: jsonparser.cpp:120
Copyright 2011-2013 - Reliable Bits Software by Blommers IT.
Definition: commentcommand.cpp:22
virtual ~JsonParser()
The parser destructor.
Definition: jsonparser.cpp:31
void clearErrors()
Clears the error flags/variables.
Definition: jsonparser.cpp:112
A Json Parser that supports strings in json sources! standard json doesn&#39;t support comments...
Definition: jsonparser.h:17