]> git.saurik.com Git - ldid.git/blame - ldid.hpp
Slightly improve prototypes for Sign and Allocate.
[ldid.git] / ldid.hpp
CommitLineData
a0c715e9
JF
1#ifndef LDID_HPP
2#define LDID_HPP
3
4#include <cstdlib>
5#include <map>
6#include <streambuf>
7#include <string>
8
9namespace ldid {
10
e6a376fc
JF
11// I wish Apple cared about providing quality toolchains :/
12
13template <typename Function_>
14class Functor;
15
16template <typename Type_, typename... Args_>
17class Functor<Type_ (Args_...)> {
18 public:
19 virtual Type_ operator ()(Args_... args) const = 0;
20};
21
22template <typename Function_>
23class FunctorImpl;
24
25template <typename Value_, typename Type_, typename... Args_>
26class FunctorImpl<Type_ (Value_::*)(Args_...) const> :
27 public Functor<Type_ (Args_...)>
28{
29 private:
30 const Value_ *value_;
31
32 public:
33 FunctorImpl(const Value_ &value) :
34 value_(&value)
35 {
36 }
37
38 virtual Type_ operator ()(Args_... args) const {
39 return (*value_)(args...);
40 }
41};
42
43template <typename Function_>
44FunctorImpl<decltype(&Function_::operator())> fun(const Function_ &value) {
45 return value;
46}
47
a0c715e9
JF
48typedef std::map<uint32_t, std::string> Slots;
49
ffdd1183 50void 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);
a0c715e9
JF
51
52}
53
54#endif//LDID_HPP