Path: blob/master/thirdparty/metal-cpp/Foundation/NSSet.hpp
21066 views
//-------------------------------------------------------------------------------------------------------------------------------------------------------------1//2// Foundation/NSSet.hpp3//4// Copyright 2020-2024 Apple Inc.5//6// Licensed under the Apache License, Version 2.0 (the "License");7// you may not use this file except in compliance with the License.8// You may obtain a copy of the License at9//10// http://www.apache.org/licenses/LICENSE-2.011//12// Unless required by applicable law or agreed to in writing, software13// distributed under the License is distributed on an "AS IS" BASIS,14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.15// See the License for the specific language governing permissions and16// limitations under the License.17//18//-------------------------------------------------------------------------------------------------------------------------------------------------------------1920#pragma once2122//-------------------------------------------------------------------------------------------------------------------------------------------------------------2324#include "NSObject.hpp"25#include "NSEnumerator.hpp"2627/*****Immutable Set*******/2829namespace NS30{31class Set : public NS::Copying <Set>32{33public:34UInteger count() const;35Enumerator<Object>* objectEnumerator() const;3637static Set* alloc();3839Set* init();40Set* init(const Object* const* pObjects, UInteger count);41Set* init(const class Coder* pCoder);4243};44}4546//-------------------------------------------------------------------------------------------------------------------------------------------------------------4748_NS_INLINE NS::UInteger NS::Set::count() const49{50return NS::Object::sendMessage<NS::UInteger>(this, _NS_PRIVATE_SEL(count));51}5253//-------------------------------------------------------------------------------------------------------------------------------------------------------------5455_NS_INLINE NS::Enumerator<NS::Object>* NS::Set::objectEnumerator() const56{57return NS::Object::sendMessage<Enumerator<NS::Object>*>(this, _NS_PRIVATE_SEL(objectEnumerator));58}5960//-------------------------------------------------------------------------------------------------------------------------------------------------------------6162_NS_INLINE NS::Set* NS::Set::alloc()63{64return NS::Object::alloc<Set>(_NS_PRIVATE_CLS(NSSet));65}6667//-------------------------------------------------------------------------------------------------------------------------------------------------------------6869_NS_INLINE NS::Set* NS::Set::init()70{71return NS::Object::init<Set>();72}7374//-------------------------------------------------------------------------------------------------------------------------------------------------------------7576_NS_INLINE NS::Set* NS::Set::init(const Object* const* pObjects, NS::UInteger count)77{78return NS::Object::sendMessage<Set*>(this, _NS_PRIVATE_SEL(initWithObjects_count_), pObjects, count);79}8081//-------------------------------------------------------------------------------------------------------------------------------------------------------------8283_NS_INLINE NS::Set* NS::Set::init(const class Coder* pCoder)84{85return Object::sendMessage<Set*>(this, _NS_PRIVATE_SEL(initWithCoder_), pCoder);86}878889