/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. // This is a simple class to create a MIME document. To use, allocate
  16. // a new GTMMIMEDocument and start adding parts as necessary. When you are
  17. // done adding parts, call generateInputStream to get an NSInputStream
  18. // containing the contents of your MIME document.
  19. //
  20. // A good reference for MIME is http://en.wikipedia.org/wiki/MIME
  21. #import <Foundation/Foundation.h>
  22. #if defined(GTL_TARGET_NAMESPACE)
  23. // we're using target namespace macros
  24. #import "GTLDefines.h"
  25. #elif defined(GDATA_TARGET_NAMESPACE)
  26. #import "GDataDefines.h"
  27. #endif
  28. @interface GTMMIMEDocument : NSObject {
  29. NSMutableArray* parts_; // Contains an ordered set of MimeParts
  30. unsigned long long length_; // Length in bytes of the document.
  31. u_int32_t randomSeed_; // for testing
  32. }
  33. + (GTMMIMEDocument *)MIMEDocument;
  34. // Adds a new part to this mime document with the given headers and body. The
  35. // headers keys and values should be NSStrings
  36. - (void)addPartWithHeaders:(NSDictionary *)headers
  37. body:(NSData *)body;
  38. // An inputstream that can be used to efficiently read the contents of the
  39. // mime document.
  40. - (void)generateInputStream:(NSInputStream **)outStream
  41. length:(unsigned long long*)outLength
  42. boundary:(NSString **)outBoundary;
  43. // ------ UNIT TESTING ONLY BELOW ------
  44. // For unittesting only, seeds the random number generator
  45. - (void)seedRandomWith:(u_int32_t)seed;
  46. @end