コード例 #1
0
func Load(ls *persist.LoadSaver) core.Matcher {
	if !ls.LoadBool() {
		return nil
	}
	le := ls.LoadSmallInt()
	var ext map[string][]int
	if le > 0 {
		ext = make(map[string][]int)
		for i := 0; i < le; i++ {
			k := ls.LoadString()
			r := make([]int, ls.LoadSmallInt())
			for j := range r {
				r[j] = ls.LoadSmallInt()
			}
			ext[k] = r
		}
	}
	globs := ls.LoadStrings()
	globIdx := make([][]int, ls.LoadSmallInt())
	for i := range globIdx {
		globIdx[i] = ls.LoadInts()
	}
	return &Matcher{
		extensions: ext,
		globs:      globs,
		globIdx:    globIdx,
	}
}
コード例 #2
0
ファイル: container.go プロジェクト: richardlehane/siegfried
func loadCM(ls *persist.LoadSaver) *ContainerMatcher {
	return &ContainerMatcher{
		startIndexes: ls.LoadInts(),
		conType:      containerType(ls.LoadTinyUInt()),
		nameCTest:    loadCTests(ls),
		parts:        ls.LoadInts(),
		priorities:   priority.Load(ls),
		extension:    ls.LoadString(),
	}
}
コード例 #3
0
ファイル: container.go プロジェクト: richardlehane/siegfried
func loadCTests(ls *persist.LoadSaver) map[string]*cTest {
	ret := make(map[string]*cTest)
	l := ls.LoadSmallInt()
	for i := 0; i < l; i++ {
		ret[ls.LoadString()] = &cTest{
			satisfied:   ls.LoadInts(),
			unsatisfied: ls.LoadInts(),
			bm:          bytematcher.Load(ls),
		}
	}
	return ret
}
コード例 #4
0
ファイル: base.go プロジェクト: richardlehane/siegfried
func Load(ls *persist.LoadSaver) *Base {
	return &Base{
		name:       ls.LoadString(),
		details:    ls.LoadString(),
		multi:      config.Multi(ls.LoadTinyInt()),
		zipDefault: ls.LoadBool(),
		gids:       loadIndexes(ls),
		mids:       loadIndexes(ls),
		cids:       loadIndexes(ls),
		xids:       loadIndexes(ls),
		bids:       loadIndexes(ls),
		rids:       loadIndexes(ls),
		tids:       loadIndexes(ls),
	}
}
コード例 #5
0
ファイル: identifier.go プロジェクト: richardlehane/siegfried
func Load(ls *persist.LoadSaver) core.Identifier {
	i := &Identifier{}
	i.infos = make(map[string]formatInfo)
	le := ls.LoadSmallInt()
	for j := 0; j < le; j++ {
		i.infos[ls.LoadString()] = formatInfo{
			ls.LoadString(),
			ls.LoadBool(),
			ls.LoadInts(),
			ls.LoadInts(),
		}
	}
	i.Base = identifier.Load(ls)
	return i
}
コード例 #6
0
ファイル: xmlmatcher.go プロジェクト: richardlehane/siegfried
func Load(ls *persist.LoadSaver) core.Matcher {
	le := ls.LoadSmallInt()
	if le == 0 {
		return nil
	}
	ret := make(Matcher)
	for i := 0; i < le; i++ {
		k := [2]string{ls.LoadString(), ls.LoadString()}
		r := make([]int, ls.LoadSmallInt())
		for j := range r {
			r[j] = ls.LoadSmallInt()
		}
		ret[k] = r
	}
	return ret
}