func (b *Matcher) Save(ls *persist.LoadSaver) { if b == nil { ls.SaveBool(false) return } ls.SaveBool(true) saveKeyFrames(ls, b.keyFrames) saveTests(ls, b.tests) b.bofFrames.save(ls) b.eofFrames.save(ls) b.bofSeq.save(ls) b.eofSeq.save(ls) ls.SaveInt(b.maxBOF) ls.SaveInt(b.maxEOF) b.priorities.Save(ls) }
func (i *Identifier) Save(ls *persist.LoadSaver) { ls.SaveByte(core.Pronom) ls.SaveString(i.name) ls.SaveString(i.details) ls.SaveBool(i.noPriority) ls.SaveSmallInt(len(i.infos)) for k, v := range i.infos { ls.SaveString(k) ls.SaveString(v.name) ls.SaveString(v.version) ls.SaveString(v.mimeType) } ls.SaveInt(i.eStart) ls.SaveStrings(i.ePuids) ls.SaveInt(i.cStart) ls.SaveStrings(i.cPuids) ls.SaveInt(i.bStart) ls.SaveStrings(i.bPuids) ls.SaveSmallInt(i.tStart) }
func saveTests(ls *persist.LoadSaver, tts []*testTree) { ls.SaveSmallInt(len(tts)) for _, tt := range tts { ls.SaveSmallInt(len(tt.complete)) for _, kfid := range tt.complete { ls.SaveSmallInt(kfid[0]) ls.SaveSmallInt(kfid[1]) } ls.SaveSmallInt(len(tt.incomplete)) for _, fu := range tt.incomplete { ls.SaveSmallInt(fu.kf[0]) ls.SaveSmallInt(fu.kf[1]) ls.SaveBool(fu.l) ls.SaveBool(fu.r) } ls.SaveInt(tt.maxLeftDistance) ls.SaveInt(tt.maxRightDistance) saveTestNodes(ls, tt.left) saveTestNodes(ls, tt.right) } }