pycocoa.runtime.ObjCClass

Package pycocoa :: Module runtime :: Class ObjCClass |
[frames] | no frames]

# Class ObjCClass

              object --+
                       |
    internals._Objectype --+
                           |
                   _ObjCBase --+
                               |
                              ObjCClass

Known Subclasses:
  - ObjCDelegate

Python wrapper for an ObjC class.

Instance Methods
__getattr__(self, name) Returns a callable method object with the given name. |
__str__(self) str(x) |
add_protocol(self, protocol) Add a protocol to this class. |
get_classmethod(self, name) Find a class method. |
get_method(self, name) Find an instance method. |
Inherited from `_ObjCBase`: `__repr__` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__init__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__subclasshook__`

Static Methods
a new object with type S, a subtype of T |
__new__(cls, name_or_ptr, *protocols) Create a new ObjCClass instance or return a previously created instance for the given ObjC class name or ptr. |

Properties
| name Get the ObjC class name (`str`).
| ptr Get the ObjC class (Class_t).
| NS Get the ObjC class (Class_t).
| Type Get the Python Type for this ObjC class (`class` or `None`).
Inherited from `_ObjCBase`: `description` Inherited from `internals._Objectype`: `typename` Inherited from `object`: `__class__`

Method Details

### __new__(cls, name_or_ptr, *protocols) Static Method |
Create a new ObjCClass instance or return a previously created instance for the given ObjC class name or ptr. Parameters: `name_or_ptr` - Either the name of or a pointer to the class to retrieve (`str` or Class_t). `protocols` - `None`, one or more protocol to add (`str`s or Protocol_t instances). Returns: a new object with type S, a subtype of T Overrides: object.__new__

### __str__(self) (Informal representation operator) |
str(x) Overrides: object.__str__ (inherited documentation)

### add_protocol(self, protocol) |
Add a protocol to this class. Parameters: `protocol` - The protocol to add (str or Protocol_t). Returns: True if the protocol was added, False otherwise.

### get_classmethod(self, name) |
Find a class method. Parameters: `name` - Name of the method (`str`). Returns: The class method wrapper (ObjCClassMethod) or None.

### get_method(self, name) |
Find an instance method. Parameters: `name` - Name of the method (`str`). Returns: The instance method wrapper (ObjCMethod) or None.

Property Details

### name Get the ObjC class name (`str`). Get Method: name(self) - Get the ObjC class name (`str`). Set Method: Read_Only(inst, value) - Throws an `AttributeError`, always.

### ptr Get the ObjC class (Class_t). Get Method: ptr(self) - Get the ObjC class (Class_t). Set Method: Read_Only(inst, value) - Throws an `AttributeError`, always.

### NS Get the ObjC class (Class_t). Get Method: ptr(self) - Get the ObjC class (Class_t). Set Method: Read_Only(inst, value) - Throws an `AttributeError`, always.

### Type Get the Python Type for this ObjC class (`class` or `None`). Get Method: Type(self) - Get the Python Type for this ObjC class (`class` or `None`). Set Method: Read_Only(inst, value) - Throws an `AttributeError`, always.