1/* Copyright (c) 1996,97 by Lele Gaifax. All Rights Reserved 2 * Copyright (c) 2002,2003 Ronald Oussoren. 3 * 4 * This software may be used and distributed freely for any purpose 5 * provided that this notice is included unchanged on any and all 6 * copies. The author does not warrant or guarantee this software in 7 * any way. 8 * 9 * This file is part of the PyObjC package. 10 * 11 * RCSfile: OC_PythonObject.h,v 12 * Revision: 1.16 13 * Date: 1998/08/18 15:35:51 14 * 15 * Created Wed Sep 4 18:36:15 1996. 16 * 17 * NOTE: This used to be an ObjC translation of 'Python/abstract.h', most of 18 * that was removed by Ronald because no-one was using or maintaining 19 * that functionality. OC_PythonObject is now a simple proxy for plain 20 * python objects. 21 * 22 */ 23 24#ifndef _OC_PythonObject_H 25#define _OC_PythonObject_H 26 27#import <Foundation/NSProxy.h> 28#import <Foundation/NSDictionary.h> 29#import <Foundation/NSMethodSignature.h> 30 31extern PyObject* PyObjC_Encoder; 32extern PyObject* PyObjC_Decoder; 33extern PyObject* PyObjC_CopyFunc; 34 35extern void PyObjC_encodeWithCoder(PyObject* pyObject, NSCoder* coder); 36 37 38 39 40@interface OC_PythonObject : NSProxy <NSCopying> 41{ 42 PyObject *pyObject; 43} 44 45+ (int)wrapPyObject:(PyObject *)argument toId:(id *)datum; 46+ newWithObject:(PyObject *) obj; 47+ depythonifyTable; 48+ pythonifyStructTable; 49+ (PyObject *)__pythonifyStruct:(PyObject *) obj withType:(const char *) type length:(Py_ssize_t) length; 50+ newWithCoercedObject:(PyObject *) obj; 51- initWithObject:(PyObject *) obj; 52 53/*! 54 * @method pyObject 55 * @result Returns a borrowed reference to the wrapped object 56 */ 57- (PyObject*) pyObject; 58 59/*! 60 * @method __pyobjc_PythonObject__ 61 * @result Returns a new reference to the wrapped object 62 * @discussion 63 * This method is part of the implementation of objc_support.m, 64 * see that file for details. 65 */ 66- (PyObject*) __pyobjc_PythonObject__; 67- (void) forwardInvocation:(NSInvocation *) invocation; 68- (BOOL) respondsToSelector:(SEL) aSelector; 69- (NSMethodSignature *) methodSignatureForSelector:(SEL) selector; 70- (void) doesNotRecognizeSelector:(SEL) aSelector; 71 72/* NSObject protocol */ 73- (unsigned)hash; 74- (BOOL)isEqual:(id)anObject; 75/* NSObject methods */ 76- (NSComparisonResult)compare:(id)other; 77 78/* Key-Value Coding support */ 79+ (BOOL)useStoredAccessor; 80+ (BOOL)accessInstanceVariablesDirectly; 81- valueForKey:(NSString*) key; 82- (NSDictionary*) valuesForKeys: (NSArray*)keys; 83- valueForKeyPath: (NSString*) keyPath; 84- storedValueForKey: (NSString*) key; 85- (void)takeValue: value forKey: (NSString*) key; 86- (void)setValue: value forKey: (NSString*) key; 87- (void)setValue: value forKeyPath: (NSString*) key; 88- (void)takeStoredValue: value forKey: (NSString*) key; 89- (void)takeValue: value forKeyPath: (NSString*) keyPath; 90- (void)takeValuesFromDictionary: (NSDictionary*) aDictionary; 91- (void)setValuesForKeysWithDictionary: (NSDictionary*) aDictionary; 92- (void)unableToSetNilForKey: (NSString*) key; 93- (void)valueForUndefinedKey: (NSString*) key; 94- (void)handleTakeValue: value forUnboundKey: (NSString*) key; 95- (void)setValue: value forUndefinedKey: (NSString*) key; 96 97/* These two are only present to *disable* coding, not implement it */ 98- (void)encodeWithCoder:(NSCoder*)coder; 99- initWithCoder:(NSCoder*)coder; 100+classFallbacksForKeyedArchiver; 101-(NSObject*)replacementObjectForArchiver:(NSObject*)archiver; 102-(NSObject*)replacementObjectForKeyedArchiver:(NSObject*)archiver; 103-(NSObject*)replacementObjectForCoder:(NSObject*)archiver; 104-(NSObject*)replacementObjectForPortCoder:(NSObject*)archiver; 105-(Class)classForArchiver; 106-(Class)classForKeyedArchiver; 107+(Class)classForUnarchiver; 108+(Class)classForKeyedUnarchiver; 109-(Class)classForCoder; 110-(Class)classForPortCoder; 111-(id)awakeAfterUsingCoder:(NSCoder*)coder; 112 113@end /* OC_PythonObject class interface */ 114 115#endif /* _OC_PythonObject_H */ 116