45 lines
1.0 KiB
Go
45 lines
1.0 KiB
Go
// Copyright 2021, Henrik Sölver henrik.solver@gmail.com
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
package ipp
|
|
|
|
import "io"
|
|
|
|
// TextWithoutLanguage is the TextWithoutLanguage attribute
|
|
type TextWithoutLanguage struct {
|
|
name string
|
|
value string
|
|
}
|
|
|
|
// NewtextWithoutLanguage creates a new textWithoutLanguage attribute
|
|
func NewtextWithoutLanguage(name, value string) *TextWithoutLanguage {
|
|
c := new(TextWithoutLanguage)
|
|
c.name = name
|
|
c.value = value
|
|
return c
|
|
}
|
|
|
|
// Name returns the name of the attribute
|
|
func (c TextWithoutLanguage) Name() string {
|
|
return c.name
|
|
}
|
|
|
|
func (c TextWithoutLanguage) String() string {
|
|
return c.name + ":" + c.value
|
|
}
|
|
|
|
func (c *TextWithoutLanguage) valueTag() tag {
|
|
return textWithoutLanguageValueTag
|
|
}
|
|
|
|
func (c *TextWithoutLanguage) unmarshal(byteStream io.Reader) {
|
|
c.name, c.value = unmarshalSingleValue(byteStream)
|
|
}
|
|
|
|
func (c *TextWithoutLanguage) marshal() []byte {
|
|
l := 5 + len(c.name) + len(c.value)
|
|
b := make([]byte, l)
|
|
b[0] = byte(textWithoutLanguageValueTag)
|
|
marshalNameValue(c.name, c.value, b[1:])
|
|
return b
|
|
}
|