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 public:
17   //------------------------------------------------------------------
18   // Constructors and Destructors
19   //------------------------------------------------------------------
20   CFCMutableArray(CFMutableArrayRef array = NULL);
21   CFCMutableArray(const CFCMutableArray &rhs); // This will copy the array
22                                                // contents into a new array
23   CFCMutableArray &operator=(const CFCMutableArray &rhs); // This will re-use
24                                                           // the same array and
25                                                           // just bump the ref
26                                                           // count
27   virtual ~CFCMutableArray();
28 
29   CFIndex GetCount() const;
30   CFIndex GetCountOfValue(const void *value) const;
31   CFIndex GetCountOfValue(CFRange range, const void *value) const;
32   const void *GetValueAtIndex(CFIndex idx) const;
33   bool SetValueAtIndex(CFIndex idx, const void *value);
34   bool AppendValue(const void *value,
35                    bool can_create = true); // Appends value and optionally
36                                             // creates a CFCMutableArray if this
37                                             // class doesn't contain one
38   bool
39   AppendCStringAsCFString(const char *cstr,
40                           CFStringEncoding encoding = kCFStringEncodingUTF8,
41                           bool can_create = true);
42   bool AppendFileSystemRepresentationAsCFString(const char *s,
43                                                 bool can_create = true);
44 };
45 
46 #endif // #ifndef CoreFoundationCPP_CFMutableArray_h_
47