PageRenderTime 14ms CodeModel.GetById 9ms app.highlight 4ms RepoModel.GetById 0ms app.codeStats 0ms

/guitone-1.0rc5/src/util/AbstractParser.h

#
C Header | 49 lines | 25 code | 7 blank | 17 comment | 0 complexity | 82fe609999c8a8a797c8ba9dae4a592d MD5 | raw file
Possible License(s): GPL-3.0
 1/***************************************************************************
 2 *   Copyright (C) 2007 by Thomas Keller                                   *
 3 *   me@thomaskeller.biz                                                   *
 4 *                                                                         *
 5 *   This program is free software; you can redistribute it and/or modify  *
 6 *   it under the terms of the GNU General Public License as published by  *
 7 *   the Free Software Foundation, either version 3 of the License, or     *
 8 *   (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, see <http://www.gnu.org/licenses/>. *
17 ***************************************************************************/
18
19#ifndef ABSTRACT_PARSER_H
20#define ABSTRACT_PARSER_H
21
22#include <QByteArray>
23#include <QString>
24
25class AbstractParser
26{
27public:
28        AbstractParser(const QByteArray &);
29        AbstractParser(const QString &);
30        virtual ~AbstractParser();
31        virtual bool parse() = 0;
32        QByteArray getLeftBytes() const;
33        int getLeftBytesCount() const;
34
35protected:
36        char whatsNext(int count = 0) const;
37        char getNext();
38        QByteArray getNext(int);
39        void eatSpaces();
40        void advance(int count = 1);
41
42private:
43        void init(const QByteArray &);
44        QByteArray input;
45        int charPos;
46};
47
48#endif
49