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
13 CFCMutableSet::CFCMutableSet(CFMutableSetRef s)
14  : CFCReleaser<CFMutableSetRef>(s) {}
15 
16 // CFCMutableSet copy constructor
17 CFCMutableSet::CFCMutableSet(const CFCMutableSet &rhs) = default;
18 
19 // CFCMutableSet copy constructor
21  if (this != &rhs)
22  *this = rhs;
23  return *this;
24 }
25 
26 // Destructor
28 
29 CFIndex CFCMutableSet::GetCount() const {
30  CFMutableSetRef set = get();
31  if (set)
32  return ::CFSetGetCount(set);
33  return 0;
34 }
35 
36 CFIndex CFCMutableSet::GetCountOfValue(const void *value) const {
37  CFMutableSetRef set = get();
38  if (set)
39  return ::CFSetGetCountOfValue(set, value);
40  return 0;
41 }
42 
43 const void *CFCMutableSet::GetValue(const void *value) const {
44  CFMutableSetRef set = get();
45  if (set)
46  return ::CFSetGetValue(set, value);
47  return NULL;
48 }
49 
50 const 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 
65 void 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 }
CFCMutableSet
Definition: CFCMutableSet.h:14
CFCMutableSet::GetCount
CFIndex GetCount() const
Definition: CFCMutableSet.cpp:29
CFCMutableSet::CFCMutableSet
CFCMutableSet(CFMutableSetRef s=NULL)
Definition: CFCMutableSet.cpp:13
CFCMutableSet::operator=
const CFCMutableSet & operator=(const CFCMutableSet &rhs)
Definition: CFCMutableSet.cpp:20
CFCReleaser
CFCMutableSet::AddValue
const void * AddValue(const void *value, bool can_create)
Definition: CFCMutableSet.cpp:50
CFCMutableSet::GetValue
const void * GetValue(const void *value) const
Definition: CFCMutableSet.cpp:43
CFCMutableSet::~CFCMutableSet
~CFCMutableSet() override
set
set(option_framework FRAMEWORK) endif() if(LLDB_ENABLE_PYTHON) get_target_property(python_bindings_dir swig_wrapper_python BINARY_DIR) set(lldb_python_wrapper $
Definition: API/CMakeLists.txt:5
CFCMutableSet.h
CFCMutableSet::GetCountOfValue
CFIndex GetCountOfValue(const void *value) const
Definition: CFCMutableSet.cpp:36
CFCMutableSet::RemoveAllValues
void RemoveAllValues()
Definition: CFCMutableSet.cpp:71
CFCMutableSet::RemoveValue
void RemoveValue(const void *value)
Definition: CFCMutableSet.cpp:65