00001 /*************************************************************************** 00002 File : FitModelHandler.h 00003 Project : QtiPlot 00004 -------------------------------------------------------------------- 00005 Copyright : (C) 2007 by Ion Vasilief 00006 Email (use @ for *) : ion_vasilief*yahoo.fr 00007 Description : An XML handler for the Fit class 00008 00009 ***************************************************************************/ 00010 00011 /*************************************************************************** 00012 * * 00013 * This program is free software; you can redistribute it and/or modify * 00014 * it under the terms of the GNU General Public License as published by * 00015 * the Free Software Foundation; either version 2 of the License, or * 00016 * (at your option) any later version. * 00017 * * 00018 * This program is distributed in the hope that it will be useful, * 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00021 * GNU General Public License for more details. * 00022 * * 00023 * You should have received a copy of the GNU General Public License * 00024 * along with this program; if not, write to the Free Software * 00025 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 00026 * Boston, MA 02110-1301 USA * 00027 * * 00028 ***************************************************************************/ 00029 #ifndef FITMODELHANDLER_H 00030 #define FITMODELHANDLER_H 00031 00032 #include <QXmlDefaultHandler> 00033 #include <QVarLengthArray> 00034 00035 class Fit; 00036 00037 class FitModelHandler : public QXmlDefaultHandler 00038 { 00039 public: 00040 FitModelHandler(Fit *fit); 00041 00042 bool startElement(const QString &namespaceURI, const QString &localName, 00043 const QString &qName, const QXmlAttributes &attributes); 00044 bool endElement(const QString &namespaceURI, const QString &localName, 00045 const QString &qName); 00046 bool characters(const QString &str); 00047 bool fatalError(const QXmlParseException &){return false;}; 00048 QString errorString() const; 00049 00050 private: 00051 Fit* d_fit; 00052 bool metFitTag; 00053 QString currentText; 00054 QString errorStr; 00055 QString d_formula; 00056 QStringList d_parameters; 00057 QStringList d_explanations; 00058 QVarLengthArray<double> d_values; 00059 }; 00060 00061 #endif