1 //===-- CFCMutableSet.cpp -------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "CFCMutableSet.h"
12 // CFCString constructor
13 CFCMutableSet::CFCMutableSet(CFMutableSetRef s
)
14 : CFCReleaser
<CFMutableSetRef
>(s
) {}
16 // CFCMutableSet copy constructor
17 CFCMutableSet::CFCMutableSet(const CFCMutableSet
&rhs
) = default;
19 // CFCMutableSet copy constructor
20 const CFCMutableSet
&CFCMutableSet::operator=(const CFCMutableSet
&rhs
) {
27 CFCMutableSet::~CFCMutableSet() = default;
29 CFIndex
CFCMutableSet::GetCount() const {
30 CFMutableSetRef set
= get();
32 return ::CFSetGetCount(set
);
36 CFIndex
CFCMutableSet::GetCountOfValue(const void *value
) const {
37 CFMutableSetRef set
= get();
39 return ::CFSetGetCountOfValue(set
, value
);
43 const void *CFCMutableSet::GetValue(const void *value
) const {
44 CFMutableSetRef set
= get();
46 return ::CFSetGetValue(set
, value
);
50 const void *CFCMutableSet::AddValue(const void *value
, bool can_create
) {
51 CFMutableSetRef set
= get();
55 set
= ::CFSetCreateMutable(kCFAllocatorDefault
, 0, &kCFTypeSetCallBacks
);
59 ::CFSetAddValue(set
, value
);
65 void CFCMutableSet::RemoveValue(const void *value
) {
66 CFMutableSetRef set
= get();
68 ::CFSetRemoveValue(set
, value
);
71 void CFCMutableSet::RemoveAllValues() {
72 CFMutableSetRef set
= get();
74 ::CFSetRemoveAllValues(set
);