DeltaQt  Version 0.2.0 End user documentation
A C++/Qt library for parsing DELTA (DEscription Language for TAxonomy) files
F:/Code/DeltaQt/DeltaQt/deltaparser.h
Go to the documentation of this file.
00001 /*  Copyright 2012 Craig Robbins
00002 
00003     This file is part of DeltaQt
00004 
00005     DeltaQt is free software: you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation, either version 3 of the License, or
00008     (at your option) any later version.
00009 
00010     DeltaQt is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with DeltaQt.  If not, see <http://www.gnu.org/licenses/>.
00017 */
00018 
00019 #ifndef DELTAPARSER_H
00020 #define DELTAPARSER_H
00021 
00022 #include <QString>
00023 #include <QStringList>
00024 #include <QFile>
00025 #include <QList>
00026 #include <QObject>
00027 #include "deltaparselog.h"
00028 #include "deltaparserprivate.h"
00029 #include "deltadirectives.h"
00030 #include "delimitedbuffer.h"
00031 
00032 
00033 #include "deltadataset.h"
00034 
00035 
00036 class DeltaParser
00037 {
00038     friend class DeltaParserPhase2;
00039 
00040 public:
00041 
00042     DeltaParser();
00043 
00044     bool parse(DeltaDataset* dataset,
00045                const QStringList& filenames,
00046                bool abortOnAnyReadError = false);
00047 
00048     bool parse(DeltaDataset* dataset, const QString& fname);
00049 
00050     // Misc
00051     const DeltaParseLog& parseLog(void) const;
00052 
00053 protected:
00054     const QString& currFilename(void) const;
00055 
00056     bool parseFile(void);
00057     bool parse(DelimitedBuffer& dbuff);
00058     bool parseNewDirective(const QString& str, QString* data);
00059     bool parseData(const QString& str);
00060 
00061     // Characters
00062     bool parseDataCharList(const QString& str);
00063     bool parseCharDesc(DelimitedBuffer& dbuff, DeltaCharacter& dchar);
00064     DeltaCharacterType::TypeId parseCharacter_inferType(
00065             const QList<QString>& partList);
00066     bool parseCharFeatureDesc(const QString& str, DeltaCharacter& dchar);
00067     bool parseCharStateDescs(const QString& str, DeltaCharacter& dchar);
00068     bool parseDataCharTypes(const QString& str);
00069 
00070     // Items
00071     bool parseDataItemList(const QString& str);
00072     bool preParseItemAttrList(const QString& str, DeltaItem& dItem);
00073     bool preParseItemAttr(const QString& str, DeltaAttribute& dAttr);
00074 
00075     // Character notes
00076     bool parseCharNote(const QString& str);
00077 
00078 private:
00079 
00080     DeltaParseLog m_parseLog;
00081     DeltaParseLog* m_parseLogPointer;
00082     DeltaDataset* m_dataset;
00083     DeltaParseContext m_context;
00084     DpReadBuffer m_readBuffer;
00085 };
00086 
00087 
00088 #endif // DELTAPARSER_H
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines