From 9f7d0578e52dfc7bb57bd52794cd82b9cb143f6d Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Thu, 22 Aug 2013 14:31:15 +0200 Subject: [PATCH] New: Added the basic protocols CPObject and CPCoding --- AppKit/CPResponder.j | 2 +- Foundation/CPObject.j | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/AppKit/CPResponder.j b/AppKit/CPResponder.j index 1bf73056d..08e3db3ac 100644 --- a/AppKit/CPResponder.j +++ b/AppKit/CPResponder.j @@ -356,7 +356,7 @@ CPDeleteForwardKeyCode = 46; var CPResponderNextResponderKey = @"CPResponderNextResponderKey", CPResponderMenuKey = @"CPResponderMenuKey"; -@implementation CPResponder (CPCoding) +@implementation CPResponder (CPCoding) /*! Initializes the responder with data from a coder. diff --git a/Foundation/CPObject.j b/Foundation/CPObject.j index 72b877c9f..ae5a39ac1 100644 --- a/Foundation/CPObject.j +++ b/Foundation/CPObject.j @@ -67,7 +67,42 @@ CPLog(@"Got some class: %@", inst); @global CPInvalidArgumentException -@implementation CPObject + +@protocol CPObject + +- (BOOL)isEqual:(id)object; +- (CPUInteger)hash; + +- (Class)superclass; +- (Class)class; +- (id)self; + +- (id)performSelector:(SEL)aSelector; +- (id)performSelector:(SEL)aSelector withObject:(id)object; +- (id)performSelector:(SEL)aSelector withObject:(id)object1 withObject:(id)object2; + +- (BOOL)isProxy; + +- (BOOL)isKindOfClass:(Class)aClass; +- (BOOL)isMemberOfClass:(Class)aClass; +- (BOOL)conformsToProtocol:(Protocol)aProtocol; + +- (BOOL)respondsToSelector:(SEL)aSelector; + +- (CPString)description; +@optional +- (CPString)debugDescription; + +@end + +@protocol CPCoding + +- (void)encodeWithCoder:(CPCoder)aCoder; +- (id)initWithCoder:(CPCoder)aDecoder; + +@end + +@implementation CPObject { Class isa; }