PageRenderTime 19ms CodeModel.GetById 15ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/update-engine/externals/gdata-objectivec-client/Source/HTTPFetcher/GTMMIMEDocument.h

http://macfuse.googlecode.com/
C++ Header | 57 lines | 19 code | 11 blank | 27 comment | 0 complexity | e11e120c6a7331538767896836c202c4 MD5 | raw file
 1/* Copyright (c) 2010 Google Inc.
 2 *
 3 * Licensed under the Apache License, Version 2.0 (the "License");
 4 * you may not use this file except in compliance with the License.
 5 * You may obtain a copy of the License at
 6 *
 7 *     http://www.apache.org/licenses/LICENSE-2.0
 8 *
 9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16
17// This is a simple class to create a MIME document.  To use, allocate
18// a new GTMMIMEDocument and start adding parts as necessary.  When you are
19// done adding parts, call generateInputStream to get an NSInputStream
20// containing the contents of your MIME document.
21//
22// A good reference for MIME is http://en.wikipedia.org/wiki/MIME
23
24#import <Foundation/Foundation.h>
25
26#if defined(GTL_TARGET_NAMESPACE)
27  // we're using target namespace macros
28  #import "GTLDefines.h"
29#elif defined(GDATA_TARGET_NAMESPACE)
30  #import "GDataDefines.h"
31#endif
32
33@interface GTMMIMEDocument : NSObject {
34  NSMutableArray* parts_;         // Contains an ordered set of MimeParts
35  unsigned long long length_;     // Length in bytes of the document.
36  u_int32_t randomSeed_;          // for testing
37}
38
39+ (GTMMIMEDocument *)MIMEDocument;
40
41// Adds a new part to this mime document with the given headers and body.  The
42// headers keys and values should be NSStrings
43- (void)addPartWithHeaders:(NSDictionary *)headers
44                      body:(NSData *)body;
45
46// An inputstream that can be used to efficiently read the contents of the
47// mime document.
48- (void)generateInputStream:(NSInputStream **)outStream
49                     length:(unsigned long long*)outLength
50                   boundary:(NSString **)outBoundary;
51
52// ------ UNIT TESTING ONLY BELOW ------
53
54// For unittesting only, seeds the random number generator
55- (void)seedRandomWith:(u_int32_t)seed;
56
57@end