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.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2016-04-09 18:47:19 +08:00
|
|
|
#ifndef FFSBUILDER_H
|
|
|
|
#define FFSBUILDER_H
|
2015-04-02 16:04:37 +08:00
|
|
|
|
2016-03-01 15:20:44 +08:00
|
|
|
#include <vector>
|
|
|
|
|
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
|
|
|
|
2016-03-01 15:20:44 +08:00
|
|
|
class FfsBuilder
|
2015-05-15 01:15:19 +08:00
|
|
|
{
|
|
|
|
public:
|
2016-03-01 15:20:44 +08:00
|
|
|
explicit FfsBuilder(const TreeModel * treeModel);
|
2015-05-15 01:15:19 +08:00
|
|
|
~FfsBuilder();
|
|
|
|
|
2016-03-01 15:20:44 +08:00
|
|
|
std::vector<std::pair<QString, QModelIndex> > getMessages() const;
|
2015-05-15 01:15:19 +08:00
|
|
|
void clearMessages();
|
|
|
|
|
|
|
|
STATUS build(const QModelIndex & root, QByteArray & image);
|
|
|
|
|
|
|
|
private:
|
|
|
|
const TreeModel* model;
|
2016-03-01 15:20:44 +08:00
|
|
|
std::vector<std::pair<QString, QModelIndex> > messagesVector;
|
2015-05-15 01:15:19 +08:00
|
|
|
void msg(const QString & message, const QModelIndex &index = QModelIndex());
|
|
|
|
|
|
|
|
STATUS buildCapsule(const QModelIndex & index, QByteArray & capsule);
|
2015-06-20 02:26:45 +08:00
|
|
|
STATUS buildIntelImage(const QModelIndex & index, QByteArray & intelImage);
|
|
|
|
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
|
|
|
};
|
|
|
|
|
2016-04-09 18:47:19 +08:00
|
|
|
#endif // FFSBUILDER_H
|