2015-07-07 21:57:41 +08:00
|
|
|
/* fitparser.h
|
|
|
|
|
|
|
|
Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
|
|
|
|
This program and the accompanying materials
|
|
|
|
are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
which accompanies this distribution. The full text of the license may be found at
|
|
|
|
http://opensource.org/licenses/bsd-license.php
|
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __FITPARSER_H__
|
|
|
|
#define __FITPARSER_H__
|
|
|
|
|
2016-03-01 15:20:44 +08:00
|
|
|
#include <vector>
|
|
|
|
|
2015-07-07 21:57:41 +08:00
|
|
|
#include <QObject>
|
|
|
|
#include <QModelIndex>
|
|
|
|
#include <QByteArray>
|
|
|
|
|
|
|
|
#include "treemodel.h"
|
|
|
|
#include "utility.h"
|
|
|
|
#include "parsingdata.h"
|
|
|
|
#include "fit.h"
|
2016-03-01 15:20:44 +08:00
|
|
|
#include "types.h"
|
|
|
|
#include "treemodel.h"
|
2015-07-07 21:57:41 +08:00
|
|
|
|
|
|
|
class TreeModel;
|
|
|
|
|
2016-03-01 15:20:44 +08:00
|
|
|
class FitParser
|
2015-07-07 21:57:41 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Default constructor and destructor
|
2016-03-01 15:20:44 +08:00
|
|
|
FitParser(TreeModel* treeModel);
|
2015-07-07 21:57:41 +08:00
|
|
|
~FitParser();
|
|
|
|
|
2015-09-13 22:36:43 +08:00
|
|
|
// Returns messages
|
2016-03-01 15:20:44 +08:00
|
|
|
std::vector<std::pair<QString, QModelIndex> > getMessages() const;
|
2015-09-13 22:36:43 +08:00
|
|
|
// Clears messages
|
|
|
|
void clearMessages();
|
|
|
|
|
2015-07-07 21:57:41 +08:00
|
|
|
STATUS parse(const QModelIndex & index, const QModelIndex & lastVtf);
|
2016-03-01 15:20:44 +08:00
|
|
|
std::vector<std::vector<QString> > getFitTable() const { return fitTable; }
|
2015-07-07 21:57:41 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
TreeModel *model;
|
2016-03-01 15:20:44 +08:00
|
|
|
std::vector<std::pair<QString, QModelIndex> > messagesVector;
|
2015-07-07 21:57:41 +08:00
|
|
|
QModelIndex lastVtf;
|
2016-03-01 15:20:44 +08:00
|
|
|
std::vector<std::vector<QString> > fitTable;
|
2015-07-07 21:57:41 +08:00
|
|
|
|
|
|
|
STATUS findFitRecursive(const QModelIndex & index, QModelIndex & found, UINT32 & fitOffset);
|
2015-07-09 05:05:48 +08:00
|
|
|
QString fitEntryTypeToQString(UINT8 type);
|
2015-09-13 22:36:43 +08:00
|
|
|
|
|
|
|
// Message helper
|
|
|
|
void msg(const QString & message, const QModelIndex &index = QModelIndex());
|
2015-07-07 21:57:41 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|