| 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 LLDB_SOURCE_HOST_MACOSX_CFCPP_CFCMUTABLEARRAY_H |
| 10 | #define LLDB_SOURCE_HOST_MACOSX_CFCPP_CFCMUTABLEARRAY_H |
| 11 | |
| 12 | #include "CFCReleaser.h" |
| 13 | |
| 14 | class CFCMutableArray : public CFCReleaser<CFMutableArrayRef> { |
| 15 | public: |
| 16 | // Constructors and Destructors |
| 17 | CFCMutableArray(CFMutableArrayRef array = NULL); |
| 18 | CFCMutableArray(const CFCMutableArray &rhs); // This will copy the array |
| 19 | // contents into a new array |
| 20 | CFCMutableArray &operator=(const CFCMutableArray &rhs); // This will re-use |
| 21 | // the same array and |
| 22 | // just bump the ref |
| 23 | // count |
| 24 | ~CFCMutableArray() override; |
| 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, |
| 32 | bool can_create = true); // Appends value and optionally |
| 33 | // creates a CFCMutableArray if this |
| 34 | // class doesn't contain one |
| 35 | bool |
| 36 | AppendCStringAsCFString(const char *cstr, |
| 37 | CFStringEncoding encoding = kCFStringEncodingUTF8, |
| 38 | bool can_create = true); |
| 39 | bool AppendFileSystemRepresentationAsCFString(const char *s, |
| 40 | bool can_create = true); |
| 41 | }; |
| 42 | |
| 43 | #endif // LLDB_SOURCE_HOST_MACOSX_CFCPP_CFCMUTABLEARRAY_H |
| 44 | |