Documentation ¶
Index ¶
Constants ¶
const ( // EncoderNameGSM is the GSM Encoder Name EncoderNameGSM string = "GSM" // EncoderNameUTF16 is the UTF-16 Encoder Name EncoderNameUTF16 string = "UTF-16" )
const ( // DefaultSMSBytes is the default SMS size in bytes DefaultSMSBytes int = 140 )
Variables ¶
var ErrNotEncodable = errors.New("one or more characters cannot be encoded with the given encoder")
ErrNotEncodable indicates that the supplied string or character cannot be encoded with the given encoder
var ErrNotSplittable = errors.New("the message cannot be split with the given encoder and message length")
ErrNotSplittable indicates that the given message cannot be split with the given encoder and message length
Functions ¶
Types ¶
type Encoder ¶
type Encoder interface { GetEncoderName() string GetCodePointBits() int GetCodePoints(rune) (int, error) CheckEncodability(string) bool }
Encoder encapsulates encoder specific fields
type GSM ¶
type GSM struct{}
GSM implements the Encoder interface
func (*GSM) CheckEncodability ¶
CheckEncodability returns true if str is encodable and false otherwise
func (*GSM) GetCodePointBits ¶
GetCodePointBits returns the number of bits that make a single GSM code point
func (*GSM) GetCodePoints ¶
GetCodePoints returns the number of code points used to represent char in GSM
func (*GSM) GetEncoderName ¶
GetEncoderName returns the GSM encoder name
type SMS ¶
type SMS struct {
// contains filtered or unexported fields
}
SMS structure with correctly sized message and appropriate UDH
func (*SMS) GetContent ¶
GetContent returns the SMS's content field
type Splitter ¶
type Splitter struct {
// contains filtered or unexported fields
}
Splitter splits messages into SMS structs
func NewSplitter ¶
func NewSplitter() *Splitter
NewSplitter creates a new Splitter configured with default values
func (*Splitter) CheckEncodability ¶
CheckEncodability returns true if the message is encodable with the splitter's encoder and false otherwise
func (*Splitter) SetEncoder ¶
SetEncoder sets the encoder of the Splitter
func (*Splitter) SetMessageBytes ¶
SetMessageBytes sets the messageBytes of the Splitter
func (*Splitter) SetShortReference ¶
SetShortReference sets the shortReference of the Splitter
type UTF16 ¶
type UTF16 struct{}
UTF16 implements the Encoder interface
func (*UTF16) CheckEncodability ¶
CheckEncodability returns true if str is encodable and false otherwise
func (*UTF16) GetCodePointBits ¶
GetCodePointBits returns the number of bits that make a single UTF-16 code point
func (*UTF16) GetCodePoints ¶
GetCodePoints returns the number of code points used to represent char in UTF-16
func (*UTF16) GetEncoderName ¶
GetEncoderName returns the UTF-16 encoder name