From de2b44501bf3da0eed83905f44eed75059e9e401 Mon Sep 17 00:00:00 2001 From: "Hoa V. DINH" Date: Mon, 22 Sep 2014 22:13:31 -0700 Subject: Simplified extra headers implementation and content-types parameters --- src/objc/abstract/MCOAbstractPart.h | 12 ++++++++++++ src/objc/abstract/MCOAbstractPart.mm | 20 ++++++++++++++++++++ src/objc/rfc822/MCOAttachment.h | 12 ------------ src/objc/rfc822/MCOAttachment.mm | 19 ------------------- 4 files changed, 32 insertions(+), 31 deletions(-) (limited to 'src/objc') diff --git a/src/objc/abstract/MCOAbstractPart.h b/src/objc/abstract/MCOAbstractPart.h index e30f09bf..30dd8f5f 100644 --- a/src/objc/abstract/MCOAbstractPart.h +++ b/src/objc/abstract/MCOAbstractPart.h @@ -82,6 +82,18 @@ typedef NS_ENUM(NSInteger, MCOPartType) { /** Returns a string representation of the data according to charset.*/ - (NSString *) decodedStringForData:(NSData *)data; +/** Adds a content type parameter.*/ +- (void) setContentTypeParameterValue:(NSString *)value forName:(NSString *)name; + +/** Remove a given content type parameter.*/ +- (void) removeContentTypeParameterForName:(NSString *)name; + +/** Returns the value of a given content type parameter.*/ +- (NSString *) contentTypeParameterValueForName:(NSString *)name; + +/** Returns an array with the names of all content type parameters.*/ +- (NSArray * /* NSString */) allContentTypeParametersNames; + @end #endif diff --git a/src/objc/abstract/MCOAbstractPart.mm b/src/objc/abstract/MCOAbstractPart.mm index d55422d5..8608ec61 100644 --- a/src/objc/abstract/MCOAbstractPart.mm +++ b/src/objc/abstract/MCOAbstractPart.mm @@ -87,4 +87,24 @@ MCO_OBJC_SYNTHESIZE_BOOL(setInlineAttachment, isInlineAttachment) { return [NSString mco_stringWithMCString:MCO_NATIVE_INSTANCE->decodedStringForData([data mco_mcData])]; } + +- (void) setContentTypeParameterValue:(NSString *)value forName:(NSString *)name +{ + MCO_NATIVE_INSTANCE->setContentTypeParameter(MCO_FROM_OBJC(mailcore::String, name), MCO_FROM_OBJC(mailcore::String, value)); +} + +- (NSString *) contentTypeParameterValueForName:(NSString *)name +{ + return MCO_TO_OBJC(MCO_NATIVE_INSTANCE->contentTypeParameterValueForName((MCO_FROM_OBJC(mailcore::String, name)))); +} +- (void) removeContentTypeParameterForName:(NSString *)name +{ + MCO_NATIVE_INSTANCE->removeContentTypeParameter(MCO_FROM_OBJC(mailcore::String, name)); +} + +- (NSArray * /* NSString */) allContentTypeParametersNames +{ + return MCO_TO_OBJC(MCO_NATIVE_INSTANCE->allContentTypeParametersNames()); +} + @end diff --git a/src/objc/rfc822/MCOAttachment.h b/src/objc/rfc822/MCOAttachment.h index 954a825c..eec1bd19 100644 --- a/src/objc/rfc822/MCOAttachment.h +++ b/src/objc/rfc822/MCOAttachment.h @@ -42,18 +42,6 @@ /** Returns string representation according to charset*/ - (NSString *) decodedString; -/** Adds a content type parameter.*/ -- (void) setContentTypeParameterValue:(NSString *)value forName:(NSString *)name; - -/** Remove a given content type parameter.*/ -- (void) removeContentTypeParameterForName:(NSString *)name; - -/** Returns the value of a given content type parameter.*/ -- (NSString *) contentTypeParameterValueForName:(NSString *)name; - -/** Returns an array with the names of all content type parameters.*/ -- (NSArray * /* NSString */) allContentTypeParametersNames; - @end #endif diff --git a/src/objc/rfc822/MCOAttachment.mm b/src/objc/rfc822/MCOAttachment.mm index 18c13693..afaf96af 100644 --- a/src/objc/rfc822/MCOAttachment.mm +++ b/src/objc/rfc822/MCOAttachment.mm @@ -90,23 +90,4 @@ MCO_OBJC_SYNTHESIZE_DATA(setData, data) return [NSString mco_stringWithMCString:result]; } -- (void) setContentTypeParameterValue:(NSString *)value forName:(NSString *)name -{ - MCO_NATIVE_INSTANCE->setContentTypeParameter(MCO_FROM_OBJC(mailcore::String, name), MCO_FROM_OBJC(mailcore::String, value)); -} - -- (NSString *) contentTypeParameterValueForName:(NSString *)name -{ - return MCO_TO_OBJC(MCO_NATIVE_INSTANCE->contentTypeParameterValueForName((MCO_FROM_OBJC(mailcore::String, name)))); -} -- (void) removeContentTypeParameterForName:(NSString *)name -{ - MCO_NATIVE_INSTANCE->removeContentTypeParameter(MCO_FROM_OBJC(mailcore::String, name)); -} - -- (NSArray * /* NSString */) allContentTypeParametersNames -{ - return MCO_TO_OBJC(MCO_NATIVE_INSTANCE->allContentTypeParametersNames()); -} - @end -- cgit v1.2.3