Cface__Libgit2Mapping.st
changeset 30 00a634ebfc34
parent 29 91d5e0a30fa4
child 31 e79ba7cdb57c
--- a/Cface__Libgit2Mapping.st	Mon Sep 17 20:24:44 2012 +0000
+++ b/Cface__Libgit2Mapping.st	Wed Sep 19 18:08:33 2012 +0000
@@ -4,12 +4,28 @@
 
 TypeMapping subclass:#Libgit2Mapping
 	instanceVariableNames:''
-	classVariableNames:''
+	classVariableNames:'TypeNameMap'
 	poolDictionaries:''
 	category:'Cface-Mappings'
 !
 
 
+!Libgit2Mapping class methodsFor:'initialization'!
+
+initialize
+    "Invoked at system start or when the class is dynamically loaded."
+
+    "/ please change as required (and remove this comment)
+
+    TypeNameMap := Dictionary withKeysAndValues: #(
+        'git_checkout_opts'     GitCheckoutOptions
+        'git_otype'             GitObjectType
+        'git_error_t'           GitErrorKlass
+    ).
+
+    "Modified: / 19-09-2012 / 18:32:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !Libgit2Mapping methodsFor:'accessing'!
 
 smalltalkNameForEnumValue:cEnumFieldType 
@@ -75,13 +91,8 @@
 smalltalkClassNameForEnum:cEnum
 
     | baseName |
-    cEnum cName = 'git_otype' ifTrue:[
-        ^#GitObjectType
-    ].
 
-    cEnum cName = 'git_error_t' ifTrue:[
-        ^#GitErrorKlass
-    ].
+    TypeNameMap at: cEnum cName ifPresent:[:nm|^nm].
 
     baseName := self smalltalkClassNameForDerivedType:cEnum.
     baseName last = $T ifTrue:[
@@ -116,6 +127,8 @@
         cStruct ffiPointerTypeSymbol:#charPointer.
     ].
 
+    TypeNameMap at: cStruct cName ifPresent:[:nm|^nm].
+
     baseName := self smalltalkClassNameForDerivedType:cStruct.
 
     ^ cStruct cByteSize == 0 ifTrue:[
@@ -155,3 +168,5 @@
 version_SVN
     ^ '$Id::                                                                                                                        $'
 ! !
+
+Libgit2Mapping initialize!