From 9c17b97cd0f83be3fff9fa4e87fd1d29052ea616 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Fri, 4 Feb 2022 00:35:31 -0500 Subject: rename to github.com/pablotron/cvez, remove internal libs --- internal/cpe/avstring.go | 54 ------------------------------------------------ 1 file changed, 54 deletions(-) delete mode 100644 internal/cpe/avstring.go (limited to 'internal/cpe/avstring.go') diff --git a/internal/cpe/avstring.go b/internal/cpe/avstring.go deleted file mode 100644 index 46e16cf..0000000 --- a/internal/cpe/avstring.go +++ /dev/null @@ -1,54 +0,0 @@ -package cpe - -//go:generate stringer -linecomment -type=AvStringType - -import ( - "fmt" -) - -// type of avstring. -type AvStringType byte - -const ( - AnyString AvStringType = iota // any - NaString // na - ValString // val -) - -// String value (NISTIR 7695, CPE 2.3 spec, Figure 6-3) -type AvString struct { - Type AvStringType // value type - Val string // value -} - -// token type to avstring type map -var avTypes = map[tokenType]AvStringType { - anyToken: AnyString, - naToken: NaString, - valToken: ValString, -} - -// create new AvString from token. -func newAvString(t token) (AvString, error) { - if at, ok := avTypes[t.Type]; ok { - return AvString { at, t.Val }, nil - } else { - err := fmt.Errorf("invalid token type: 0x%02x", byte(t.Type)) - return AvString { 0, "" }, err - } -} - -// Serialize as string. -func (s AvString) String() string { - switch s.Type { - case AnyString: - return "*" - case NaString: - return "-" - case ValString: - return s.Val - default: - // not sure what to return here - return "" - } -} -- cgit v1.2.3