]>
Commit | Line | Data |
---|---|---|
1 | /* Cycript - The Truly Universal Scripting Language | |
2 | * Copyright (C) 2009-2016 Jay Freeman (saurik) | |
3 | */ | |
4 | ||
5 | /* GNU Affero General Public License, Version 3 {{{ */ | |
6 | /* | |
7 | * This program is free software: you can redistribute it and/or modify | |
8 | * it under the terms of the GNU Affero General Public License as published by | |
9 | * the Free Software Foundation, either version 3 of the License, or | |
10 | * (at your option) any later version. | |
11 | ||
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU Affero General Public License for more details. | |
16 | ||
17 | * You should have received a copy of the GNU Affero General Public License | |
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 | **/ | |
20 | /* }}} */ | |
21 | ||
22 | #ifndef CYCRIPT_OBJECTIVEC_INTERNAL_HPP | |
23 | #define CYCRIPT_OBJECTIVEC_INTERNAL_HPP | |
24 | ||
25 | #include <objc/objc.h> | |
26 | ||
27 | #include "../Internal.hpp" | |
28 | ||
29 | struct Selector_privateData : | |
30 | CYRoot | |
31 | { | |
32 | SEL value_; | |
33 | ||
34 | _finline Selector_privateData(SEL value) : | |
35 | value_(value) | |
36 | { | |
37 | } | |
38 | }; | |
39 | ||
40 | struct Instance : | |
41 | CYPrivateOld<Instance> | |
42 | { | |
43 | typedef unsigned Flags; | |
44 | static const Flags None = 0; | |
45 | static const Flags Permanent = 1 << 0; | |
46 | static const Flags Uninitialized = 1 << 1; | |
47 | ||
48 | id value_; | |
49 | Flags flags_; | |
50 | ||
51 | Instance(id value, Flags flags); | |
52 | virtual ~Instance(); | |
53 | ||
54 | JSValueRef GetPrototype(JSContextRef context) const; | |
55 | ||
56 | static JSClassRef GetClass(id value, Flags flags); | |
57 | ||
58 | _finline bool IsPermanent() const { | |
59 | return (flags_ & Permanent) != 0; | |
60 | } | |
61 | ||
62 | _finline bool IsUninitialized() const { | |
63 | return (flags_ & Uninitialized) != 0; | |
64 | } | |
65 | }; | |
66 | ||
67 | namespace cy { | |
68 | struct Super : | |
69 | CYRoot | |
70 | { | |
71 | id value_; | |
72 | Class class_; | |
73 | ||
74 | _finline Super(id value, Class _class) : | |
75 | value_(value), | |
76 | class_(_class) | |
77 | { | |
78 | } | |
79 | }; } | |
80 | ||
81 | struct Messages : | |
82 | CYRoot | |
83 | { | |
84 | Class value_; | |
85 | ||
86 | _finline Messages(Class value) : | |
87 | value_(value) | |
88 | { | |
89 | } | |
90 | ||
91 | JSValueRef GetPrototype(JSContextRef context) const; | |
92 | }; | |
93 | ||
94 | struct Interior : | |
95 | CYRoot | |
96 | { | |
97 | id value_; | |
98 | CYProtect owner_; | |
99 | ||
100 | _finline Interior(id value, JSContextRef context, JSObjectRef owner) : | |
101 | value_(value), | |
102 | owner_(context, owner) | |
103 | { | |
104 | } | |
105 | }; | |
106 | ||
107 | #endif/*CYCRIPT_OBJECTIVEC_INTERNAL_HPP*/ |