pEpObjCAdapter/PEPAutoPointer.h
author Dirk Zimmermann <dirk@pep-project.org>
Thu, 17 May 2018 09:33:33 +0200
changeset 616 9e50cc7cd612
parent 564 9eba9cef4911
permissions -rw-r--r--
IOSAD-93 consistently using precomposedStringWithCanonicalMapping, stringWithUTF8String
     1 //
     2 //  PEPAutoPointer.h
     3 //  pEpObjCAdapter
     4 //
     5 //  Created by Dirk Zimmermann on 11.04.18.
     6 //  Copyright © 2018 p≡p. All rights reserved.
     7 //
     8 
     9 #import <Foundation/Foundation.h>
    10 
    11 /**
    12  Implements a very basic method to enable use of ARC (or manual cocoa memory management)
    13  for malloc-created pointers.
    14 
    15  When this object goes out of scope (is freed), it calls free() on the contained pointer.
    16  */
    17 @interface PEPAutoPointer : NSObject
    18 
    19 /**
    20  Provide this to a C-function that expects a `void **` pointer to allocate and fill.
    21  */
    22 - (void **)voidPointerPointer;
    23 
    24 /**
    25  Provide this to a C-function that expects a `char **` pointer to allocate and fill.
    26  */
    27 - (char **)charPointerPointer;
    28 
    29 /**
    30  When you have used some C-function to receive content,
    31  use this to access it as a `void *` pointer.
    32  */
    33 - (void *)voidPointer;
    34 
    35 /**
    36  When you have used some C-function to receive content,
    37  use this to access it as a `char *` pointer.
    38  */
    39 - (char *)charPointer;
    40 
    41 @end