1/*! 2 * @header OC_PythonString.h 3 * @abstract Objective-C proxy class for Python str 4 * @discussion 5 * This file defines the class that is used to represent Python str 6 * in Objective-C. 7 */ 8 9#include "pyobjc.h" 10 11/*! 12 * @class OC_PythonString 13 * @abstract Objective-C proxy class for Python str 14 * @discussion Instances of this class are used as proxies for Python 15 * str when these are passed to Objective-C code. 16 */ 17@interface OC_PythonString : NSString 18{ 19 PyObject* value; 20 id realObject; 21} 22 23/*! 24 * @method newWithPythonObject: 25 * @abstract Create a new OC_PythonString for a specific Python str 26 * @param value A python str 27 * @result Returns an autoreleased instance representing value 28 * 29 * Caller must own the GIL. 30 */ 31+ newWithPythonObject:(PyObject*)value; 32 33/*! 34 * @method initWithPythonObject: 35 * @abstract Initialise a OC_PythonString for a specific Python str 36 * @param value A python str 37 * @result Returns self 38 * 39 * Caller must own the GIL. 40 */ 41- initWithPythonObject:(PyObject*)value; 42 43/*! 44 * @method dealloc 45 * @abstract Deallocate the object 46 */ 47-(void)dealloc; 48 49/*! 50 * @abstract Access the wrapped Python str 51 * @result Returns a new reference to the wrapped Python str. 52 */ 53-(PyObject*)__pyobjc_PythonObject__; 54 55/*! 56 * @abstract Access the NSString* representing the str 57 * @result Returns a backing NSString* object 58 */ 59-(id)__realObject__; 60 61/* 62 * Primitive NSString methods 63 * 64 */ 65-(NSUInteger)length; 66-(unichar)characterAtIndex:(NSUInteger)index; 67-(void)getCharacters:(unichar *)buffer range:(NSRange)aRange; 68 69@end 70