Samond Classes Library 1.2.6-STABLE build 219
List of all members
SCRuntimeProtocol Class Reference

Representation of a protocols. More...

#import <SCRuntimeProtocol.h>

+ Inheritance diagram for SCRuntimeProtocol:

Creating and Initializing Protocols

(instancetype) + protocolWithObjCProtocol:
 
(instancetype) + protocolWithName:
 
(instancetype) - initWithObjCProtocol:
 
(instancetype) - initWithName:
 

Quering Protocols

NSString * name
 
(NSArray *) + allProtocols
 
(NSArray *) - adoptedProtocols
 
(BOOL) - conformsToRuntimeProtocol:
 
(BOOL) - conformsToProtocolWithName:
 

Access to Protocol Properties

(NSArray *) - properties
 
(SCRuntimeProperty *) - propertyWithName:required:instance:
 
(BOOL) - containsProperty:required:instance:
 
(BOOL) - containsPropertyWithName:required:instance:
 

Access to Protocol Methods

(NSArray *) - methodsRequired:instance:
 
(NSArray *) - methods
 
(SCRuntimeMethod *) - methodWithSelector:required:instance:
 
(BOOL) - containsMethod:required:instance:
 
(BOOL) - containsMethodWithSelector:required:instance:
 

Comparing Protocols

(BOOL) - isEqualToProtocol:
 
(BOOL) - isEqualToName:
 
(BOOL) - isEqual:
 
(BOOL) - isEqualToObjCProtocol:
 

Communicating with Classes

(BOOL) - addToClass:
 
(BOOL) - conformedClass:
 
(BOOL) - addToUnregisteredClass:
 
(BOOL) - conformedUnregisteredClass:
 

Communicating with Protocols

(void) - addToProtocol:
 

Additional Inherited Members

- Instance Methods inherited from SCObject
(instancetype) - initWithCoder:
 
(instancetype) - initWithContentsOfSerializedFile:
 
(void) - encodeWithCoder:
 
(BOOL) - writeContentsToSerializedFile:
 
(instancetype) - initWithDataDictionary:
 
(instancetype) - initWithDataDictionaryFromFile:
 
(void) - writeToDataDictionary:
 
(void) - writeToDataDictionaryFile:atomically:
 
(void) - writeToDataDictionaryFile:
 
(NSDictionary *) - dataDictionary
 
(instancetype) - initWithStream:
 
(instancetype) - initWithFileStream:
 
(void) - writeToStream:
 
(void) - writeToFileStream:
 
(void) - appendToFileStream:
 
(id) - copyObject
 
(instancetype) - initWithData:
 
(instancetype) - initWithDataWrapper:
 
(instancetype) - initWithContentsOfFile:
 
(instancetype) - initWithContentsOfURL:
 
(instancetype) - initWithContentsOfURLString:
 
(void) - writeToData:
 
(BOOL) - writeToFile:
 
(BOOL) - writeToURL:
 
(BOOL) - writeToURLString:
 
(NSData *) - data
 
- Properties inherited from SCObject
NSString * className
 

Detailed Description

Representation of a protocols.

SDK
macOS 10.6+, iOS 7.0+, GNUstep
Since
version 1.2.6

Provides access to runtime protocols:

Class instances can thrown the following exceptions:

Method Documentation

- (BOOL) addToClass: (Class)  class

Adds the receiving protocol to a given existing class.

Parameters
class- a class
Returns
YES if a protocol was added successfully, otherwise NO
Exceptions
SCRuntimeException- runtime error detected
- (void) addToProtocol: (SCRuntimeUnregisteredProtocol *)  protocol
SDK
macOS 10.6+, iOS 7.0+

Adds the receiving protocol to a given unregistered protocol.

Warning
On GNUstep platform a method was removing all previously added protocols.
Parameters
protocol- an unregistered protocol
Exceptions
SCRuntimeException- runtime error detected
- (BOOL) addToUnregisteredClass: (SCRuntimeUnregisteredClass *)  class

Adds the receiving protocol to a given unregistered class.

Parameters
class- an unregistered class
Returns
YES if a protocol was added successfully, otherwise NO
Exceptions
SCRuntimeException- runtime error detected
- (NSArray *) adoptedProtocols

Returns a list of adopted protocols.

Returns
An array of protocols
+ (NSArray *) allProtocols

Returns a list of all registered protocols.

Returns
An array of protocols
- (BOOL) conformedClass: (Class)  class

Returns a boolean value that indicates whether a given class is conformed to the receiving protocol.

Parameters
class- a class
Returns
YES if a given class is conformed to the receiving protocol, otherwise NO
- (BOOL) conformedUnregisteredClass: (SCRuntimeUnregisteredClass *)  class

Returns a boolean value that indicates whether a given unregistered class is conformed to the receiving protocol.

Parameters
class- an unregistered class
Returns
YES if a given unregistered class is conformed to the receiving protocol, otherwise NO
- (BOOL) conformsToProtocolWithName: (NSString *)  name

Returns a boolean value that indicates whether the receiving protocol conforms to a protocol with a given name.

Parameters
name- a protocol name
Returns
YES if the receiving protocol conforms to a protocol with a given name, otherwise NO
- (BOOL) conformsToRuntimeProtocol: (SCRuntimeProtocol *)  protocol

Returns a boolean value that indicates whether the receiving protocol conforms to a given protocol.

Parameters
protocol- a protocol
Returns
YES if the receiving protocol conforms to a given protocol, otherwise NO
- (BOOL) containsMethod: (SCRuntimeMethod *)  method
required: (BOOL)  required
instance: (BOOL)  instance 

Returns a boolean value that indicates whether the receiving protocol contains a given method.

