Add text framer interface

develop
Michael Yang 2013-12-31 13:41:41 -05:00
rodzic fdedb80c8d
commit b312beddc1
2 zmienionych plików z 12 dodań i 5 usunięć

Wyświetl plik

@ -84,6 +84,15 @@ func (f DataFrame) Bytes() []byte {
return f.data
}
// TextFramer represents frames that contain encoded text
type TextFramer interface {
Framer
Encoding() string
SetEncoding(string) error
Text() string
SetText(string) error
}
// TextFrame represents frames that contain encoded text
type TextFrame struct {
FrameHead

Wyświetl plik

@ -197,12 +197,10 @@ func (t *Tag) SetGenre(text string) {
t.setTextFrameText(t.commonMap["Genre"], text)
}
func (t *Tag) textFrame(id string) *TextFrame {
func (t *Tag) textFrame(id string) TextFramer {
if frame := t.Frame(id); frame != nil {
switch frame.(type) {
case (*TextFrame):
return frame.(*TextFrame)
default:
if textFramer, ok := frame.(TextFramer); ok {
return textFramer
}
}