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