11 // I wish Apple cared about providing quality toolchains :/
13 template <typename Function_>
16 template <typename Type_, typename... Args_>
17 class Functor<Type_ (Args_...)> {
19 virtual Type_ operator ()(Args_... args) const = 0;
22 template <typename Function_>
25 template <typename Value_, typename Type_, typename... Args_>
26 class FunctorImpl<Type_ (Value_::*)(Args_...) const> :
27 public Functor<Type_ (Args_...)>
33 FunctorImpl(const Value_ &value) :
38 virtual Type_ operator ()(Args_... args) const {
39 return (*value_)(args...);
43 template <typename Function_>
44 FunctorImpl<decltype(&Function_::operator())> fun(const Function_ &value) {
50 virtual void Save(const std::string &path, const Functor<void (std::streambuf &)> &code) = 0;
51 virtual bool Open(const std::string &path, const Functor<void (std::streambuf &)> &code) = 0;
52 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;
59 const std::string path_;
60 std::map<std::string, std::string> commit_;
62 std::string Path(const std::string &path);
64 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);
67 DiskFolder(const std::string &path);
70 virtual void Save(const std::string &path, const Functor<void (std::streambuf &)> &code);
71 virtual bool Open(const std::string &path, const Functor<void (std::streambuf &)> &code);
72 virtual void Find(const std::string &path, const Functor<void (const std::string &, const Functor<void (const Functor<void (std::streambuf &, std::streambuf &)> &)> &)> &code);
83 SubFolder(Folder *parent, const std::string &path);
85 virtual void Save(const std::string &path, const Functor<void (std::streambuf &)> &code);
86 virtual bool Open(const std::string &path, const Functor<void (std::streambuf &)> &code);
87 virtual void Find(const std::string &path, const Functor<void (const std::string &, const Functor<void (const Functor<void (std::streambuf &, std::streambuf &)> &)> &)> &code);
90 typedef std::map<uint32_t, std::vector<char>> Slots;
92 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);