Name | Type | is_array | initial_value |
//TESH.scrollpos=3
//TESH.alwaysfold=0
//genericList template class
//written by UnholyDecimator
// 12/6/15
//! textmacro genList takes listType, getterName, structName
struct $structName$
$listType$ cur
thistype next
public static method create takes $listType$ r returns thistype
local thistype new
set new = .allocate()
set new.cur = r
set new.next = 0
return new
endmethod
public method get$getterName$ takes nothing returns $listType$
return cur
endmethod
public method isChild takes nothing returns boolean
if (next == 0) then
return false
endif
return true
endmethod
public method attachChild takes $listType$ r returns nothing
set next = thistype.create(r)
endmethod
public method getChild takes nothing returns thistype
if (isChild()) then
return next
endif
return 0
endmethod
public method destroy takes nothing returns nothing
if(isChild()) then
call next.destroy()
endif
set cur = null
set next = 0
call .deallocate()
endmethod
endstruct
//! endtextmacro
//TESH.scrollpos=0
//TESH.alwaysfold=0
//! runtextmacro genList("string", "String", "stringList")