return value;
}
+struct Progress {
+ virtual void operator()(const std::string &value) const = 0;
+ virtual void operator()(double value) const = 0;
+};
+
class Folder {
public:
virtual void Save(const std::string &path, bool edit, const void *flag, const Functor<void (std::streambuf &)> &code) = 0;
public Folder
{
private:
- class StringBuffer :
- public std::stringbuf
- {
- public:
- StringBuffer() {
- }
-
- StringBuffer(const StringBuffer &rhs) :
- std::stringbuf(rhs.str())
- {
- }
+ struct Reset {
+ const void *flag_;
+ std::streambuf *data_;
};
Folder &parent_;
std::set<std::string> deletes_;
std::map<std::string, std::string> remaps_;
- mutable std::map<std::string, std::pair<StringBuffer, const void *>> resets_;
+ mutable std::map<std::string, Reset> resets_;
std::string Map(const std::string &path) const;
void Map(const std::string &path, const Functor<void (const std::string &)> &code, const std::string &file, const Functor<void (const Functor<void (std::streambuf &, size_t, const void *)> &)> &save) const;
remaps_[to] = from;
}
- std::stringbuf &operator ()(const std::string &from, const void *flag) {
+ void operator ()(const std::string &from, const void *flag, std::streambuf &data) {
operator ()(from);
auto &reset(resets_[from]);
- reset.second = flag;
- return reset.first;
+ reset.flag_ = flag;
+ reset.data_ = &data;
}
};
+struct Hash {
+ uint8_t sha1_[0x14];
+ uint8_t sha256_[0x20];
+};
+
struct Bundle {
std::string path;
- std::vector<char> hash;
+ Hash hash;
};
-Bundle Sign(const std::string &root, Folder &folder, const std::string &key, const std::string &requirement, const Functor<std::string (const std::string &, const std::string &)> &alter, const Functor<void (const std::string &)> &progress, const Functor<void (double)> &percent);
+Bundle Sign(const std::string &root, Folder &folder, const std::string &key, const std::string &requirements, const Functor<std::string (const std::string &, const std::string &)> &alter, const Progress &progress);
-typedef std::map<uint32_t, std::vector<char>> Slots;
+typedef std::map<uint32_t, Hash> Slots;
-std::vector<char> Sign(const void *idata, size_t isize, std::streambuf &output, const std::string &identifier, const std::string &entitlements, const std::string &requirement, const std::string &key, const Slots &slots, const Functor<void (double)> &percent);
+Hash Sign(const void *idata, size_t isize, std::streambuf &output, const std::string &identifier, const std::string &entitlements, const std::string &requirements, const std::string &key, const Slots &slots, uint32_t flags, bool platform, const Progress &progress);
}