MythTV master
ParseText.h
Go to the documentation of this file.
1/* ParseText.h
2
3 Copyright (C) David C. J. Matthews 2004 dm at prolingua.co.uk
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 This program 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
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
18 Or, point your browser to http://www.gnu.org/copyleft/gpl.html
19
20*/
21
22
23#ifndef PARSETEXT_H
24#define PARSETEXT_H
25
26#include <cstdlib> // malloc etc.
27
28class MHGroup;
29
30#include "ParseNode.h"
31
33{
34 public:
35 explicit MHParseText(QByteArray &program)
36 : m_string((unsigned char *)malloc(100)),
37 m_data(program) {}
38 ~MHParseText() override;
39
40 // Parse the text and return a pointer to the parse tree
41 MHParseNode *Parse() override; // MHParseBase
42
43 private:
44 void GetNextChar();
45 void NextSym();
47 void Error(const char *str) const;
48
49 int m_lineCount {1};
50
51 enum ParseTextType : std::uint8_t
56
57 char m_ch {0};
58 int m_nTag {0};
59 int m_nInt {0};
60 bool m_fBool {false};
61 unsigned char *m_string {nullptr};
63
64 unsigned int m_p {0}; // Count of bytes read
65 QByteArray m_data;
66};
67
68#endif
Definition: Groups.h:47
int m_nStringLength
Definition: ParseText.h:62
ParseTextType m_nType
Definition: ParseText.h:55
int m_lineCount
Definition: ParseText.h:49
MHParseNode * Parse() override
Definition: ParseText.cpp:1113
unsigned char * m_string
Definition: ParseText.h:61
@ PTStartSection
Definition: ParseText.h:52
@ PTEndSection
Definition: ParseText.h:53
unsigned int m_p
Definition: ParseText.h:64
MHParseText(QByteArray &program)
Definition: ParseText.h:35
int m_nInt
Definition: ParseText.h:59
void NextSym()
Definition: ParseText.cpp:385
QByteArray m_data
Definition: ParseText.h:65
bool m_fBool
Definition: ParseText.h:60
char m_ch
Definition: ParseText.h:57
MHParseNode * DoParse()
Definition: ParseText.cpp:844
void GetNextChar()
Definition: ParseText.cpp:54
~MHParseText() override
Definition: ParseText.cpp:48
int m_nTag
Definition: ParseText.h:58
void Error(const char *str) const
Definition: ParseText.cpp:379