2015-04-02 16:04:37 +08:00
|
|
|
/* ffsdumper.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,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2016-04-09 18:47:19 +08:00
|
|
|
#ifndef FFSDUMPER_H
|
|
|
|
#define FFSDUMPER_H
|
2015-04-02 16:04:37 +08:00
|
|
|
|
2016-07-09 17:18:11 +08:00
|
|
|
#include <QObject>
|
2016-06-26 11:54:21 +08:00
|
|
|
#include <QDir>
|
2016-07-09 17:18:11 +08:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <QString>
|
|
|
|
#include <QModelIndex>
|
|
|
|
|
2015-04-04 21:22:52 +08:00
|
|
|
#include "../common/basetypes.h"
|
|
|
|
#include "../common/treemodel.h"
|
2015-05-17 17:45:32 +08:00
|
|
|
#include "../common/ffs.h"
|
2015-04-02 16:04:37 +08:00
|
|
|
|
2016-03-01 16:12:37 +08:00
|
|
|
class FfsDumper
|
2015-04-02 16:04:37 +08:00
|
|
|
{
|
|
|
|
public:
|
2018-06-03 02:59:57 +08:00
|
|
|
enum DumpMode {
|
|
|
|
DUMP_CURRENT,
|
|
|
|
DUMP_ALL,
|
|
|
|
DUMP_BODY,
|
|
|
|
DUMP_HEADER,
|
|
|
|
DUMP_INFO
|
|
|
|
};
|
|
|
|
|
|
|
|
static const UINT8 IgnoreSectionType = 0xFF;
|
|
|
|
|
2018-06-12 22:14:32 +08:00
|
|
|
explicit FfsDumper(TreeModel * treeModel) : model(treeModel), dumped(false), counter(0) {}
|
2016-07-09 17:18:11 +08:00
|
|
|
~FfsDumper() {};
|
2015-05-17 17:45:32 +08:00
|
|
|
|
2018-06-03 02:59:57 +08:00
|
|
|
USTATUS dump(const QModelIndex & root, const QString & path, const DumpMode dumpMode = DUMP_CURRENT, const UINT8 sectionType = IgnoreSectionType, const QString & guid = QString());
|
2015-05-17 17:45:32 +08:00
|
|
|
|
2015-04-02 16:04:37 +08:00
|
|
|
private:
|
2018-06-03 02:59:57 +08:00
|
|
|
USTATUS recursiveDump(const QModelIndex & root, const QString & path, const DumpMode dumpMode, const UINT8 sectionType, const QString & guid);
|
2015-04-02 16:04:37 +08:00
|
|
|
TreeModel* model;
|
|
|
|
bool dumped;
|
2018-06-12 22:14:32 +08:00
|
|
|
int counter;
|
2015-04-02 16:04:37 +08:00
|
|
|
};
|
2016-04-09 18:47:19 +08:00
|
|
|
#endif // FFSDUMPER_H
|