X-Git-Url: https://git.saurik.com/ldid.git/blobdiff_plain/f74652ab3bfc5026ef954a35aeb137a18f55bf67..043e30006254b050f5a5628bfaa84a0abf888e7a:/ldid.hpp?ds=sidebyside diff --git a/ldid.hpp b/ldid.hpp index f2e465f..503ebc5 100644 --- a/ldid.hpp +++ b/ldid.hpp @@ -48,6 +48,11 @@ FunctorImpl fun(const Function_ &value) { 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 &code) = 0; @@ -99,24 +104,16 @@ class UnionFolder : 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 deletes_; std::map remaps_; - mutable std::map> resets_; + mutable std::map resets_; std::string Map(const std::string &path) const; void Map(const std::string &path, const Functor &code, const std::string &file, const Functor &)> &save) const; @@ -138,11 +135,11 @@ class UnionFolder : 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; } }; @@ -156,11 +153,11 @@ struct Bundle { Hash hash; }; -Bundle Sign(const std::string &root, Folder &folder, const std::string &key, const std::string &requirement, const Functor &alter, const Functor &progress, const Functor &percent); +Bundle Sign(const std::string &root, Folder &folder, const std::string &key, const std::string &requirements, const Functor &alter, const Progress &progress); typedef std::map Slots; -Hash 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 &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); }