Documentation
¶
Overview ¶
Package xmlser provides types to read and write XML archives from the C++ Boost Serialization library.
Writing values to an output binary archive can be done like so:
enc := xmlser.NewEncoder(w) err := enc.Encode("hello")
And reading values from an input binary archive:
dec := xmlser.NewDecoder(r) str := "" err := dec.Decode(&str)
For more informations, look at the examples for Encoder, Decoder and read/write Buffer.
Index ¶
- Variables
- type Decoder
- type Header
- type Marshaler
- type RBuffer
- func (r *RBuffer) Err() error
- func (r *RBuffer) Read(p []byte) (int, error)
- func (r *RBuffer) ReadBool() bool
- func (r *RBuffer) ReadC128() complex128
- func (r *RBuffer) ReadC64() complex64
- func (r *RBuffer) ReadF32() float32
- func (r *RBuffer) ReadF64() float64
- func (r *RBuffer) ReadHeader() Header
- func (r *RBuffer) ReadI16() int16
- func (r *RBuffer) ReadI32() int32
- func (r *RBuffer) ReadI64() int64
- func (r *RBuffer) ReadI8() int8
- func (r *RBuffer) ReadString() string
- func (r *RBuffer) ReadTypeDescr(typ reflect.Type) TypeDescr
- func (r *RBuffer) ReadU16() uint16
- func (r *RBuffer) ReadU32() uint32
- func (r *RBuffer) ReadU64() uint64
- func (r *RBuffer) ReadU8() uint8
- type TypeDescr
- type Unmarshaler
- type WBuffer
- func (w *WBuffer) Err() error
- func (w *WBuffer) Write(p []byte) (int, error)
- func (w *WBuffer) WriteBool(name string, v bool) error
- func (w *WBuffer) WriteC128(name string, v complex128) error
- func (w *WBuffer) WriteC64(name string, v complex64) error
- func (w *WBuffer) WriteF32(name string, v float32) error
- func (w *WBuffer) WriteF64(name string, v float64) error
- func (w *WBuffer) WriteHeader(hdr Header) error
- func (w *WBuffer) WriteI16(name string, v int16) error
- func (w *WBuffer) WriteI32(name string, v int32) error
- func (w *WBuffer) WriteI64(name string, v int64) error
- func (w *WBuffer) WriteI8(name string, v int8) error
- func (w *WBuffer) WriteString(n, v string) error
- func (w *WBuffer) WriteTypeDescr(rt reflect.Type) error
- func (w *WBuffer) WriteU16(name string, v uint16) error
- func (w *WBuffer) WriteU32(name string, v uint32) error
- func (w *WBuffer) WriteU64(name string, v uint64) error
- func (w *WBuffer) WriteU8(name string, v uint8) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotBoost = errors.New("xmlser: not a Boost XML archive") ErrInvalidHeader = errors.New("xmlser: invalid Boost XML archive header") ErrInvalidTypeDescr = errors.New("xmlser: invalid Boost XML archive type descriptor") ErrTypeNotSupported = errors.New("xmlser: type not supported") ErrInvalidArrayLen = errors.New("xmlser: invalid array type") )
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder struct { Header Header // contains filtered or unexported fields }
A Decoder reads and decodes values from a Boost binary serialization stream.
func NewDecoder ¶
NewDecoder returns a new decoder that reads from r.
The decoder checks the stream has a correct Boost XML header.
type Header ¶
type Header struct {
Version uint16
}
Header describes a boost XML archive.
func (Header) MarshalBoostXML ¶
func (*Header) UnmarshalBoostXML ¶
type Marshaler ¶
Marshaler is the interface implemented by types that can marshal themselves into a valid Boost serialization XML archive.
type RBuffer ¶
type RBuffer struct {
// contains filtered or unexported fields
}
A RBuffer reads values from a Boost binary serialization stream.
func NewRBuffer ¶
NewRBuffer returns a new read-only buffer that reads from r.
func (*RBuffer) ReadC128 ¶
func (r *RBuffer) ReadC128() complex128
func (*RBuffer) ReadHeader ¶
func (*RBuffer) ReadString ¶
type TypeDescr ¶
TypeDescr describes an on-disk boost XML archive type.
func (TypeDescr) MarshalBoostXML ¶
func (*TypeDescr) UnmarshalBoostXML ¶
type Unmarshaler ¶
Unmarshaler is the interface implemented by types that can unmarshal a Boost XML description of themselves.
type WBuffer ¶
type WBuffer struct {
// contains filtered or unexported fields
}