X-Git-Url: https://git.saurik.com/ldid.git/blobdiff_plain/23c11ee8bcbc98bcaa3bc3682ab123f8a44d0b01..35229d065ce164cc3d8a3b37446f27c9d85deddc:/ldid.hpp diff --git a/ldid.hpp b/ldid.hpp index 4ae4950..40b1c8b 100644 --- a/ldid.hpp +++ b/ldid.hpp @@ -3,8 +3,10 @@ #include #include +#include #include #include +#include namespace ldid { @@ -61,6 +63,8 @@ class DiskFolder : std::string Path(const std::string &path); + void Find(const std::string &root, const std::string &base, const Functor &)> &)>&code); + public: DiskFolder(const std::string &path); ~DiskFolder(); @@ -74,17 +78,51 @@ class SubFolder : public Folder { private: - Folder *parent_; + Folder &parent_; std::string path_; public: - SubFolder(Folder *parent, const std::string &path); + SubFolder(Folder &parent, const std::string &path); + + virtual void Save(const std::string &path, const Functor &code); + virtual bool Open(const std::string &path, const Functor &code); + virtual void Find(const std::string &path, const Functor &)> &)> &code); +}; + +class UnionFolder : + public Folder +{ + private: + class StringBuffer : + public std::stringbuf + { + public: + StringBuffer() { + } + + StringBuffer(const StringBuffer &rhs) : + std::stringbuf(rhs.str()) + { + } + }; + + Folder &parent_; + std::map files_; + + public: + UnionFolder(Folder &parent); virtual void Save(const std::string &path, const Functor &code); virtual bool Open(const std::string &path, const Functor &code); virtual void Find(const std::string &path, const Functor &)> &)> &code); + + std::stringbuf &operator [](const std::string &path) { + return files_[path]; + } }; +std::string Bundle(const std::string &root, Folder &folder, const std::string &key, std::map> &remote, const std::string &entitlements); + typedef std::map> Slots; void Sign(const void *idata, size_t isize, std::streambuf &output, const std::string &identifier, const std::string &entitlements, const std::string &key, const Slots &slots);