當前位置: 首頁>>代碼示例>>Golang>>正文


Golang persist.LoadSaver類代碼示例

本文整理匯總了Golang中github.com/richardlehane/siegfried/internal/persist.LoadSaver的典型用法代碼示例。如果您正苦於以下問題:Golang LoadSaver類的具體用法?Golang LoadSaver怎麽用?Golang LoadSaver使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了LoadSaver類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: loadWildMin

func loadWildMin(ls *persist.LoadSaver) Frame {
	return WildMin{
		OffType(ls.LoadByte()),
		ls.LoadInt(),
		patterns.Load(ls),
	}
}
開發者ID:richardlehane,項目名稱:siegfried,代碼行數:7,代碼來源:frames.go

示例2: Save

func Save(c core.Matcher, ls *persist.LoadSaver) {
	if c == nil {
		ls.SaveSmallInt(0)
		return
	}
	ls.SaveSmallInt(int(*c.(*Matcher)))
}
開發者ID:richardlehane,項目名稱:siegfried,代碼行數:7,代碼來源:textmatcher.go

示例3: Save

// Save persists the pattern.
func (c Choice) Save(ls *persist.LoadSaver) {
	ls.SaveByte(choiceLoader)
	ls.SaveSmallInt(len(c))
	for _, pat := range c {
		pat.Save(ls)
	}
}
開發者ID:richardlehane,項目名稱:siegfried,代碼行數:8,代碼來源:patterns.go

示例4: loadFixed

func loadFixed(ls *persist.LoadSaver) Frame {
	return Fixed{
		OffType(ls.LoadByte()),
		ls.LoadInt(),
		patterns.Load(ls),
	}
}
開發者ID:richardlehane,項目名稱:siegfried,代碼行數:7,代碼來源:frames.go

示例5: save

func (fs *frameSet) save(ls *persist.LoadSaver) {
	ls.SaveSmallInt(len(fs.set))
	for _, f := range fs.set {
		f.Save(ls)
	}
	ls.SaveInts(fs.testTreeIndex)
}
開發者ID:richardlehane,項目名稱:siegfried,代碼行數:7,代碼來源:sets.go

示例6: loadBMH

func loadBMH(ls *persist.LoadSaver) Pattern {
	bmh := &BMHSequence{}
	bmh.Seq = Sequence(ls.LoadBytes())
	for i := range bmh.Shift {
		bmh.Shift[i] = ls.LoadSmallInt()
	}
	return bmh
}
開發者ID:richardlehane,項目名稱:siegfried,代碼行數:8,代碼來源:bmh.go

示例7: saveTestNodes

func saveTestNodes(ls *persist.LoadSaver, tns []*testNode) {
	ls.SaveSmallInt(len(tns))
	for _, n := range tns {
		n.Frame.Save(ls)
		ls.SaveInts(n.success)
		saveTestNodes(ls, n.tests)
	}
}
開發者ID:richardlehane,項目名稱:siegfried,代碼行數:8,代碼來源:testTrees.go

示例8: loadRBMH

func loadRBMH(ls *persist.LoadSaver) Pattern {
	rbmh := &RBMHSequence{}
	rbmh.Seq = Sequence(ls.LoadBytes())
	for i := range rbmh.Shift {
		rbmh.Shift[i] = ls.LoadSmallInt()
	}
	return rbmh
}
開發者ID:richardlehane,項目名稱:siegfried,代碼行數:8,代碼來源:bmh.go

示例9: loadList

func loadList(ls *persist.LoadSaver) Pattern {
	le := ls.LoadSmallInt()
	list := make(List, le)
	for i := range list {
		list[i] = Load(ls)
	}
	return list
}
開發者ID:richardlehane,項目名稱:siegfried,代碼行數:8,代碼來源:patterns.go

示例10: loadChoice

func loadChoice(ls *persist.LoadSaver) Pattern {
	l := ls.LoadSmallInt()
	choices := make(Choice, l)
	for i := range choices {
		choices[i] = Load(ls)
	}
	return choices
}
開發者ID:richardlehane,項目名稱:siegfried,代碼行數:8,代碼來源:patterns.go

示例11: Save

func (i *Identifier) Save(ls *persist.LoadSaver) {
	ls.SaveByte(core.LOC)
	ls.SaveSmallInt(len(i.infos))
	for k, v := range i.infos {
		ls.SaveString(k)
		ls.SaveString(v.name)
		ls.SaveString(v.longName)
		ls.SaveString(v.mimeType)
	}
	i.Base.Save(ls)
}
開發者ID:richardlehane,項目名稱:siegfried,代碼行數:11,代碼來源:identifier.go

示例12: Load

// Load loads the Pattern, choosing the correct Loader by the leading id byte.
func Load(ls *persist.LoadSaver) Pattern {
	id := ls.LoadByte()
	l := loaders[int(id)]
	if l == nil {
		if ls.Err == nil {
			ls.Err = errors.New("bad pattern loader")
		}
		return nil
	}
	return l(ls)
}
開發者ID:richardlehane,項目名稱:siegfried,代碼行數:12,代碼來源:patterns.go

示例13: LoadIdentifier

// LoadIdentifier applies the appropriate IdentifierLoader to load an identifier.
func LoadIdentifier(ls *persist.LoadSaver) Identifier {
	id := ls.LoadByte()
	l := loaders[int(id)]
	if l == nil {
		if ls.Err == nil {
			ls.Err = errors.New("bad identifier loader")
		}
		return nil
	}
	return l(ls)
}
開發者ID:richardlehane,項目名稱:siegfried,代碼行數:12,代碼來源:core.go

示例14: Load

func Load(ls *persist.LoadSaver) core.Matcher {
	if !ls.LoadBool() {
		return nil
	}
	ret := make(Matcher, ls.LoadTinyUInt())
	for i := range ret {
		ret[i] = loadCM(ls)
		ret[i].ctype = ctypes[ret[i].conType]
		ret[i].entryBufs = siegreader.New()
	}
	return ret
}
開發者ID:richardlehane,項目名稱:siegfried,代碼行數:12,代碼來源:container.go

示例15: Save

func Save(c core.Matcher, ls *persist.LoadSaver) {
	if c == nil {
		ls.SaveSmallInt(0)
		return
	}
	m := c.(Matcher)
	ls.SaveSmallInt(len(m))
	for k, v := range m {
		ls.SaveString(k)
		ls.SaveSmallInt(len(v))
		for _, w := range v {
			ls.SaveSmallInt(w)
		}
	}
}
開發者ID:richardlehane,項目名稱:siegfried,代碼行數:15,代碼來源:mimematcher.go


注:本文中的github.com/richardlehane/siegfried/internal/persist.LoadSaver類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。