QJson home page
Main Page
Related Pages
Namespaces
Classes
Files
File List
src
json_scanner.h
1
/* This file is part of QJson
2
*
3
* Copyright (C) 2008 Flavio Castelli <flavio.castelli@gmail.com>
4
*
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License version 2.1, as published by the Free Software Foundation.
8
*
9
*
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
14
*
15
* You should have received a copy of the GNU Lesser General Public License
16
* along with this library; see the file COPYING.LIB. If not, write to
17
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
* Boston, MA 02110-1301, USA.
19
*/
20
21
#ifndef _JSON_SCANNER
22
#define _JSON_SCANNER
23
24
#include <QtCore/QIODevice>
25
#include <QtCore/QVariant>
26
#include <QtCore/QLocale>
27
28
#define YYSTYPE QVariant
29
30
// Only include FlexLexer.h if it hasn't been already included
31
#if ! defined(yyFlexLexerOnce)
32
#include <FlexLexer.h>
33
#endif
34
35
#include "parser_p.h"
36
37
38
39
namespace
yy
{
40
class
location;
41
int
yylex(YYSTYPE *yylval,
yy::location
*yylloc, QJson::ParserPrivate* driver);
42
}
43
44
class
JSonScanner :
public
yyFlexLexer
45
{
46
public
:
47
explicit
JSonScanner(QIODevice* io);
48
~JSonScanner();
49
50
void
allowSpecialNumbers(
bool
allow);
51
52
int
yylex(YYSTYPE* yylval,
yy::location
*yylloc);
53
int
yylex();
54
int
LexerInput(
char
* buf,
int
max_size);
55
protected
:
56
bool
m_allowSpecialNumbers;
57
QIODevice* m_io;
58
59
YYSTYPE* m_yylval;
60
yy::location
* m_yylloc;
61
bool
m_criticalError;
62
QString m_currentString;
63
QLocale m_C_locale;
64
};
65
66
#endif
yy::location
Abstract a location.
Definition:
location.hh:49
yy
Definition:
json_parser.cc:138
hosts this site.
Send comments to:
QJson Developers