GITObject Class Reference

#import <GITObject.h>

Inherited by GITBlob, GITCommit, GITTag, and GITTree.

List of all members.

Public Member Functions

(id) - init
(id) - initWithSha1:repo:
(id) - initWithSha1:data:repo:
(id) - initType:sha1:size:repo:
(id) - copyWithZone:
(NSData *) - rawData
(NSData *) - rawContent

Static Public Member Functions

(NSString *) + typeName
(GITObjectType+ objectTypeForString:

Properties

GITReporepo
 Repository the object belongs to.
NSString * sha1
 The SHA1 identifier of the object.
NSString * type
 The blob/commit/tag/tree type.
NSUInteger size
 Size of the content of the object.


Detailed Description

Abstract base class for the git objects

Member Function Documentation

- (id) copyWithZone: (NSZone*)  zone  

Returns a new instance that's a copy of the receiver. Children should call this implementation first when overriding it as this will init the fields of the base object first. Children can then add to the copied object any further content which is required.

Here is an example implementation for a child defining a blob object

 - (id)copyWithZone:(NSZone*)zone
 {
     MyBlob * blob = (MyBlob*)[super copyWithZone:zone];
     blob.data = self.data;
     return blob;
 }
Attention:
This is a concrete method.
Parameters:
zone The zone identifies an area of memory from which to allocate for the new instance. If zone is NULL, the new instance is allocated from the default zone, which is returned from the function NSDefaultMallocZone.
Returns:
A new instance that's a copy of the receiver.

- (id) init  

Raises a doesNotRecognizeSelector error to enforce the use of the correct initialiser.

- (id) initType: (NSString*)  newType
sha1: (NSString*)  newSha1
size: (NSUInteger)  newSize
repo: (GITRepo*)  theRepo 

Creates and returns a new git object. This method is intended to be called only by children of this class in their own initialisers. Where they would normally do

 if (self = [super init])
they will instead do (assuming a blob in this instance)
 if (self = [super initType:@"blob" sha:theSHA1
                       size:objectSize repo:theRepo])
and this will setup the common fields for each object type.

Attention:
This is a concrete method.
Parameters:
newType The type blob/commit/tag/tree of the object
newSha1 The SHA hash of the object
newSize The size of the object
theRepo The repo to which this object belongs
Returns:
New git object.

- (id) initWithSha1: (NSString*)  sha1
data: (NSData*)  data
repo: (GITRepo*)  repo 

Creates and returns a new git object with the given sha1 composed of the given data in the repo.

This initialiser is usually called from -initWithSha1:repo: once it has obtained the raw data for the object.

This initialiser does most of the heavy-lifting for the individual child object types.

Attention:
This is an abstract method.
Parameters:
sha1 The hash of the object
data The raw data of the object
repo The repo the object belongs to
Returns:
A new git object with the given sha1 composed of the given data in the repo
Todo:
Add an error: param to this initialiser

- (id) initWithSha1: (NSString*)  sha1
repo: (GITRepo*)  repo 

Creates and returns a new git object for the given sha1 in the repo.

This initialiser requests the object data from the repo and then creates the object from the returned data.

This the most common initialiser to use to load a type of git object.

Attention:
This is a concrete method.
Parameters:
sha1 The hash of the object to load
repo The repository to load the object from
Returns:
A new git object for the given sha1 in the repo
Todo:
Add an error: param to this initialiser

+ (GITObjectType) objectTypeForString: (NSString*)  type  

Returns the enum type value for the type string

Parameters:
type String to return the corresponding object type for
Returns:
Object type which corresponds to the type passed

- (NSData *) rawContent  

Returns the raw content of the object.

Attention:
This is an abstract method.
See also:
- rawData
Returns:
Raw content of the object

- (NSData *) rawData  

Returns the raw data of the object.

Attention:
This is a concrete method.
See also:
- rawContent
Returns:
Raw data of the object

+ (NSString *) typeName  

Returns the string name of the type.


Property Documentation

- (GITRepo *) repo [read, retain]

Repository the object belongs to.

- (NSString *) sha1 [read, copy]

The SHA1 identifier of the object.

- (NSUInteger) size [read, assign]

Size of the content of the object.

- (NSString *) type [read, copy]

The blob/commit/tag/tree type.


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

Generated on Mon Dec 8 22:57:08 2008 for CocoaGit by  doxygen 1.5.7