Files
ippserver/packages/ipp/keyword.go
2021-11-27 15:47:03 +00:00

43 lines
746 B
Go

// Copyright 2021, Henrik Sölver henrik.solver@gmail.com
// SPDX-License-Identifier: BSD-3-Clause
package ipp
import (
"bufio"
)
type KeyWord struct {
sos *SetOfStrings
}
func NewKeyWord(name string, values ...string) *KeyWord {
k := new(KeyWord)
k.sos = NewSetOfStrings(name, keyWordValueTag, values)
return k
}
func (k KeyWord) Name() string {
return k.sos.name
}
func (k KeyWord) String() string {
return k.sos.String()
}
func (k *KeyWord) valueTag() tag {
return k.sos.valueTag()
}
func (k *KeyWord) marshal() []byte {
return k.sos.marshal()
}
func (k *KeyWord) unmarshal(byteStream *bufio.Reader) {
k.sos.unmarshal(byteStream, keyWordValueTag)
}
func (k *KeyWord) addValue(v interface{}) {
k.sos.AddValue(v.(string))
}