1 //===-- CFCString.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_CFString_h_
10 #define CoreFoundationCPP_CFString_h_
11 
12 #include <iosfwd>
13 
14 #include "CFCReleaser.h"
15 
16 class CFCString : public CFCReleaser<CFStringRef> {
17 public:
18   //------------------------------------------------------------------
19   // Constructors and Destructors
20   //------------------------------------------------------------------
21   CFCString(CFStringRef cf_str = NULL);
22   CFCString(const char *s, CFStringEncoding encoding = kCFStringEncodingUTF8);
23   CFCString(const CFCString &rhs);
24   CFCString &operator=(const CFCString &rhs);
25   virtual ~CFCString();
26 
27   const char *GetFileSystemRepresentation(std::string &str);
28   CFStringRef SetFileSystemRepresentation(const char *path);
29   CFStringRef SetFileSystemRepresentationFromCFType(CFTypeRef cf_type);
30   CFStringRef SetFileSystemRepresentationAndExpandTilde(const char *path);
31   const char *UTF8(std::string &str);
32   CFIndex GetLength() const;
33   static const char *UTF8(CFStringRef cf_str, std::string &str);
34   static const char *FileSystemRepresentation(CFStringRef cf_str,
35                                               std::string &str);
36   static const char *ExpandTildeInPath(const char *path,
37                                        std::string &expanded_path);
38 };
39 
40 #endif // #ifndef CoreFoundationCPP_CFString_h_
41