From f4f150f28b9633a980cd0e11a8fca23c2f60e3d7 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Sun, 1 Nov 2015 22:31:12 -0800 Subject: Makes GRPCRequestHeaders a NSMutableDictionary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TODO: - Documentation - Make public - Check I’ve implemented all NSMutDict required methods --- src/objective-c/GRPCClient/GRPCCall.h | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'src/objective-c/GRPCClient/GRPCCall.h') diff --git a/src/objective-c/GRPCClient/GRPCCall.h b/src/objective-c/GRPCClient/GRPCCall.h index 5918f8857a..48c026a86e 100644 --- a/src/objective-c/GRPCClient/GRPCCall.h +++ b/src/objective-c/GRPCClient/GRPCCall.h @@ -161,6 +161,9 @@ extern id const kGRPCTrailersKey; #pragma mark GRPCCall +/** Represents a single gRPC remote call. */ +@interface GRPCCall : GRXWriter + /** * The container of the request headers of an RPC conforms to this protocol, which is a subset of * NSMutableDictionary's interface. It will become a NSMutableDictionary later on. @@ -170,21 +173,6 @@ extern id const kGRPCTrailersKey; * A header value is a NSString object (with only ASCII characters), unless the header name has the * suffix "-bin", in which case the value has to be a NSData object. */ -@protocol GRPCRequestHeaders - -@property(nonatomic, readonly) NSUInteger count; - -- (id)objectForKeyedSubscript:(NSString *)key; -- (void)setObject:(id)obj forKeyedSubscript:(NSString *)key; - -- (void)removeAllObjects; -- (void)removeObjectForKey:(NSString *)key; - -@end - -/** Represents a single gRPC remote call. */ -@interface GRPCCall : GRXWriter - /** * These HTTP headers will be passed to the server as part of this call. Each HTTP header is a * name-value pair with string names and either string or binary values. @@ -200,7 +188,7 @@ extern id const kGRPCTrailersKey; * * The property is initialized to an empty NSMutableDictionary. */ -@property(atomic, readonly) id requestHeaders; +@property(atomic, readonly) NSMutableDictionary *requestHeaders; /** * This dictionary is populated with the HTTP headers received from the server. This happens before -- cgit v1.2.3 From e1f74454ac210b4896d9e53463c1849ca9b4193a Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Tue, 3 Nov 2015 18:30:50 -0800 Subject: Add the protocol back for backward compatibility. --- src/objective-c/GRPCClient/GRPCCall.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/objective-c/GRPCClient/GRPCCall.h') diff --git a/src/objective-c/GRPCClient/GRPCCall.h b/src/objective-c/GRPCClient/GRPCCall.h index 48c026a86e..2a6ae5cedc 100644 --- a/src/objective-c/GRPCClient/GRPCCall.h +++ b/src/objective-c/GRPCClient/GRPCCall.h @@ -231,3 +231,20 @@ extern id const kGRPCTrailersKey; // TODO(jcanizales): Let specify a deadline. As a category of GRXWriter? @end + +#pragma mark Backwards compatibiity + +/** This protocol is kept for backwards compatibility with existing code. */ +@protocol GRPCRequestHeaders +@property(nonatomic, readonly) NSUInteger count; + +- (id)objectForKeyedSubscript:(NSString *)key; +- (void)setObject:(id)obj forKeyedSubscript:(NSString *)key; + +- (void)removeAllObjects; +- (void)removeObjectForKey:(NSString *)key; +@end + +/** This is only needed for backwards-compatibility. */ +@interface NSMutableDictionary (GRPCRequestHeaders) +@end -- cgit v1.2.3 From 35768db8c95f4be55324c61b7b6b3b55a5d589e9 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Thu, 3 Dec 2015 23:15:09 -0800 Subject: Mark the GRPCRequestHeaders protocol deprecated --- src/objective-c/GRPCClient/GRPCCall.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/objective-c/GRPCClient/GRPCCall.h') diff --git a/src/objective-c/GRPCClient/GRPCCall.h b/src/objective-c/GRPCClient/GRPCCall.h index 2a6ae5cedc..c9fda42855 100644 --- a/src/objective-c/GRPCClient/GRPCCall.h +++ b/src/objective-c/GRPCClient/GRPCCall.h @@ -50,6 +50,8 @@ #import #import +#include + #pragma mark gRPC errors /** Domain of NSError objects produced by gRPC. */ @@ -235,6 +237,7 @@ extern id const kGRPCTrailersKey; #pragma mark Backwards compatibiity /** This protocol is kept for backwards compatibility with existing code. */ +DEPRECATED_MSG_ATTRIBUTE("Use NSDictionary or NSMutableDictionary instead.") @protocol GRPCRequestHeaders @property(nonatomic, readonly) NSUInteger count; @@ -245,6 +248,9 @@ extern id const kGRPCTrailersKey; - (void)removeObjectForKey:(NSString *)key; @end +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" /** This is only needed for backwards-compatibility. */ @interface NSMutableDictionary (GRPCRequestHeaders) @end +#pragma clang diagnostic pop -- cgit v1.2.3