]> git.saurik.com Git - cycript.git/blame - ObjectiveC/Internal.hpp
Use pool.atexit to free Objective-C "list copies".
[cycript.git] / ObjectiveC / Internal.hpp
CommitLineData
7341eedb
JF
1/* Cycript - The Truly Universal Scripting Language
2 * Copyright (C) 2009-2016 Jay Freeman (saurik)
d15b59f5
JF
3*/
4
f95d2598 5/* GNU Affero General Public License, Version 3 {{{ */
d15b59f5 6/*
f95d2598
JF
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
c15969fd 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f95d2598
JF
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/>.
b3378a02 19**/
d15b59f5
JF
20/* }}} */
21
3c1c3635
JF
22#ifndef CYCRIPT_OBJECTIVEC_INTERNAL_HPP
23#define CYCRIPT_OBJECTIVEC_INTERNAL_HPP
24
aabea98c 25#include <objc/objc.h>
3c1c3635 26
20052ff7
JF
27#include "../Internal.hpp"
28
3c1c3635 29struct Selector_privateData :
dbf05bfd 30 CYValue<Selector_privateData, SEL>
3c1c3635
JF
31{
32 _finline Selector_privateData(SEL value) :
dbf05bfd 33 CYValue(value)
3c1c3635
JF
34 {
35 }
3c1c3635
JF
36};
37
38struct Instance :
dbf05bfd 39 CYValue<Instance, id>
3c1c3635 40{
78b24692
JF
41 typedef unsigned Flags;
42 static const Flags None = 0;
43 static const Flags Permanent = 1 << 0;
44 static const Flags Uninitialized = 1 << 1;
3c1c3635
JF
45
46 Flags flags_;
47
d6848e73 48 Instance(id value, Flags flags);
3c1c3635
JF
49 virtual ~Instance();
50
d6848e73 51 JSValueRef GetPrototype(JSContextRef context) const;
3c1c3635 52
d6848e73 53 static JSClassRef GetClass(id value, Flags flags);
3c1c3635 54
78b24692
JF
55 _finline bool IsPermanent() const {
56 return (flags_ & Permanent) != 0;
57 }
58
3c1c3635
JF
59 _finline bool IsUninitialized() const {
60 return (flags_ & Uninitialized) != 0;
61 }
3c1c3635
JF
62};
63
64namespace cy {
65struct Super :
dbf05bfd 66 CYValue<Super, id>
3c1c3635
JF
67{
68 Class class_;
69
70 _finline Super(id value, Class _class) :
dbf05bfd 71 CYValue(value),
3c1c3635
JF
72 class_(_class)
73 {
74 }
3c1c3635
JF
75}; }
76
77struct Messages :
dbf05bfd 78 CYValue<Messages, Class>
3c1c3635
JF
79{
80 _finline Messages(Class value) :
dbf05bfd 81 CYValue(value)
3c1c3635
JF
82 {
83 }
84
d6848e73 85 JSValueRef GetPrototype(JSContextRef context) const;
3c1c3635
JF
86};
87
8effd381
JF
88struct Interior :
89 CYValue<Interior, id>
3c1c3635 90{
d6848e73
JF
91 CYProtect owner_;
92
8effd381 93 _finline Interior(id value, JSContextRef context, JSObjectRef owner) :
dbf05bfd 94 CYValue(value),
d6848e73 95 owner_(context, owner)
3c1c3635
JF
96 {
97 }
3c1c3635
JF
98};
99
100#endif/*CYCRIPT_OBJECTIVEC_INTERNAL_HPP*/