MythTV  master
ParseBinary.h
Go to the documentation of this file.
1 /* ParseBinary.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(PARSEBIN_H)
24 #define PARSEBIN_H
25 
26 class MHOctetString;
27 class MHGroup;
28 
29 #include "ParseNode.h"
30 
32 {
33  public:
34  explicit MHParseBinary(QByteArray &program)
35  : m_data(program) {}
36  ~MHParseBinary() override = default;
37 
38  // Parse the binary and return a pointer to the parse tree
39  MHParseNode *Parse() override // MHParseBase
40  { return DoParse(); }
41 
42  private:
44  unsigned char GetNextChar();
45  void ParseString(int endStr, MHOctetString &str);
46  int ParseInt(int endInt);
47 
48  private:
49  int m_p {0}; // Count of bytes read
50  QByteArray m_data;
51 };
52 
53 #endif
MHGroup
Definition: Groups.h:46
MHParseBinary::Parse
MHParseNode * Parse() override
Definition: ParseBinary.h:39
MHParseBinary::MHParseBinary
MHParseBinary(QByteArray &program)
Definition: ParseBinary.h:34
MHParseBinary::ParseInt
int ParseInt(int endInt)
Definition: ParseBinary.cpp:80
MHParseBinary::DoParse
MHParseNode * DoParse()
Definition: ParseBinary.cpp:111
MHOctetString
Definition: BaseClasses.h:107
ParseNode.h
MHParseBinary::m_p
int m_p
Definition: ParseBinary.h:49
MHParseBinary::GetNextChar
unsigned char GetNextChar()
Definition: ParseBinary.cpp:41
MHParseBase
Definition: ParseNode.h:31
MHParseBinary
Definition: ParseBinary.h:31
MHParseNode
Definition: ParseNode.h:38
MHParseBinary::ParseString
void ParseString(int endStr, MHOctetString &str)
Definition: ParseBinary.cpp:53
MHParseBinary::~MHParseBinary
~MHParseBinary() override=default
MHParseBinary::m_data
QByteArray m_data
Definition: ParseBinary.h:50