2016-12-23 06:34:24 +08:00
|
|
|
/* meparser.h
|
|
|
|
|
|
|
|
Copyright (c) 2016, 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,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MEPARSER_H
|
|
|
|
#define MEPARSER_H
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "basetypes.h"
|
|
|
|
#include "ustring.h"
|
|
|
|
#include "ubytearray.h"
|
|
|
|
#include "treemodel.h"
|
2019-08-20 02:36:02 +08:00
|
|
|
#include "ffsparser.h"
|
2022-08-29 14:23:38 +08:00
|
|
|
|
|
|
|
#include "digest/sha2.h"
|
2016-12-23 06:34:24 +08:00
|
|
|
|
2019-07-25 01:30:59 +08:00
|
|
|
#ifdef U_ENABLE_ME_PARSING_SUPPORT
|
2021-10-07 23:51:39 +08:00
|
|
|
class MeParser
|
2019-07-25 01:30:59 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Default constructor and destructor
|
2019-08-20 02:36:02 +08:00
|
|
|
MeParser(TreeModel* treeModel, FfsParser* parser) : model(treeModel), ffsParser(parser) {}
|
2019-07-25 01:30:59 +08:00
|
|
|
~MeParser() {}
|
|
|
|
|
2021-10-07 23:51:39 +08:00
|
|
|
// Returns messages
|
2019-07-25 01:30:59 +08:00
|
|
|
std::vector<std::pair<UString, UModelIndex> > getMessages() const { return messagesVector; }
|
|
|
|
// Clears messages
|
|
|
|
void clearMessages() { messagesVector.clear(); }
|
|
|
|
|
|
|
|
// ME parsing
|
|
|
|
USTATUS parseMeRegionBody(const UModelIndex & index);
|
|
|
|
private:
|
|
|
|
TreeModel *model;
|
2019-08-20 02:36:02 +08:00
|
|
|
FfsParser *ffsParser;
|
2019-07-25 01:30:59 +08:00
|
|
|
std::vector<std::pair<UString, UModelIndex> > messagesVector;
|
|
|
|
|
|
|
|
void msg(const UString message, const UModelIndex index = UModelIndex()) {
|
|
|
|
messagesVector.push_back(std::pair<UString, UModelIndex>(message, index));
|
|
|
|
}
|
|
|
|
|
|
|
|
USTATUS parseFptRegion(const UByteArray & region, const UModelIndex & parent, UModelIndex & index);
|
2019-08-20 02:36:02 +08:00
|
|
|
USTATUS parseIfwi16Region(const UByteArray & region, const UModelIndex & parent, UModelIndex & index);
|
|
|
|
USTATUS parseIfwi17Region(const UByteArray & region, const UModelIndex & parent, UModelIndex & index);
|
2019-07-25 01:30:59 +08:00
|
|
|
};
|
|
|
|
#else
|
2021-10-07 23:51:39 +08:00
|
|
|
class MeParser
|
2016-12-23 06:34:24 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Default constructor and destructor
|
2019-08-20 02:36:02 +08:00
|
|
|
MeParser(TreeModel* treeModel, FfsParser* parser) { U_UNUSED_PARAMETER(treeModel); U_UNUSED_PARAMETER(parser); }
|
2016-12-23 06:34:24 +08:00
|
|
|
~MeParser() {}
|
|
|
|
|
2021-10-07 23:51:39 +08:00
|
|
|
// Returns messages
|
2016-12-23 06:34:24 +08:00
|
|
|
std::vector<std::pair<UString, UModelIndex> > getMessages() const { return std::vector<std::pair<UString, UModelIndex> >(); }
|
|
|
|
// Clears messages
|
|
|
|
void clearMessages() {}
|
|
|
|
|
|
|
|
// ME parsing
|
|
|
|
USTATUS parseMeRegionBody(const UModelIndex & index) { U_UNUSED_PARAMETER(index); return U_SUCCESS; }
|
|
|
|
};
|
2019-07-25 01:30:59 +08:00
|
|
|
#endif // U_ENABLE_ME_PARSING_SUPPORT
|
2016-12-23 06:34:24 +08:00
|
|
|
#endif // MEPARSER_H
|