]> err.no Git - sope/blob - sope-mime/NGMime/NGMimeMultipartBody.h
new Xcode project
[sope] / sope-mime / NGMime / NGMimeMultipartBody.h
1 /*
2   Copyright (C) 2000-2003 SKYRIX Software AG
3
4   This file is part of OGo
5
6   OGo is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with OGo; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21 // $Id$
22
23 #ifndef __NGMime_NGMimeMultipartBody_H__
24 #define __NGMime_NGMimeMultipartBody_H__
25
26 #import <Foundation/NSObject.h>
27 #include <NGMime/NGPart.h>
28
29 @class NSData, NSString, NSMutableArray;
30
31 /*
32   Represents bodies of multipart entities.
33   Multipart bodies can be parsed 'on-demand'.
34
35   ATTENTION: the delegate is _required_ to persist until the multipart body
36              is parsed ! The body does not retain the delegate.
37 */
38
39 @interface NGMimeMultipartBody : NSObject
40 {
41 @protected
42   id<NGMimePart> part;     /* non-retained */
43   NSString       *prefix;
44   NSString       *suffix;
45   NSMutableArray *bodyParts;
46
47   // for on-demand parsing
48   NSData         *rawData;
49   id             delegate; /* non-retained */
50   
51   struct {
52     BOOL isParsed:1;
53   } flags;
54 }
55
56 - (id)initWithPart:(id<NGMimePart>)_part; // designated initializer
57 - (id)initWithPart:(id<NGMimePart>)_part
58   data:(NSData *)_data
59   delegate:(id)_delegate;
60
61 // accessors
62
63 - (id<NGMimePart>)part; // the part the body belongs to
64
65 - (NSArray *)parts;
66 - (void)addBodyPart:(id<NGPart>)_part;
67 - (void)addBodyPart:(id<NGPart>)_part atIndex:(int)_idx;
68 - (void)removeBodyPart:(id<NGPart>)_part;
69 - (void)removeBodyPartAtIndex:(int)_idx;
70
71 - (void)setPrefix:(NSString *)_prefix;
72 - (NSString *)prefix;
73 - (void)setSuffix:(NSString *)_suffix;
74 - (NSString *)suffix;
75
76 @end
77
78 #endif /* __NGMime_NGMimeMultipartBody_H__ */