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
18  : CFCReleaser<CFMutableSetRef>(rhs) {}
19 
20 // CFCMutableSet copy constructor
22  if (this != &rhs)
23  *this = rhs;
24  return *this;
25 }
26 
27 // Destructor
29 
30 CFIndex CFCMutableSet::GetCount() const {
31  CFMutableSetRef set = get();
32  if (set)
33  return ::CFSetGetCount(set);
34  return 0;
35 }
36 
37 CFIndex CFCMutableSet::GetCountOfValue(const void *value) const {
38  CFMutableSetRef set = get();
39  if (set)
40  return ::CFSetGetCountOfValue(set, value);
41  return 0;
42 }
43 
44 const void *CFCMutableSet::GetValue(const void *value) const {
45  CFMutableSetRef set = get();
46  if (set)
47  return ::CFSetGetValue(set, value);
48  return NULL;
49 }
50 
51 const void *CFCMutableSet::AddValue(const void *value, bool can_create) {
52  CFMutableSetRef set = get();
53  if (set == NULL) {
54  if (!can_create)
55  return NULL;
56  set = ::CFSetCreateMutable(kCFAllocatorDefault, 0, &kCFTypeSetCallBacks);
57  reset(set);
58  }
59  if (set != NULL) {
60  ::CFSetAddValue(set, value);
61  return value;
62  }
63  return NULL;
64 }
65 
66 void CFCMutableSet::RemoveValue(const void *value) {
67  CFMutableSetRef set = get();
68  if (set)
69  ::CFSetRemoveValue(set, value);
70 }
71 
73  CFMutableSetRef set = get();
74  if (set)
75  ::CFSetRemoveAllValues(set);
76 }
CFCMutableSet
Definition: CFCMutableSet.h:14
CFCMutableSet::GetCount
CFIndex GetCount() const
Definition: CFCMutableSet.cpp:30
CFCMutableSet::CFCMutableSet
CFCMutableSet(CFMutableSetRef s=NULL)
Definition: CFCMutableSet.cpp:13
CFCMutableSet::operator=
const CFCMutableSet & operator=(const CFCMutableSet &rhs)
Definition: CFCMutableSet.cpp:21
CFCReleaser
CFCMutableSet::AddValue
const void * AddValue(const void *value, bool can_create)
Definition: CFCMutableSet.cpp:51
CFCMutableSet::GetValue
const void * GetValue(const void *value) const
Definition: CFCMutableSet.cpp:44
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:37
CFCMutableSet::RemoveAllValues
void RemoveAllValues()
Definition: CFCMutableSet.cpp:72
CFCMutableSet::RemoveValue
void RemoveValue(const void *value)
Definition: CFCMutableSet.cpp:66
CFCMutableSet::~CFCMutableSet
virtual ~CFCMutableSet()