Package com.sun.jna.platform.mac

# Class CoreFoundation.CFStringRef

java.lang.Object
com.sun.jna.PointerType
com.sun.jna.platform.mac.CoreFoundation.CFTypeRef
com.sun.jna.platform.mac.CoreFoundation.CFStringRef

All Implemented Interfaces:
  `NativeMapped`

Enclosing interface:
  CoreFoundation

public static class CoreFoundation.CFStringRef extends CoreFoundation.CFTypeRef
A reference to a `CFString` object, which “encapsulates” a Unicode string along with its length. `CFString` is an opaque type that defines the characteristics and behavior of `CFString` objects.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `CoreFoundation.CFStringRef.ByReference`
  Placeholder for a reference to a `CFString` object.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CFStringRef()`
  `CFStringRef(Pointer p)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static CoreFoundation.CFStringRef`
  `createCFString(String s)`
  Convenience function which calls `CoreFoundation.CFStringCreateWithCharacters(com.sun.jna.platform.mac.CoreFoundation.CFAllocatorRef, char[], com.sun.jna.platform.mac.CoreFoundation.CFIndex)` to create a new `CoreFoundation.CFStringRef` from the given Java `String` and returns its reference pointer.
  `String`
  `stringValue()`
  Convert a reference to a Core Foundations String into its `String`

  ### Methods inherited from class com.sun.jna.platform.mac.CoreFoundation.CFTypeRef

  `getTypeID, isTypeID, release, retain`

  ### Methods inherited from class com.sun.jna.PointerType

  `equals, fromNative, getPointer, hashCode, nativeType, setPointer, toNative, toString`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### CFStringRef

    public CFStringRef()

  - ### CFStringRef

    public CFStringRef(Pointer p)

- ## Method Details

  - ### createCFString

    public static CoreFoundation.CFStringRef createCFString(String s)
    Convenience function which calls `CoreFoundation.CFStringCreateWithCharacters(com.sun.jna.platform.mac.CoreFoundation.CFAllocatorRef, char[], com.sun.jna.platform.mac.CoreFoundation.CFIndex)` to create a new `CoreFoundation.CFStringRef` from the given Java `String` and returns its reference pointer.

    This reference must be released with `CoreFoundation.CFRelease(com.sun.jna.platform.mac.CoreFoundation.CFTypeRef)` to avoid leaking references.

    Parameters:
      `s` - A `String`.
    Returns:
      An immutable string containing `s`, or `null` if there was a problem creating the object.

  - ### stringValue

    public String stringValue()
    Convert a reference to a Core Foundations String into its `String`
    Returns:
      The corresponding `String`, or null if the conversion failed.