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>
|
|
|
|
|
2016-10-10 14:05:04 +08:00
|
|
|
#include "basetypes.h"
|
2016-07-07 13:57:45 +08:00
|
|
|
#include "ubytearray.h"
|
|
|
|
#include "ustring.h"
|
2016-02-02 09:08:08 +08:00
|
|
|
#include "treemodel.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-04-15 02:36:59 +08:00
|
|
|
FfsBuilder(const TreeModel * treeModel) : model(treeModel) {}
|
|
|
|
~FfsBuilder() {}
|
2015-05-15 01:15:19 +08:00
|
|
|
|
2016-07-07 13:57:45 +08:00
|
|
|
std::vector<std::pair<UString, UModelIndex> > getMessages() const { return messagesVector; }
|
2016-04-15 02:36:59 +08:00
|
|
|
void clearMessages() { messagesVector.clear(); }
|
2015-05-15 01:15:19 +08:00
|
|
|
|
2016-07-07 13:57:45 +08:00
|
|
|
USTATUS build(const UModelIndex & root, UByteArray & image);
|
2015-05-15 01:15:19 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
const TreeModel* model;
|
2016-07-07 13:57:45 +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));
|
2016-04-15 02:36:59 +08:00
|
|
|
}
|
2015-05-15 01:15:19 +08:00
|
|
|
|
2016-07-07 13:57:45 +08:00
|
|
|
USTATUS buildCapsule(const UModelIndex & index, UByteArray & capsule);
|
|
|
|
USTATUS buildIntelImage(const UModelIndex & index, UByteArray & intelImage);
|
|
|
|
USTATUS buildRawArea(const UModelIndex & index, UByteArray & rawArea, bool addHeader = true);
|
|
|
|
USTATUS buildPadding(const UModelIndex & index, UByteArray & padding);
|
|
|
|
USTATUS buildVolume(const UModelIndex & index, UByteArray & volume);
|
|
|
|
USTATUS buildNonUefiData(const UModelIndex & index, UByteArray & data);
|
|
|
|
USTATUS buildFreeSpace(const UModelIndex & index, UByteArray & freeSpace);
|
|
|
|
USTATUS buildPadFile(const UModelIndex & index, UByteArray & padFile);
|
|
|
|
USTATUS buildFile(const UModelIndex & index, UByteArray & file);
|
|
|
|
USTATUS buildSection(const UModelIndex & index, UByteArray & section);
|
2015-05-15 01:15:19 +08:00
|
|
|
|
2015-06-20 02:26:45 +08:00
|
|
|
// Utility functions
|
2016-07-07 13:57:45 +08:00
|
|
|
USTATUS erase(const UModelIndex & index, UByteArray & erased);
|
2015-05-15 01:15:19 +08:00
|
|
|
};
|
|
|
|
|
2016-04-09 18:47:19 +08:00
|
|
|
#endif // FFSBUILDER_H
|