git/GitObject.st
author vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
Mon, 10 Sep 2012 10:32:46 +0000
changeset 2 9731a2e41428
parent 1 8f4fde3c7129
child 4 b52b9cfe9b77
permissions -rw-r--r--
- More API methods...

"{ Package: 'stx:libscm/git' }"

GitHandle subclass:#GitObject
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:'GitObjectType'
	category:'Git-Model'
!


!GitObject class methodsFor:'instance creation'!

type: type addressBytes: abytes
    type == OBJ_ANY ifTrue:[
        ^self new setAddressFromBytes: abytes
    ].
    type == OBJ_COMMIT ifTrue:[
        ^GitCommit new setAddressFromBytes: abytes
    ].
    type == OBJ_TREE ifTrue:[
        ^GitTree new setAddressFromBytes: abytes
    ].
    type == OBJ_TAG ifTrue:[
        ^GitTag new setAddressFromBytes: abytes
    ].
    type == OBJ_BLOB ifTrue:[
        ^GitBlob new setAddressFromBytes: abytes
    ].
    self error:'Unsupported git object type: ', type printString.

    "Created: / 10-09-2012 / 11:05:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GitObject class methodsFor:'accessing'!

structSize
    "Returns size of undelaying structure in bytes"

    ^0
! !

!GitObject methodsFor:'finalization'!

basicFree
    ^GitPrimitives prim_git_object_free: self.

    "Created: / 08-09-2012 / 00:21:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GitObject class methodsFor:'documentation'!

version_SVN
    ^ '$Id::                                                                                                                        $'
! !