2015-04-02 16:04:37 +08:00
|
|
|
/* fssbuilder.h
|
|
|
|
|
2016-02-02 09:08:08 +08:00
|
|
|
Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
|
2015-04-02 16:04:37 +08:00
|
|
|
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 __FFSBUILDER_H__
|
|
|
|
#define __FFSBUILDER_H__
|
|
|
|
|
2015-05-15 01:15:19 +08:00
|
|
|
#include <QObject>
|
|
|
|
#include <QByteArray>
|
|
|
|
#include <QString>
|
|
|
|
#include <QModelIndex>
|
|
|
|
|
2016-02-02 09:08:08 +08:00
|
|
|
#include "basetypes.h"
|
|
|
|
#include "treemodel.h"
|
|
|
|
#include "descriptor.h"
|
|
|
|
#include "ffs.h"
|
|
|
|
#include "utility.h"
|
2015-05-15 01:15:19 +08:00
|
|
|
|
|
|
|
class FfsBuilder : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit FfsBuilder(const TreeModel * treeModel, QObject *parent = 0);
|
|
|
|
~FfsBuilder();
|
|
|
|
|
|
|
|
QVector<QPair<QString, QModelIndex> > getMessages() const;
|
|
|
|
void clearMessages();
|
|
|
|
|
|
|
|
STATUS build(const QModelIndex & root, QByteArray & image);
|
|
|
|
|
|
|
|
private:
|
|
|
|
const TreeModel* model;
|
|
|
|
QVector<QPair<QString, QModelIndex> > messagesVector;
|
|
|
|
void msg(const QString & message, const QModelIndex &index = QModelIndex());
|
|
|
|
|
|
|
|
// UEFI standard structures
|
|
|
|
STATUS buildCapsule(const QModelIndex & index, QByteArray & capsule);
|
2015-06-20 02:26:45 +08:00
|
|
|
STATUS buildIntelImage(const QModelIndex & index, QByteArray & intelImage);
|
2015-12-30 06:39:43 +08:00
|
|
|
STATUS buildGbeRegion(const QModelIndex & index, QByteArray & region);
|
|
|
|
STATUS buildMeRegion(const QModelIndex & index, QByteArray & region);
|
|
|
|
STATUS buildPdrRegion(const QModelIndex & index, QByteArray & region);
|
|
|
|
STATUS buildEcRegion(const QModelIndex & index, QByteArray & region);
|
2015-06-20 02:26:45 +08:00
|
|
|
STATUS buildRawArea(const QModelIndex & index, QByteArray & rawArea, bool addHeader = true);
|
2015-05-15 01:15:19 +08:00
|
|
|
STATUS buildPadding(const QModelIndex & index, QByteArray & padding);
|
2015-06-20 02:26:45 +08:00
|
|
|
STATUS buildVolume(const QModelIndex & index, QByteArray & volume);
|
2015-05-15 01:15:19 +08:00
|
|
|
STATUS buildNonUefiData(const QModelIndex & index, QByteArray & data);
|
|
|
|
STATUS buildFreeSpace(const QModelIndex & index, QByteArray & freeSpace);
|
|
|
|
STATUS buildPadFile(const QModelIndex & index, QByteArray & padFile);
|
|
|
|
STATUS buildFile(const QModelIndex & index, QByteArray & file);
|
|
|
|
STATUS buildSection(const QModelIndex & index, QByteArray & section);
|
|
|
|
|
2015-06-20 02:26:45 +08:00
|
|
|
// Utility functions
|
|
|
|
STATUS erase(const QModelIndex & index, QByteArray & erased);
|
2015-05-15 01:15:19 +08:00
|
|
|
};
|
|
|
|
|
2015-04-02 16:04:37 +08:00
|
|
|
#endif
|