Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache retrieves texts from a localizer and keeps them decoded until they are invalidated.
func NewLineCache ¶
NewLineCache returns a cache for single-block texts.
func NewPageCache ¶
NewPageCache returns a cache for resource-based texts.
func (*Cache) InvalidateResources ¶
InvalidateResources lets the cache remove any texts from resources that are specified in the given slice.
type Codepage ¶
type Codepage interface { // Encode converts the provided string to a byte array. It appends one 0x00 byte at the end. Encode(value string) []byte // Decode converts the provided byte slice to a string. It ignores trailing 0x00 bytes. Decode(data []byte) string }
Codepage wraps the methods for serializing strings. The encoded byte array is expected to be terminated by one 0x00 byte.
func DefaultCodepage ¶
func DefaultCodepage() Codepage
DefaultCodepage returns a Codepage instance that represents the one used for the resources. It is based on the Code Page 437 ( https://en.wikipedia.org/wiki/Code_page_437 ).
type ElectronicMessage ¶ added in v0.5.0
type ElectronicMessage struct { // NextMessage identifies the message that should follow this one. -1 for none. NextMessage int // IsInterrupt marks messages that are the ones following another. IsInterrupt bool // ColorIndex is into the palette for the sender text. -1 for default. ColorIndex int // LeftDisplay indicates the image to show in the left MFD. -1 for none. LeftDisplay int // RightDisplay indicates the image to show in the right MFD. -1 for none. RightDisplay int // Title of the message. Title string // Sender of the message. Sender string // Subject of the message. Subject string // VerboseText the long form. VerboseText string // TerseText the short form. TerseText string }
ElectronicMessage describes one message.
func DecodeElectronicMessage ¶ added in v0.5.0
func DecodeElectronicMessage(cp Codepage, provider resource.BlockProvider) (message ElectronicMessage, err error)
DecodeElectronicMessage tries to decode a message from given block holder.
func EmptyElectronicMessage ¶ added in v0.5.0
func EmptyElectronicMessage() ElectronicMessage
EmptyElectronicMessage returns an instance of an empty electronic message.
func (ElectronicMessage) Encode ¶ added in v0.5.0
func (message ElectronicMessage) Encode(cp Codepage) [][]byte
Encode serializes the message into a block holder.
type ElectronicMessageCache ¶ added in v0.5.0
type ElectronicMessageCache struct {
// contains filtered or unexported fields
}
ElectronicMessageCache retrieves messages from a localizer and keeps them decoded until they are invalidated.
func NewElectronicMessageCache ¶ added in v0.5.0
func NewElectronicMessageCache(cp Codepage, localizer resource.Localizer) *ElectronicMessageCache
NewElectronicMessageCache returns a new instance.
func (*ElectronicMessageCache) InvalidateResources ¶ added in v0.5.0
func (cache *ElectronicMessageCache) InvalidateResources(ids []resource.ID)
InvalidateResources lets the cache remove any texts from resources that are specified in the given slice.
func (*ElectronicMessageCache) Message ¶ added in v0.5.0
func (cache *ElectronicMessageCache) Message(key resource.Key) (ElectronicMessage, error)
Message retrieves and caches the message of given key.