1 //===-- CFCString.h ---------------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef CoreFoundationCPP_CFString_h_ 11 #define CoreFoundationCPP_CFString_h_ 12 13 #include <iosfwd> 14 15 #include "CFCReleaser.h" 16 17 class CFCString : public CFCReleaser<CFStringRef> { 18 public: 19 //------------------------------------------------------------------ 20 // Constructors and Destructors 21 //------------------------------------------------------------------ 22 CFCString(CFStringRef cf_str = NULL); 23 CFCString(const char *s, CFStringEncoding encoding = kCFStringEncodingUTF8); 24 CFCString(const CFCString &rhs); 25 CFCString &operator=(const CFCString &rhs); 26 virtual ~CFCString(); 27 28 const char *GetFileSystemRepresentation(std::string &str); 29 CFStringRef SetFileSystemRepresentation(const char *path); 30 CFStringRef SetFileSystemRepresentationFromCFType(CFTypeRef cf_type); 31 CFStringRef SetFileSystemRepresentationAndExpandTilde(const char *path); 32 const char *UTF8(std::string &str); 33 CFIndex GetLength() const; 34 static const char *UTF8(CFStringRef cf_str, std::string &str); 35 static const char *FileSystemRepresentation(CFStringRef cf_str, 36 std::string &str); 37 static const char *ExpandTildeInPath(const char *path, 38 std::string &expanded_path); 39 }; 40 41 #endif // #ifndef CoreFoundationCPP_CFString_h_ 42