LLDB mainline
CFCMutableSet.cpp
Go to the documentation of this file.
1//===-- CFCMutableSet.cpp -------------------------------------------------===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9#include "CFCMutableSet.h"
10
11
12// CFCString constructor
15
16// CFCMutableSet copy constructor
18
19// CFCMutableSet copy constructor
21 if (this != &rhs)
22 *this = rhs;
23 return *this;
24}
25
26// Destructor
28
29CFIndex CFCMutableSet::GetCount() const {
30 CFMutableSetRef set = get();
31 if (set)
32 return ::CFSetGetCount(set);
33 return 0;
34}
35
36CFIndex CFCMutableSet::GetCountOfValue(const void *value) const {
37 CFMutableSetRef set = get();
38 if (set)
39 return ::CFSetGetCountOfValue(set, value);
40 return 0;
41}
42
43const void *CFCMutableSet::GetValue(const void *value) const {
44 CFMutableSetRef set = get();
45 if (set)
46 return ::CFSetGetValue(set, value);
47 return NULL;
48}
49
50const void *CFCMutableSet::AddValue(const void *value, bool can_create) {
51 CFMutableSetRef set = get();
52 if (set == NULL) {
53 if (!can_create)
54 return NULL;
55 set = ::CFSetCreateMutable(kCFAllocatorDefault, 0, &kCFTypeSetCallBacks);
56 reset(set);
57 }
58 if (set != NULL) {
59 ::CFSetAddValue(set, value);
60 return value;
61 }
62 return NULL;
63}
64
65void CFCMutableSet::RemoveValue(const void *value) {
66 CFMutableSetRef set = get();
67 if (set)
68 ::CFSetRemoveValue(set, value);
69}
70
72 CFMutableSetRef set = get();
73 if (set)
74 ::CFSetRemoveAllValues(set);
75}
CFIndex GetCountOfValue(const void *value) const
CFCMutableSet(CFMutableSetRef s=NULL)
const CFCMutableSet & operator=(const CFCMutableSet &rhs)
void RemoveAllValues()
const void * GetValue(const void *value) const
void RemoveValue(const void *value)
const void * AddValue(const void *value, bool can_create)
~CFCMutableSet() override
CFIndex GetCount() const
void reset(CFMutableSetRef ptr=NULL)
Definition: CFCReleaser.h:86