type Renderer … type Dictionary … type Encoder … type keyVal … // Language reports the language for which the encoded message will be stored // in the Catalog. func (e *Encoder) Language() language.Tag { … } func (e *Encoder) setError(err error) { … } // EncodeUint encodes x. func (e *Encoder) EncodeUint(x uint64) { … } // EncodeString encodes s. func (e *Encoder) EncodeString(s string) { … } // EncodeMessageType marks the current message to be of type h. // // It must be the first call of a Message's Compile method. func (e *Encoder) EncodeMessageType(h Handle) { … } // EncodeMessage serializes the given message inline at the current position. func (e *Encoder) EncodeMessage(m Message) error { … } func (e *Encoder) checkInBody() { … } // stripPrefix indicates the number of prefix bytes that must be stripped to // turn a single-element sequence into a message that is just this single member // without its size prefix. If the message can be stripped, b[1:n] contains the // size prefix. func stripPrefix(b []byte) (n int) { … } func (e *Encoder) flushTo(dst *Encoder) { … } func (e *Encoder) addVar(key string, m Message) error { … } const substituteVar … const substituteMacro … const substituteError … // EncodeSubstitution inserts a resolved reference to a variable or macro. // // This call must be matched with a call to ExecuteSubstitution at decoding // time. func (e *Encoder) EncodeSubstitution(name string, arguments ...int) { … } type Decoder … // NewDecoder returns a new Decoder. // // Decoders are designed to be reused for multiple invocations of Execute. // Only one goroutine may call Execute concurrently. func NewDecoder(tag language.Tag, r Renderer, macros Dictionary) *Decoder { … } func (d *Decoder) setError(err error) { … } // Language returns the language in which the message is being rendered. // // The destination language may be a child language of the language used for // encoding. For instance, a decoding language of "pt-PT" is consistent with an // encoding language of "pt". func (d *Decoder) Language() language.Tag { … } // Done reports whether there are more bytes to process in this message. func (d *Decoder) Done() bool { … } // Render implements Renderer. func (d *Decoder) Render(s string) { … } // Arg implements Renderer. // // During evaluation of macros, the argument positions may be mapped to // arguments that differ from the original call. func (d *Decoder) Arg(i int) interface{ … } // DecodeUint decodes a number that was encoded with EncodeUint and advances the // position. func (d *Decoder) DecodeUint() uint64 { … } // DecodeString decodes a string that was encoded with EncodeString and advances // the position. func (d *Decoder) DecodeString() string { … } // SkipMessage skips the message at the current location and advances the // position. func (d *Decoder) SkipMessage() { … } // Execute decodes and evaluates msg. // // Only one goroutine may call execute. func (d *Decoder) Execute(msg string) error { … } func (d *Decoder) execute(msg string) bool { … } // executeMessageFromData is like execute, but also decodes a leading message // size and clips the given string accordingly. // // It reports the number of bytes consumed and whether a message was selected. func (d *Decoder) executeMessageFromData(s string) (n int, ok bool) { … } var errUnknownHandler … // executeMessage reads the handle id, initializes the decoder and executes the // message. It is assumed that all of d.data[d.p:] is the single message. func (d *Decoder) executeMessage() bool { … } // ExecuteMessage decodes and executes the message at the current position. func (d *Decoder) ExecuteMessage() bool { … } // ExecuteSubstitution executes the message corresponding to the substitution // as encoded by EncodeSubstitution. func (d *Decoder) ExecuteSubstitution() { … }