Inherits from NSObject
Declared in GBStore.h
GBStore.m

Overview

Implements the application's in-memory objects data store.

Store handles the storage of in-memory representations of parsed objects and enables a single entry point for later processing.

Tasks

Registrations handling

Data handling

  • – classWithName: Returns the class instance that matches the given name.
  • – categoryWithName: Returns the category instance that matches the given name.
  • – protocolWithName: Returns the protocol instance that matches the given name.
  •   classes The list of all registered classes as instances of GBClassData. property
  •   categories The list of all registered categories and extensions as instances of GBCategoryData. property
  •   protocols The list of all registered protocols as instances of GBProtocolData. property

Helper methods

Properties

categories

The list of all registered categories and extensions as instances of GBCategoryData.

@property (readonly) NSSet *categories

Declared In

GBStore.h

classes

The list of all registered classes as instances of GBClassData.

@property (readonly) NSSet *classes

Declared In

GBStore.h

protocols

The list of all registered protocols as instances of GBProtocolData.

@property (readonly) NSSet *protocols

Declared In

GBStore.h

Instance Methods

categoriesSortedByName

Returns all registered categories sorted by their name.

- (NSArray *)categoriesSortedByName

Declared In

GBStore.h

categoryWithName:

Returns the category instance that matches the given name.

- (GBCategoryData *)categoryWithName:(NSString *)name

Parameters

name
The name of the category to return.

Return Value

Returns category instance or nil if no match is found.

Discussion

If no registered category matches the given name, nil is returned.

Declared In

GBStore.h

classWithName:

Returns the class instance that matches the given name.

- (GBClassData *)classWithName:(NSString *)name

Parameters

name
The name of the class to return.

Return Value

Returns class instance or nil if no match is found.

Discussion

If no registered class matches the given name, nil is returned.

Declared In

GBStore.h

classesSortedByName

Returns all registered classes sorted by their name.

- (NSArray *)classesSortedByName

Declared In

GBStore.h

protocolWithName:

Returns the protocol instance that matches the given name.

- (GBProtocolData *)protocolWithName:(NSString *)name

Parameters

name
The name of the protocol to return.

Return Value

Returns protocol instance or nil if no match is found.

Discussion

If no registered protocol matches the given name, nil is returned.

Declared In

GBStore.h

protocolsSortedByName

Returns all registered protocols sorted by their name.

- (NSArray *)protocolsSortedByName

Declared In

GBStore.h

registerCategory:

Registers the given category to the providers data.

- (void)registerCategory:(GBCategoryData *)category

Parameters

category
The category to register.

Discussion

If provider doesn't yet have the given category instance registered, the object is added to categories list. If the same object is already registered, nothing happens.

Note: If another instance of the category with the same name/class name is registered, an exception is thrown.

Exceptions

NSException
Thrown if the given category is already registered.

Declared In

GBStore.h

registerClass:

Registers the given class to the providers data.

- (void)registerClass:(GBClassData *)class

Parameters

class
The class to register.

Discussion

If provider doesn't yet have the given class instance registered, the object is added to classes list. If the same object is already registered, nothing happens.

Note: If another instance of the class with the same name is registered, an exception is thrown.

Exceptions

NSException
Thrown if the given class is already registered.

Declared In

GBStore.h

registerProtocol:

Registers the given protocol to the providers data.

- (void)registerProtocol:(GBProtocolData *)protocol

Parameters

protocol
The protocol to register.

Discussion

If provider doesn't yet have the given protocol instance registered, the object is added to protocols list. If the same object is already registered, nothing happens.

Note: If another instance of the protocol with the same name name is registered, an exception is thrown.

Exceptions

NSException
Thrown if the given protocol is already registered.

Declared In

GBStore.h

unregisterTopLevelObject:

Unregisters the given class, category or protocol.

- (void)unregisterTopLevelObject:(id)object

Parameters

object
The object to remove.

Discussion

If the object is not part of the store, nothing happens.

Declared In

GBStore.h