NextPrevUpTopContentsIndex

define-objc-class

Macro
Summary

Defines a class and an Objective-C class.

Package

objc

Signature

define-objc-class name ( superclass-name *) ( slot-specifier *) class-option * => name

Arguments

name

A symbol naming the class to define.

superclass-name

A symbol naming a superclass.

slot-specifier

A slot description as used by defclass .

class-option

A class option as used by defclass .

Values

name

A symbol naming the class to define .

Description

The macro define-objc-class defines a standard-class called name which is used to implement an Objective-C class. Normal defclass inheritance rules apply for slots and Lisp methods.

Each superclass-name argument specifies a direct superclass of the new class, which can be another Objective-C implementation class or any other standard-class , provided that standard-objc-object is included somewhere in the overall class precedence list. The class standard-objc-object is the default superclass is no others are specified.

The slot-specifier s are standard defclass slot definitions.

The class-option s are standard defclass class options. In addition the following options are recognized:

(:objc-class-name objc-class-name )

This option makes the Objective-C class name used for instances of name be the string objc-class-name . If none of the classes in the class precedence list of name have a :objc-class-name option then no Objective-C object is created.

(:objc-superclass-name objc-superclass-name )

This option makes the Objective-C superclass name of the Objective-C class defined by the :objc-class-name option be the string objc-superclass-name . If omitted, the objc-superclass-name defaults to the objc-class-name of the first class in the class precedence list that specifies such a name or to "NSObject" if no such class is found. It is an error to specify a objc-superclass-name which is different from the one that would be inherited from a superclass.

(:objc-instance-vars var-spec *)

This options allows Objective-C instance variables to be defined for this class. Each var-spec should be a list of the form

( ivar-name ivar-type )

where ivar-name is a string naming the instance variable and ivar-type is an Objective-C FLI type. The class will automatically contain all the instance variables specified by its superclasses.

(:objc-protocols protocol-name *)

This option allows Objective-C formal protocols to be registered as being implemented by the class. Each protocol-name should be a string naming a previously defined formal protocol (see define-objc-protocol). The class will automatically implement all protocols specified by its superclasses.

Example
See also

standard-objc-object
define-objc-method
define-objc-class-method
define-objc-protocol


LispWorks Objective-C and Cocoa Interface User Guide and Reference Manual - 4 Apr 2005

NextPrevUpTopContentsIndex