Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 58 lines (46 sloc) 1.541 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
//
// GBProtocolData.m
// appledoc
//
// Created by Tomaz Kragelj on 26.7.10.
// Copyright (C) 2010, Gentle Bytes. All rights reserved.
//

#import "GBDataObjects.h"
#import "GBProtocolData.h"

@implementation GBProtocolData

#pragma mark Initialization & disposal

+ (id)protocolDataWithName:(NSString *)name {
return [[[self alloc] initWithName:name] autorelease];
}

- (id)initWithName:(NSString *)name {
NSParameterAssert(name != nil && [name length] > 0);
GBLogDebug(@"Initializing protocol with name %@...", name);
self = [super init];
if (self) {
_protocolName = [name copy];
_adoptedProtocols = [[GBAdoptedProtocolsProvider alloc] initWithParentObject:self];
_methods = [[GBMethodsProvider alloc] initWithParentObject:self];
}
return self;
}

#pragma mark Overriden methods

- (void)mergeDataFromObject:(id)source {
if (!source || source == self) return;
GBLogDebug(@"%@: Merging data from %@...", self, source);
NSParameterAssert([[source nameOfProtocol] isEqualToString:self.nameOfProtocol]);
[super mergeDataFromObject:source];
GBProtocolData *sourceProtocol = (GBProtocolData *)source;
[self.adoptedProtocols mergeDataFromProtocolsProvider:sourceProtocol.adoptedProtocols];
[self.methods mergeDataFromMethodsProvider:sourceProtocol.methods];
}

- (NSString *)description {
return self.nameOfProtocol;
}

- (BOOL)isTopLevelObject {
return YES;
}

#pragma mark Properties

@synthesize nameOfProtocol = _protocolName;
@synthesize adoptedProtocols = _adoptedProtocols;
@synthesize methods = _methods;

@end
Something went wrong with that request. Please try again.