Skip to content

Instantly share code, notes, and snippets.

@jordanorelli
Created November 2, 2012 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jordanorelli/4003104 to your computer and use it in GitHub Desktop.
Save jordanorelli/4003104 to your computer and use it in GitHub Desktop.
type iStringer interface {
String(int) string
}
type tLibraryBase struct {
tBaseElement
elemCount int
elemName string
stringer func(int) iStringer
}
func (me *tBaseElement) initFromNode(xn *xmlx.Node) {
/* ... */
}
type tVisualSceneDecl struct{}
func newVisualSceneDecl(xn *xmlx.Node) (f *tVisualSceneDecl) {
f = &tVisualSceneDecl{}
return
}
func (me *tVisualSceneDecl) String(indent int) (str string) {
str = ""
return
}
type tVisualSceneInst struct{}
func newVisualSceneInst(xn *xmlx.Node) (f *tVisualSceneInst) {
f = &tVisualSceneInst{}
return
}
type tPhysicsSceneDecl struct{}
func newPhysicsSceneDecl(xn *xmlx.Node) (f *tPhysicsSceneDecl) {
f = &tPhysicsSceneDecl{}
return
}
func (me *tPhysicsSceneDecl) String(indent int) (str string) {
str = ""
return
}
type tPhysicsSceneInst struct{}
func newPhysicsSceneInst(xn *xmlx.Node) (f *tPhysicsSceneInst) {
f = &tPhysicsSceneInst{}
return
}
type tLibraryPhysicsScenes struct {
tLibraryBase
Elements []*tPhysicsSceneDecl
}
func newLibraryPhysicsScenes(xn *xmlx.Node, elemName string) (l *tLibraryPhysicsScenes) {
l = &tLibraryPhysicsScenes{}
c := l.tLibraryBase.initLib(xn, elemName)
l.Elements = make([]*tPhysicsSceneDecl, len(c))
l.tLibraryBase.stringer = func(index int) iStringer { return l.Elements[index] }
for i, n := range c {
l.Elements[i] = newPhysicsSceneDecl(n)
}
return
}
type tLibraryVisualScenes struct {
tLibraryBase
Elements []*tVisualSceneDecl
}
func newLibraryVisualScenes(xn *xmlx.Node, elemName string) (l *tLibraryVisualScenes) {
l = &tLibraryVisualScenes{}
c := l.tLibraryBase.initLib(xn, elemName)
l.Elements = make([]*tVisualSceneDecl, len(c))
l.tLibraryBase.stringer = func(index int) iStringer { return l.Elements[index] }
for i, n := range c {
l.Elements[i] = newVisualSceneDecl(n)
}
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment