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 #if !defined(PARSETEXT_H)
24 #define PARSETEXT_H
25 
26 #include <cstdlib> // malloc etc.
27 
28 class MHGroup;
29 
30 #include "ParseNode.h"
31 
32 class MHParseText: public MHParseBase
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 
55 
56  char m_ch {0};
57  int m_nTag {0};
58  int m_nInt {0};
59  bool m_fBool {false};
60  unsigned char *m_string {nullptr};
61  int m_nStringLength {0};
62 
63  unsigned int m_p {0}; // Count of bytes read
64  QByteArray m_data;
65 };
66 
67 #endif
MHParseText::GetNextChar
void GetNextChar()
Definition: ParseText.cpp:54
MHGroup
Definition: Groups.h:46
MHParseText::m_string
unsigned char * m_string
Definition: ParseText.h:60
MHParseText::m_fBool
bool m_fBool
Definition: ParseText.h:59
MHParseText::ParseTextType
ParseTextType
Definition: ParseText.h:51
MHParseText::m_nStringLength
int m_nStringLength
Definition: ParseText.h:61
MHParseText::m_lineCount
int m_lineCount
Definition: ParseText.h:49
MHParseText::DoParse
MHParseNode * DoParse()
Definition: ParseText.cpp:852
MHParseText::m_nTag
int m_nTag
Definition: ParseText.h:57
MHParseText::PTInt
@ PTInt
Definition: ParseText.h:51
MHParseText::MHParseText
MHParseText(QByteArray &program)
Definition: ParseText.h:35
MHParseText::Error
void Error(const char *str) const
Definition: ParseText.cpp:379
MHParseText::m_ch
char m_ch
Definition: ParseText.h:56
MHParseText::m_data
QByteArray m_data
Definition: ParseText.h:64
MHParseText::PTNull
@ PTNull
Definition: ParseText.h:52
ParseNode.h
MHParseText::~MHParseText
~MHParseText() override
Definition: ParseText.cpp:48
MHParseText::PTEndSeq
@ PTEndSeq
Definition: ParseText.h:52
MHParseText::PTTag
@ PTTag
Definition: ParseText.h:51
MHParseText::PTStartSection
@ PTStartSection
Definition: ParseText.h:51
MHParseBase
Definition: ParseNode.h:31
MHParseText::PTString
@ PTString
Definition: ParseText.h:51
MHParseText::PTEOF
@ PTEOF
Definition: ParseText.h:53
MHParseText::PTStartSeq
@ PTStartSeq
Definition: ParseText.h:52
MHParseText::m_p
unsigned int m_p
Definition: ParseText.h:63
MHParseNode
Definition: ParseNode.h:38
MHParseText::PTEndSection
@ PTEndSection
Definition: ParseText.h:52
MHParseText::PTEnum
@ PTEnum
Definition: ParseText.h:51
MHParseText::PTBool
@ PTBool
Definition: ParseText.h:53
MHParseText::m_nType
ParseTextType m_nType
Definition: ParseText.h:54
MHParseText::Parse
MHParseNode * Parse() override
Definition: ParseText.cpp:1121
MHParseText::NextSym
void NextSym()
Definition: ParseText.cpp:385
MHParseText::m_nInt
int m_nInt
Definition: ParseText.h:58
MHParseText
Definition: ParseText.h:32