Files
ippserver/packages/ipp/keyword.go

46 lines
788 B
Go

package ipp
import "io"
type keyWord struct {
name string
values []string
}
func newKeyWord() *keyWord {
k := new(keyWord)
return k
}
func (k *keyWord) string() string {
return "a uriValue"
}
func (k *keyWord) valueTag() tag {
return keyWordValueTag
}
func (k *keyWord) unmarshal(byteStream io.Reader) {
}
func (k *keyWord) marshal() []byte {
return []byte{}
}
func (k *keyWord) addValue(v string) {
k.values = append(k.values, v)
}
func (k *keyWord) size() int {
l := 1 + 2 // The value tag (0x44) + name-length field (2 bytes)
l += len(k.name)
l += 2 // value-length field (2 bytes)
l += len(k.values[0])
// Add all additional values
for _, v := range k.values[1:] {
l += 1 + 4 // The value tag (0x44) + 2 length fields (2 bytes)
l += len(v)
}
return l
}