Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/metal-cpp/Foundation/NSAutoreleasePool.hpp
21082 views
1
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
//
3
// Foundation/NSAutoreleasePool.hpp
4
//
5
// Copyright 2020-2024 Apple Inc.
6
//
7
// Licensed under the Apache License, Version 2.0 (the "License");
8
// you may not use this file except in compliance with the License.
9
// You may obtain a copy of the License at
10
//
11
// http://www.apache.org/licenses/LICENSE-2.0
12
//
13
// Unless required by applicable law or agreed to in writing, software
14
// distributed under the License is distributed on an "AS IS" BASIS,
15
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
// See the License for the specific language governing permissions and
17
// limitations under the License.
18
//
19
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
20
21
#pragma once
22
23
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
24
25
#include "NSDefines.hpp"
26
#include "NSObject.hpp"
27
#include "NSPrivate.hpp"
28
#include "NSTypes.hpp"
29
30
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
31
32
namespace NS
33
{
34
class AutoreleasePool : public Object
35
{
36
public:
37
static AutoreleasePool* alloc();
38
AutoreleasePool* init();
39
40
void drain();
41
42
void addObject(Object* pObject);
43
44
static void showPools();
45
};
46
}
47
48
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
49
50
_NS_INLINE NS::AutoreleasePool* NS::AutoreleasePool::alloc()
51
{
52
return NS::Object::alloc<AutoreleasePool>(_NS_PRIVATE_CLS(NSAutoreleasePool));
53
}
54
55
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
56
57
_NS_INLINE NS::AutoreleasePool* NS::AutoreleasePool::init()
58
{
59
return NS::Object::init<AutoreleasePool>();
60
}
61
62
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
63
64
_NS_INLINE void NS::AutoreleasePool::drain()
65
{
66
Object::sendMessage<void>(this, _NS_PRIVATE_SEL(drain));
67
}
68
69
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
70
71
_NS_INLINE void NS::AutoreleasePool::addObject(Object* pObject)
72
{
73
Object::sendMessage<void>(this, _NS_PRIVATE_SEL(addObject_), pObject);
74
}
75
76
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
77
78
_NS_INLINE void NS::AutoreleasePool::showPools()
79
{
80
Object::sendMessage<void>(_NS_PRIVATE_CLS(NSAutoreleasePool), _NS_PRIVATE_SEL(showPools));
81
}
82
83
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
84
85