Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/metal-cpp/Foundation/NSDictionary.hpp
21066 views
1
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
2
//
3
// Foundation/NSDictionary.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 "NSEnumerator.hpp"
26
#include "NSObject.hpp"
27
#include "NSTypes.hpp"
28
29
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
30
31
namespace NS
32
{
33
class Dictionary : public NS::Copying<Dictionary>
34
{
35
public:
36
static Dictionary* dictionary();
37
static Dictionary* dictionary(const Object* pObject, const Object* pKey);
38
static Dictionary* dictionary(const Object* const* pObjects, const Object* const* pKeys, UInteger count);
39
40
static Dictionary* alloc();
41
42
Dictionary* init();
43
Dictionary* init(const Object* const* pObjects, const Object* const* pKeys, UInteger count);
44
Dictionary* init(const class Coder* pCoder);
45
46
template <class _KeyType = Object>
47
Enumerator<_KeyType>* keyEnumerator() const;
48
49
template <class _Object = Object>
50
_Object* object(const Object* pKey) const;
51
UInteger count() const;
52
};
53
}
54
55
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
56
57
_NS_INLINE NS::Dictionary* NS::Dictionary::dictionary()
58
{
59
return Object::sendMessage<Dictionary*>(_NS_PRIVATE_CLS(NSDictionary), _NS_PRIVATE_SEL(dictionary));
60
}
61
62
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
63
64
_NS_INLINE NS::Dictionary* NS::Dictionary::dictionary(const Object* pObject, const Object* pKey)
65
{
66
return Object::sendMessage<Dictionary*>(_NS_PRIVATE_CLS(NSDictionary), _NS_PRIVATE_SEL(dictionaryWithObject_forKey_), pObject, pKey);
67
}
68
69
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
70
71
_NS_INLINE NS::Dictionary* NS::Dictionary::dictionary(const Object* const* pObjects, const Object* const* pKeys, UInteger count)
72
{
73
return Object::sendMessage<Dictionary*>(_NS_PRIVATE_CLS(NSDictionary), _NS_PRIVATE_SEL(dictionaryWithObjects_forKeys_count_),
74
pObjects, pKeys, count);
75
}
76
77
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
78
79
_NS_INLINE NS::Dictionary* NS::Dictionary::alloc()
80
{
81
return NS::Object::alloc<Dictionary>(_NS_PRIVATE_CLS(NSDictionary));
82
}
83
84
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
85
86
_NS_INLINE NS::Dictionary* NS::Dictionary::init()
87
{
88
return NS::Object::init<Dictionary>();
89
}
90
91
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
92
93
_NS_INLINE NS::Dictionary* NS::Dictionary::init(const Object* const* pObjects, const Object* const* pKeys, UInteger count)
94
{
95
return Object::sendMessage<Dictionary*>(this, _NS_PRIVATE_SEL(initWithObjects_forKeys_count_), pObjects, pKeys, count);
96
}
97
98
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
99
100
_NS_INLINE NS::Dictionary* NS::Dictionary::init(const class Coder* pCoder)
101
{
102
return Object::sendMessage<Dictionary*>(this, _NS_PRIVATE_SEL(initWithCoder_), pCoder);
103
}
104
105
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
106
107
template <class _KeyType>
108
_NS_INLINE NS::Enumerator<_KeyType>* NS::Dictionary::keyEnumerator() const
109
{
110
return Object::sendMessage<Enumerator<_KeyType>*>(this, _NS_PRIVATE_SEL(keyEnumerator));
111
}
112
113
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
114
115
template <class _Object>
116
_NS_INLINE _Object* NS::Dictionary::object(const Object* pKey) const
117
{
118
return Object::sendMessage<_Object*>(this, _NS_PRIVATE_SEL(objectForKey_), pKey);
119
}
120
121
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
122
123
_NS_INLINE NS::UInteger NS::Dictionary::count() const
124
{
125
return Object::sendMessage<UInteger>(this, _NS_PRIVATE_SEL(count));
126
}
127
128
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
129
130