class Folder {
public:
- virtual void Save(const std::string &path, const Functor<void (std::streambuf &)> &code) = 0;
- virtual bool Open(const std::string &path, const Functor<void (std::streambuf &)> &code) = 0;
- virtual void Find(const std::string &path, const Functor<void (const std::string &, const Functor<void (const Functor<void (std::streambuf &, std::streambuf &)> &)> &)> &code) = 0;
+ virtual void Save(const std::string &path, const void *flag, const Functor<void (std::streambuf &)> &code) = 0;
+ virtual bool Open(const std::string &path, const Functor<void (std::streambuf &, const void *)> &code) = 0;
+ virtual void Find(const std::string &path, const Functor<void (const std::string &, const Functor<void (const Functor<void (std::streambuf &, std::streambuf &)> &)> &)> &code, const Functor<void (const std::string &, const Functor<std::string ()> &)> &link) = 0;
};
class DiskFolder :
std::string Path(const std::string &path);
- void Find(const std::string &root, const std::string &base, const Functor<void (const std::string &, const Functor<void (const Functor<void (std::streambuf &, std::streambuf &)> &)> &)>&code);
+ void Find(const std::string &root, const std::string &base, const Functor<void (const std::string &, const Functor<void (const Functor<void (std::streambuf &, std::streambuf &)> &)> &)> &code, const Functor<void (const std::string &, const Functor<std::string ()> &)> &link);
public:
DiskFolder(const std::string &path);
~DiskFolder();
- virtual void Save(const std::string &path, const Functor<void (std::streambuf &)> &code);
- virtual bool Open(const std::string &path, const Functor<void (std::streambuf &)> &code);
- virtual void Find(const std::string &path, const Functor<void (const std::string &, const Functor<void (const Functor<void (std::streambuf &, std::streambuf &)> &)> &)> &code);
+ virtual void Save(const std::string &path, const void *flag, const Functor<void (std::streambuf &)> &code);
+ virtual bool Open(const std::string &path, const Functor<void (std::streambuf &, const void *)> &code);
+ virtual void Find(const std::string &path, const Functor<void (const std::string &, const Functor<void (const Functor<void (std::streambuf &, std::streambuf &)> &)> &)> &code, const Functor<void (const std::string &, const Functor<std::string ()> &)> &link);
};
class SubFolder :
public:
SubFolder(Folder &parent, const std::string &path);
- virtual void Save(const std::string &path, const Functor<void (std::streambuf &)> &code);
- virtual bool Open(const std::string &path, const Functor<void (std::streambuf &)> &code);
- virtual void Find(const std::string &path, const Functor<void (const std::string &, const Functor<void (const Functor<void (std::streambuf &, std::streambuf &)> &)> &)> &code);
+ virtual void Save(const std::string &path, const void *flag, const Functor<void (std::streambuf &)> &code);
+ virtual bool Open(const std::string &path, const Functor<void (std::streambuf &, const void *)> &code);
+ virtual void Find(const std::string &path, const Functor<void (const std::string &, const Functor<void (const Functor<void (std::streambuf &, std::streambuf &)> &)> &)> &code, const Functor<void (const std::string &, const Functor<std::string ()> &)> &link);
};
class UnionFolder :
std::set<std::string> deletes_;
std::map<std::string, std::string> remaps_;
- std::map<std::string, StringBuffer> resets_;
+ std::map<std::string, std::pair<StringBuffer, const void *>> resets_;
std::string Map(const std::string &path);
- void Map(const std::string &path, const Functor<void (const std::string &, const Functor<void (const Functor<void (std::streambuf &, std::streambuf &)> &)> &)> &code, const std::string &file, const Functor<void (std::streambuf &, const Functor<void (std::streambuf &, std::streambuf &)> &)> &save);
+ void Map(const std::string &path, const Functor<void (const std::string &, const Functor<void (const Functor<void (std::streambuf &, std::streambuf &)> &)> &)> &code, const std::string &file, const Functor<void (const Functor<void (std::streambuf &, const void *)> &)> &save);
public:
UnionFolder(Folder &parent);
- virtual void Save(const std::string &path, const Functor<void (std::streambuf &)> &code);
- virtual bool Open(const std::string &path, const Functor<void (std::streambuf &)> &code);
- virtual void Find(const std::string &path, const Functor<void (const std::string &, const Functor<void (const Functor<void (std::streambuf &, std::streambuf &)> &)> &)> &code);
+ virtual void Save(const std::string &path, const void *flag, const Functor<void (std::streambuf &)> &code);
+ virtual bool Open(const std::string &path, const Functor<void (std::streambuf &, const void *)> &code);
+ virtual void Find(const std::string &path, const Functor<void (const std::string &, const Functor<void (const Functor<void (std::streambuf &, std::streambuf &)> &)> &)> &code, const Functor<void (const std::string &, const Functor<std::string ()> &)> &link);
void operator ()(const std::string &from) {
deletes_.insert(from);
remaps_[to] = from;
}
- std::stringbuf &operator [](const std::string &path) {
- operator ()(path);
- return resets_[path];
+ std::stringbuf &operator ()(const std::string &from, const void *flag) {
+ operator ()(from);
+ auto &reset(resets_[from]);
+ reset.second = flag;
+ return reset.first;
}
};
-std::string Bundle(const std::string &root, Folder &folder, const std::string &key, std::map<std::string, std::vector<char>> &remote, const std::string &entitlements);
+std::string Bundle(const std::string &root, Folder &folder, const std::string &key, const std::string &entitlements, const std::string &requirement);
typedef std::map<uint32_t, std::vector<char>> 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);
+void 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);
}