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.
|
|
|
|
*/
|
|
|
|
|
2016-04-09 18:47:19 +08:00
|
|
|
#ifndef FITPARSER_H
|
|
|
|
#define FITPARSER_H
|
2015-07-07 21:57:41 +08:00
|
|
|
|
2016-03-01 15:20:44 +08:00
|
|
|
#include <vector>
|
|
|
|
|
2016-06-26 11:54:21 +08:00
|
|
|
#include "ustring.h"
|
|
|
|
#include "ubytearray.h"
|
|
|
|
#include "umodelindex.h"
|
2015-07-07 21:57:41 +08:00
|
|
|
#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-04-15 02:36:59 +08:00
|
|
|
FitParser(TreeModel* treeModel) : model(treeModel) {}
|
|
|
|
~FitParser() {}
|
2015-07-07 21:57:41 +08:00
|
|
|
|
2015-09-13 22:36:43 +08:00
|
|
|
// Returns messages
|
2016-06-26 11:54:21 +08:00
|
|
|
std::vector<std::pair<UString, UModelIndex> > getMessages() const { return messagesVector; };
|
2015-09-13 22:36:43 +08:00
|
|
|
// Clears messages
|
2016-04-15 02:36:59 +08:00
|
|
|
void clearMessages() { messagesVector.clear(); }
|
2015-09-13 22:36:43 +08:00
|
|
|
|
2016-06-26 11:54:21 +08:00
|
|
|
USTATUS parse(const UModelIndex & index, const UModelIndex & lastVtf);
|
|
|
|
std::vector<std::vector<UString> > getFitTable() const { return fitTable; }
|
2015-07-07 21:57:41 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
TreeModel *model;
|
2016-06-26 11:54:21 +08:00
|
|
|
std::vector<std::pair<UString, UModelIndex> > messagesVector;
|
|
|
|
UModelIndex lastVtf;
|
|
|
|
std::vector<std::vector<UString> > fitTable;
|
2015-07-07 21:57:41 +08:00
|
|
|
|
2016-06-26 11:54:21 +08:00
|
|
|
USTATUS findFitRecursive(const UModelIndex & index, UModelIndex & found, UINT32 & fitOffset);
|
|
|
|
UString fitEntryTypeToUString(UINT8 type);
|
2015-09-13 22:36:43 +08:00
|
|
|
|
|
|
|
// Message helper
|
2016-06-26 11:54:21 +08:00
|
|
|
void msg(const UString & message, const UModelIndex &index = UModelIndex()) {
|
|
|
|
messagesVector.push_back(std::pair<UString, UModelIndex>(message, index));
|
2016-04-15 02:36:59 +08:00
|
|
|
}
|
2015-07-07 21:57:41 +08:00
|
|
|
};
|
|
|
|
|
2016-04-09 18:47:19 +08:00
|
|
|
#endif // FITPARSER_H
|