Example #1
0
// Save persists the pattern.
func (s *RBMHSequence) Save(ls *persist.LoadSaver) {
	ls.SaveByte(rbmhLoader)
	ls.SaveBytes(s.Seq)
	for _, v := range s.Shift {
		ls.SaveSmallInt(v)
	}
}
Example #2
0
func (ss *seqSet) save(ls *persist.LoadSaver) {
	ls.SaveSmallInt(len(ss.set))
	for _, v := range ss.set {
		ls.SaveBigInts(v.MaxOffsets)
		ls.SaveSmallInt(len(v.Choices))
		for _, w := range v.Choices {
			ls.SaveSmallInt(len(w))
			for _, x := range w {
				ls.SaveBytes(x)
			}
		}
	}
	ls.SaveInts(ss.testTreeIndex)
}
Example #3
0
// Save persists the pattern.
func (s Sequence) Save(ls *persist.LoadSaver) {
	ls.SaveByte(sequenceLoader)
	ls.SaveBytes(s)
}
Example #4
0
func (r Range) Save(ls *persist.LoadSaver) {
	ls.SaveByte(rangeLoader)
	ls.SaveBytes(r.From)
	ls.SaveBytes(r.To)
}
Example #5
0
// Save persists the pattern.
func (m Mask) Save(ls *persist.LoadSaver) {
	ls.SaveByte(maskLoader)
	m.pat.Save(ls)
	ls.SaveBytes(m.val)
}
Example #6
0
// Save persists the pattern.
func (c IgnoreCase) Save(ls *persist.LoadSaver) {
	ls.SaveByte(ignoreCaseLoader)
	ls.SaveBytes(c)
}
Example #7
0
// Save persists the pattern.
func (n Host32) Save(ls *persist.LoadSaver) {
	ls.SaveByte(host32Loader)
	buf := make([]byte, 4)
	binary.LittleEndian.PutUint32(buf, uint32(n))
	ls.SaveBytes(buf)
}
Example #8
0
// Save persists the pattern.
func (n Host16) Save(ls *persist.LoadSaver) {
	ls.SaveByte(host16Loader)
	buf := make([]byte, 2)
	binary.LittleEndian.PutUint16(buf, uint16(n))
	ls.SaveBytes(buf)
}
Example #9
0
// Save persists the pattern.
func (n Big32) Save(ls *persist.LoadSaver) {
	ls.SaveByte(big32Loader)
	buf := make([]byte, 4)
	binary.BigEndian.PutUint32(buf, uint32(n))
	ls.SaveBytes(buf)
}
Example #10
0
// Save persists the pattern.
func (n Big16) Save(ls *persist.LoadSaver) {
	ls.SaveByte(big16Loader)
	buf := make([]byte, 2)
	binary.BigEndian.PutUint16(buf, uint16(n))
	ls.SaveBytes(buf)
}