1 //===-- CFCMutableSet.cpp ---------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "CFCMutableSet.h"
14 // Other libraries and framework includes
17 //----------------------------------------------------------------------
18 // CFCString constructor
19 //----------------------------------------------------------------------
20 CFCMutableSet::CFCMutableSet(CFMutableSetRef s) :
21 CFCReleaser<CFMutableSetRef> (s)
25 //----------------------------------------------------------------------
26 // CFCMutableSet copy constructor
27 //----------------------------------------------------------------------
28 CFCMutableSet::CFCMutableSet(const CFCMutableSet& rhs) :
29 CFCReleaser<CFMutableSetRef> (rhs)
33 //----------------------------------------------------------------------
34 // CFCMutableSet copy constructor
35 //----------------------------------------------------------------------
37 CFCMutableSet::operator=(const CFCMutableSet& rhs)
44 //----------------------------------------------------------------------
46 //----------------------------------------------------------------------
47 CFCMutableSet::~CFCMutableSet()
53 CFCMutableSet::GetCount() const
55 CFMutableSetRef set = get();
57 return ::CFSetGetCount (set);
62 CFCMutableSet::GetCountOfValue(const void *value) const
64 CFMutableSetRef set = get();
66 return ::CFSetGetCountOfValue (set, value);
71 CFCMutableSet::GetValue(const void *value) const
73 CFMutableSetRef set = get();
75 return ::CFSetGetValue(set, value);
81 CFCMutableSet::AddValue(const void *value, bool can_create)
83 CFMutableSetRef set = get();
86 if (can_create == false)
88 set = ::CFSetCreateMutable(kCFAllocatorDefault, 0, &kCFTypeSetCallBacks);
93 ::CFSetAddValue(set, value);
100 CFCMutableSet::RemoveValue(const void *value)
102 CFMutableSetRef set = get();
104 ::CFSetRemoveValue(set, value);
108 CFCMutableSet::RemoveAllValues()
110 CFMutableSetRef set = get();
112 ::CFSetRemoveAllValues(set);