1 //===-- CFCMutableArray.h ---------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef CoreFoundationCPP_CFMutableArray_h_
11 #define CoreFoundationCPP_CFMutableArray_h_
12 
13 #include "CFCReleaser.h"
14 
15 class CFCMutableArray : public CFCReleaser<CFMutableArrayRef>
16 {
17 public:
18     //------------------------------------------------------------------
19     // Constructors and Destructors
20     //------------------------------------------------------------------
21     CFCMutableArray(CFMutableArrayRef array = NULL);
22     CFCMutableArray(const CFCMutableArray& rhs);                // This will copy the array contents into a new array
23     CFCMutableArray& operator=(const CFCMutableArray& rhs); // This will re-use the same array and just bump the ref count
24     virtual ~CFCMutableArray();
25 
26     CFIndex         GetCount() const;
27     CFIndex         GetCountOfValue(const void *value) const;
28     CFIndex         GetCountOfValue(CFRange range, const void *value) const;
29     const void *    GetValueAtIndex(CFIndex idx) const;
30     bool            SetValueAtIndex(CFIndex idx, const void *value);
31     bool            AppendValue(const void *value, bool can_create = true); // Appends value and optionally creates a CFCMutableArray if this class doesn't contain one
32     bool            AppendCStringAsCFString (const char *cstr,
33                                              CFStringEncoding encoding = kCFStringEncodingUTF8,
34                                              bool can_create = true);
35     bool            AppendFileSystemRepresentationAsCFString (const char *s,
36                                                               bool can_create = true);
37 };
38 
39 #endif // #ifndef CoreFoundationCPP_CFMutableArray_h_
40