1 //
2 // This file is part of the aMule Project.
3 //
4 // Copyright (c) 2010-2011 Werner Mahr (Vollstrecker) <amule@vollstreckernet.de>
5 //
6 // Any parts of this program contributed by third-party developers are copyrighted
7 // by their respective authors.
8 //
9 // This program is free software; you can redistribute it and/or modify
10 // it under the terms of the GNU General Public License as published by
11 // the Free Software Foundation; either version 3 of the License, or
12 // (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 // GNU General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
22 //
23 
24 #ifndef QTEMC_H
25 #define QTEMC_H
26 
27 #include <QFile>
28 #include <QStringList>
29 
30 class qtEmc
31 {
32 	public:
33 		enum emcError
34 		{
35 			BadFileFormat,
36 			BadTagFormat,
37 			UnknownTag,
38 			UnknownTagType,
39 			WrongTagCount,
40 			CorruptFile
41 		};
42 
43 	private:
44 		bool valid;
45 		int errorCode;
46 		QString author, authorKey, name;
47 		QStringList list;
48 		quint8 lastTag, lastTagType;
49 		quint16 tagFormat;
50 		quint32 emcVersion, fileCount, headerTagCount;
51 
52 	public:
53 		qtEmc(const QString &filename);
54 		const int getError();
55 		const QString getErrorMessage();
56 		const QStringList getLinks();
57 		const bool isValid();
58 
59 	private:
60 		bool readBinary(QFile &collection);
61 		bool readText(QFile &collection);
62 };
63 
64 #endif // QT_EMC_H
65