Todd Fiala | e77fce0 | 2016-09-04 00:18:56 +0000 | [diff] [blame] | 1 | //===-- CFString.h ----------------------------------------------*- C++ -*-===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
Todd Fiala | e77fce0 | 2016-09-04 00:18:56 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // Created by Greg Clayton on 1/16/08. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #ifndef __CFString_h__ |
| 14 | #define __CFString_h__ |
| 15 | |
| 16 | #include "CFUtils.h" |
| 17 | #include <iosfwd> |
| 18 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 19 | class CFString : public CFReleaser<CFStringRef> { |
Todd Fiala | e77fce0 | 2016-09-04 00:18:56 +0000 | [diff] [blame] | 20 | public: |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 21 | //------------------------------------------------------------------ |
| 22 | // Constructors and Destructors |
| 23 | //------------------------------------------------------------------ |
| 24 | CFString(CFStringRef cf_str = NULL); |
| 25 | CFString(const char *s, CFStringEncoding encoding = kCFStringEncodingUTF8); |
| 26 | CFString(const CFString &rhs); |
| 27 | CFString &operator=(const CFString &rhs); |
| 28 | virtual ~CFString(); |
Todd Fiala | e77fce0 | 2016-09-04 00:18:56 +0000 | [diff] [blame] | 29 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 30 | const char *GetFileSystemRepresentation(std::string &str); |
| 31 | CFStringRef SetFileSystemRepresentation(const char *path); |
| 32 | CFStringRef SetFileSystemRepresentationFromCFType(CFTypeRef cf_type); |
| 33 | CFStringRef SetFileSystemRepresentationAndExpandTilde(const char *path); |
| 34 | const char *UTF8(std::string &str); |
| 35 | CFIndex GetLength() const; |
| 36 | static const char *UTF8(CFStringRef cf_str, std::string &str); |
| 37 | static const char *FileSystemRepresentation(CFStringRef cf_str, |
| 38 | std::string &str); |
| 39 | static const char *GlobPath(const char *path, std::string &expanded_path); |
Todd Fiala | e77fce0 | 2016-09-04 00:18:56 +0000 | [diff] [blame] | 40 | }; |
| 41 | |
| 42 | #endif // #ifndef __CFString_h__ |