aboutsummaryrefslogtreecommitdiff
path: root/objectivec/GPBWellKnownTypes.m
diff options
context:
space:
mode:
authorThomas Van Lenten <thomasvl@google.com>2015-08-11 16:20:39 -0400
committerThomas Van Lenten <thomasvl@google.com>2015-08-11 16:22:47 -0400
commit1c33d34e3496fa2d0c852ac99c444d44c09e432a (patch)
tree71456ab688e4d262bdbd8c7c6f1554d04b45d856 /objectivec/GPBWellKnownTypes.m
parent63778e537a82d91c6bced5999a7e85b0f41b90b1 (diff)
downloadprotobuf-1c33d34e3496fa2d0c852ac99c444d44c09e432a.tar.gz
protobuf-1c33d34e3496fa2d0c852ac99c444d44c09e432a.tar.bz2
protobuf-1c33d34e3496fa2d0c852ac99c444d44c09e432a.zip
Revert "Add packFrom, unpackTo and is in google.protobuf.Any."
This reverts commit 7366efd81e7f36108aa35e66fca61da8a65762c2. Still some discussion about the api to expose the helpers with.
Diffstat (limited to 'objectivec/GPBWellKnownTypes.m')
-rw-r--r--objectivec/GPBWellKnownTypes.m49
1 files changed, 0 insertions, 49 deletions
diff --git a/objectivec/GPBWellKnownTypes.m b/objectivec/GPBWellKnownTypes.m
index 8cd6f754..fe02f5de 100644
--- a/objectivec/GPBWellKnownTypes.m
+++ b/objectivec/GPBWellKnownTypes.m
@@ -115,52 +115,3 @@ static int32_t SecondsAndNanosFromTimeIntervalSince1970(NSTimeInterval time,
}
@end
-
-NSString *const GPBTypeGoogleApisComPrefix = @"type.googleapis.com/";
-
-@implementation GPBAny (GBPWellKnownTypes)
-
-- (instancetype)initWithMessage:(GPBMessage*)message {
- self = [super init];
- if (self) {
- [self setMessage:message];
- }
- return self;
-}
-
-- (NSString*)typeName {
- NSAssert([self.typeURL hasPrefix:GPBTypeGoogleApisComPrefix],
- @"Invalid any type url (%@).", self.typeURL);
- if (![self.typeURL hasPrefix:GPBTypeGoogleApisComPrefix]) {
- return nil;
- }
- return [self.typeURL substringFromIndex:[GPBTypeGoogleApisComPrefix length]];
-}
-
-- (void)setMessage:(GPBMessage*)message {
- self.typeURL = [GPBTypeGoogleApisComPrefix stringByAppendingString:message.descriptor.name];
- self.value = message.data;
-}
-
-- (GPBMessage*)messageOfClass:(Class)messageClass {
- if ([self wrapsMessageOfClass:messageClass]) {
- GPBMessage* message = [messageClass message];
- [message mergeFromData:self.value extensionRegistry:nil];
- return message;
- } else {
- return nil;
- }
-}
-
-- (BOOL)wrapsMessageOfClass:(Class)messageClass {
- NSAssert([messageClass isSubclassOfClass:[GPBMessage class]],
- @"Given class (%@) is not a subclass of GPBMessage",
- [messageClass name]);
- if (![messageClass isSubclassOfClass:[GPBMessage class]]) {
- return NO;
- }
- return [[self typeName] isEqualToString:messageClass.descriptor.name];
-}
-
-@end
-