pEpObjCAdapter/PEPAttachment.m
author Dirk Zimmermann <dz@pep.security>
Fri, 20 Sep 2019 10:01:48 +0200
branchIOSAD-141
changeset 1250 b6a4d30abd26
parent 859 b2ca1a12396c
child 1046 5c889c3d002f
permissions -rw-r--r--
IOSAD-141 Test for "hammering" the engine.
     1 //
     2 //  PEPAttachment.m
     3 //  pEpObjCAdapter
     4 //
     5 //  Created by Dirk Zimmermann on 16.04.18.
     6 //  Copyright © 2018 p≡p. All rights reserved.
     7 //
     8 
     9 #import "PEPAttachment.h"
    10 
    11 #import "bloblist.h"
    12 
    13 @implementation PEPAttachment
    14 
    15 - (instancetype)initWithData:(NSData *)data
    16 {
    17     if (self = [super init]) {
    18         self.data = data;
    19         self.size = data.length;
    20     }
    21     return self;
    22 }
    23 
    24 - (NSString *)description
    25 {
    26     NSMutableString *str =
    27     [NSMutableString
    28      stringWithFormat:@"<PEPAttachment 0x%u %ld bytes, contentDisposition %d",
    29      (uint) self, (long) self.size, self.contentDisposition];
    30 
    31     if (self.mimeType) {
    32         [str appendFormat:@", %@", self.mimeType];
    33     }
    34 
    35     if (self.filename) {
    36         [str appendFormat:@", %@", self.filename];
    37     }
    38 
    39     [str appendString:@">"];
    40     return str;
    41 }
    42 
    43 @end