MythTV
master
mythtv
libs
libmythfreemheg
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
28
class
MHGroup
;
29
30
#include "
ParseNode.h
"
31
32
class
MHParseText
:
public
MHParseBase
33
{
34
public
:
35
explicit
MHParseText
(QByteArray &program)
36
:
m_data
(program)
37
{
38
m_string
.reserve(100);
39
}
40
~MHParseText
()
override
=
default
;
41
42
// Parse the text and return a pointer to the parse tree
43
MHParseNode
*
Parse
()
override
;
// MHParseBase
44
45
private
:
46
void
GetNextChar
();
47
void
NextSym
();
48
MHParseNode
*
DoParse
();
49
void
Error
(
const
char
*str)
const
;
50
51
int
m_lineCount
{1};
52
53
enum
ParseTextType
: std::uint8_t
54
{
PTTag
,
PTInt
,
PTString
,
PTEnum
,
PTStartSection
,
55
PTEndSection
,
PTStartSeq
,
PTEndSeq
,
PTNull
,
56
PTEOF
,
PTBool
};
57
ParseTextType
m_nType
{
PTNull
};
58
59
char
m_ch
{0};
60
int
m_nTag
{0};
61
int
m_nInt
{0};
62
bool
m_fBool
{
false
};
63
std::vector<uint8_t>
m_string
;
// can contain NUL characters
64
65
unsigned
int
m_p
{0};
// Count of bytes read
66
QByteArray
m_data
;
67
};
68
69
#endif
ParseNode.h
MHGroup
Definition:
Groups.h:47
MHParseBase
Definition:
ParseNode.h:31
MHParseNode
Definition:
ParseNode.h:39
MHParseText
Definition:
ParseText.h:33
MHParseText::m_nType
ParseTextType m_nType
Definition:
ParseText.h:57
MHParseText::m_lineCount
int m_lineCount
Definition:
ParseText.h:51
MHParseText::m_string
std::vector< uint8_t > m_string
Definition:
ParseText.h:63
MHParseText::Parse
MHParseNode * Parse() override
Definition:
ParseText.cpp:1075
MHParseText::~MHParseText
~MHParseText() override=default
MHParseText::ParseTextType
ParseTextType
Definition:
ParseText.h:54
MHParseText::PTString
@ PTString
Definition:
ParseText.h:54
MHParseText::PTInt
@ PTInt
Definition:
ParseText.h:54
MHParseText::PTStartSeq
@ PTStartSeq
Definition:
ParseText.h:55
MHParseText::PTStartSection
@ PTStartSection
Definition:
ParseText.h:54
MHParseText::PTEOF
@ PTEOF
Definition:
ParseText.h:56
MHParseText::PTEndSection
@ PTEndSection
Definition:
ParseText.h:55
MHParseText::PTEndSeq
@ PTEndSeq
Definition:
ParseText.h:55
MHParseText::PTNull
@ PTNull
Definition:
ParseText.h:55
MHParseText::PTBool
@ PTBool
Definition:
ParseText.h:56
MHParseText::PTTag
@ PTTag
Definition:
ParseText.h:54
MHParseText::PTEnum
@ PTEnum
Definition:
ParseText.h:54
MHParseText::m_p
unsigned int m_p
Definition:
ParseText.h:65
MHParseText::MHParseText
MHParseText(QByteArray &program)
Definition:
ParseText.h:35
MHParseText::m_nInt
int m_nInt
Definition:
ParseText.h:61
MHParseText::NextSym
void NextSym()
Definition:
ParseText.cpp:374
MHParseText::m_data
QByteArray m_data
Definition:
ParseText.h:66
MHParseText::m_fBool
bool m_fBool
Definition:
ParseText.h:62
MHParseText::m_ch
char m_ch
Definition:
ParseText.h:59
MHParseText::DoParse
MHParseNode * DoParse()
Definition:
ParseText.cpp:806
MHParseText::GetNextChar
void GetNextChar()
Definition:
ParseText.cpp:43
MHParseText::m_nTag
int m_nTag
Definition:
ParseText.h:60
MHParseText::Error
void Error(const char *str) const
Definition:
ParseText.cpp:368
Generated on Sat May 9 2026 03:16:11 for MythTV by
1.9.4