xref: /openbsd-src/gnu/llvm/lldb/source/Host/macosx/cfcpp/CFCMutableArray.h (revision f6aab3d83b51b91c24247ad2c2573574de475a82)
1061da546Spatrick //===-- CFCMutableArray.h ---------------------------------------*- C++ -*-===//
2061da546Spatrick //
3061da546Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4061da546Spatrick // See https://llvm.org/LICENSE.txt for license information.
5061da546Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6061da546Spatrick //
7061da546Spatrick //===----------------------------------------------------------------------===//
8061da546Spatrick 
9dda28197Spatrick #ifndef LLDB_SOURCE_HOST_MACOSX_CFCPP_CFCMUTABLEARRAY_H
10dda28197Spatrick #define LLDB_SOURCE_HOST_MACOSX_CFCPP_CFCMUTABLEARRAY_H
11061da546Spatrick 
12061da546Spatrick #include "CFCReleaser.h"
13061da546Spatrick 
14061da546Spatrick class CFCMutableArray : public CFCReleaser<CFMutableArrayRef> {
15061da546Spatrick public:
16061da546Spatrick   // Constructors and Destructors
17061da546Spatrick   CFCMutableArray(CFMutableArrayRef array = NULL);
18061da546Spatrick   CFCMutableArray(const CFCMutableArray &rhs); // This will copy the array
19061da546Spatrick                                                // contents into a new array
20061da546Spatrick   CFCMutableArray &operator=(const CFCMutableArray &rhs); // This will re-use
21061da546Spatrick                                                           // the same array and
22061da546Spatrick                                                           // just bump the ref
23061da546Spatrick                                                           // count
24*f6aab3d8Srobert   ~CFCMutableArray() override;
25061da546Spatrick 
26061da546Spatrick   CFIndex GetCount() const;
27061da546Spatrick   CFIndex GetCountOfValue(const void *value) const;
28061da546Spatrick   CFIndex GetCountOfValue(CFRange range, const void *value) const;
29061da546Spatrick   const void *GetValueAtIndex(CFIndex idx) const;
30061da546Spatrick   bool SetValueAtIndex(CFIndex idx, const void *value);
31061da546Spatrick   bool AppendValue(const void *value,
32061da546Spatrick                    bool can_create = true); // Appends value and optionally
33061da546Spatrick                                             // creates a CFCMutableArray if this
34061da546Spatrick                                             // class doesn't contain one
35061da546Spatrick   bool
36061da546Spatrick   AppendCStringAsCFString(const char *cstr,
37061da546Spatrick                           CFStringEncoding encoding = kCFStringEncodingUTF8,
38061da546Spatrick                           bool can_create = true);
39061da546Spatrick   bool AppendFileSystemRepresentationAsCFString(const char *s,
40061da546Spatrick                                                 bool can_create = true);
41061da546Spatrick };
42061da546Spatrick 
43dda28197Spatrick #endif // LLDB_SOURCE_HOST_MACOSX_CFCPP_CFCMUTABLEARRAY_H
44