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