#import <GITObject.h>
Inherited by GITBlob, GITCommit, GITTag, and GITTree.
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 | |
| GITRepo * | repo |
| 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. | |
| - (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;
}
| 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. |
| - (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])
| 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 |
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.
| sha1 | The hash of the object | |
| data | The raw data of the object | |
| repo | The repo the object belongs to |
sha1 composed of the given data in the repo | - (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.
| sha1 | The hash of the object to load | |
| repo | The repository to load the object from |
sha1 in the repo | + (GITObjectType) objectTypeForString: | (NSString*) | type |
Returns the enum type value for the type string
| type | String to return the corresponding object type for |
| - (NSData *) rawContent |
Returns the raw content of the object.
| - (NSData *) rawData |
Returns the raw data of the object.
| + (NSString *) typeName |
Returns the string name of the type.
- (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.
1.5.7