Parameters
method- a method
required- YES for a required protocol method, NO for an optional protocol method
instance- YES for an instance method, NO for a class method
Returns
YES if the receiving protocol contains a given method, otherwise NO
- (BOOL) containsMethodWithSelector: (SEL)  selector
required: (BOOL)  required
instance: (BOOL)  instance 

Returns a boolean value that indicates whether the receiving protocol contains a method with a given selector.

Parameters
selector- a method selector
required- YES for a required protocol method, NO for an optional protocol method
instance- YES for an instance method, NO for a class method
Returns
YES if the receiving protocol contains a method with a given selector, otherwise NO
- (BOOL) containsProperty: (SCRuntimeProperty *)  property
required: (BOOL)  required
instance: (BOOL)  instance 

Returns a boolean value that indicates whether the receiving protocol contains a given property.

Attention
Class properties are supported only on macOS and iOS platforms. When this method is called on the GNUstep platform, the instance parameter value is ignored and the method always works only with instance properties.
Parameters
property- a property
required- YES for a required protocol property, NO for an optional protocol property
instance- YES for an instance property, NO for a class property (ignored on GNUstep platform)
Returns
YES if the receiving protocol contains a given property, otherwise NO
- (BOOL) containsPropertyWithName: (NSString *)  name
required: (BOOL)  required
instance: (BOOL)  instance 

Returns a boolean value that indicates whether the receiving protocol contains a property with a given name.

Attention
Class properties are supported only on macOS and iOS platforms. When this method is called on the GNUstep platform, the instance parameter value is ignored and the method always works only with instance properties.
Parameters
name- a property name
required- YES for a required protocol property, NO for an optional protocol property
instance- YES for an instance property, NO for a class property (ignored on GNUstep platform)
Returns
YES if the receiving protocol contains a property with a given name, otherwise NO
- (instancetype) initWithName: (NSString *)  name

Initializes a protocol using a given protocol name.

Parameters
name- a protocol name
Returns
A newly initialized protocol

Reimplemented in SCRuntimeUnregisteredProtocol.

- (instancetype) initWithObjCProtocol: (Protocol *)  protocol

Initializes a protocol using a given pointer to existing runtime protocol.

Parameters
protocol- a pointer to runtime protocol
Returns
A newly initialized protocol
- (BOOL) isEqual: (id)  object

Returns a boolean value that indicates whether the receiving protocol is equals to a given object.

Parameters
object- an object with which to compare the receiving protocol
Returns
YES if a given object is equals to the receiving protocol, otherwise NO

Reimplemented from SCObject.

- (BOOL) isEqualToName: (NSString *)  name

Returns a boolean value that indicates whether the receiving protocol is equals to a protocol with a given name.

Parameters
name- a name of protocol with which to compare the receiving protocol
Returns
YES if the protocol with a given name is equals to the receiving protocol, otherwise NO
- (BOOL) isEqualToObjCProtocol: (Protocol *)  protocol

Returns a boolean value that indicates whether the receiving protocol is equals to a pointer to runtime protocol.

Parameters
protocol- a pointer to runtime protocol with which to compare the receiving protocol
Returns
YES if a protocol with a given runtime pointer is equals to the receiving protocol, otherwise NO
- (BOOL) isEqualToProtocol: (SCRuntimeProtocol *)  protocol

Returns a boolean value that indicates whether the receiving protocol is equals to an another given protocol.

Parameters
protocol- the protocol with which to compare the receiving protocol
Returns
YES if the other protocol is equals to the receiving protocol, otherwise NO
- (NSArray *) methods

Returns a list of all protocol methods.

Returns
An array of methods
- (NSArray *) methodsRequired: (BOOL)  required
instance: (BOOL)  instance 

Returns a list of receiving protocol methods with a given flags.

Parameters
required- YES for a required methods, NO for an optional methods
instance- YES for an instance methods, NO for a class methods
Returns
An array of methods
- (SCRuntimeMethod *) methodWithSelector: (SEL)  selector
required: (BOOL)  required
instance: (BOOL)  instance 

Returns a protocol method with a given selector and flags.

Parameters
selector- a method selector
required- YES for a required method, NO for an optional method
instance- YES for an instance method, NO for a class method
Returns
A protocol method with a given selector or nil if a method does not exists in a receving protocol
Exceptions
SCRuntimeException- runtime error detected
- (NSArray *) properties

Returns a list of receiving protocol properties.

Returns
An array of properties
- (SCRuntimeProperty *) propertyWithName: (NSString *)  name
required: (BOOL)  required
instance: (BOOL)  instance 

Returns a receiving protocol property with a given name, required flag and instance flag.

Attention
Class properties are supported only on macOS and iOS platforms. When this method is called on the GNUstep platform, the instance parameter value is ignored and the method always works only with instance properties.
Parameters
name- a property name
required- YES for a required protocol property, NO for an optional protocol property
instance- YES for an instance property, NO for a class property (ignored on GNUstep platform)
Returns
A required property or nil if a receiving protocol does not contain a property with a given name
Exceptions
SCRuntimeException- runtime error detected
+ (instancetype) protocolWithName: (NSString *)  name

Returns a protocol created by using a given protocol name.

Parameters
name- a protocol name
Returns
A created protocol

Reimplemented in SCRuntimeUnregisteredProtocol.

+ (instancetype) protocolWithObjCProtocol: (Protocol *)  protocol

Returns a protocol created by using a given pointer to existing runtime protocol.

Parameters
protocol- a pointer to runtime protocol
Returns
A created protocol

Property Documentation

- (NSString *) name
readnonatomicretain

A protocol name


The documentation for this class was generated from the following files: