Documentation ¶
Index ¶
- func FormatRGBA(c color.RGBA) string
- func ParseMatrix(s string) ([16]float32, bool)
- func ParseRGBA(s string) (c color.RGBA, err error)
- func Register(namespace string, spec Spec)
- type Any
- type AnyAttr
- type AppendTokenElementDecoder
- type AttrGroup
- type CharDataElementDecoder
- type ChildElementDecoder
- type ElementDecoder
- type Encoder
- type GetterElementDecoder
- type Marshaler
- type PropertyGroup
- type Relationship
- type Spec
- type UnknownAttrs
- type UnknownTokens
- type UnknownTokensDecoder
- type UnmarshalerAttr
- type ValidateSpec
- type XMLAttr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatRGBA ¶
FormatRGBA returns the color as a hex string with the format #rrggbbaa.
Types ¶
type Any ¶ added in v0.24.0
type Any []Marshaler
Any is an extension point containing <any> information.
func (Any) Marshal3MF ¶ added in v0.24.0
func (e Any) Marshal3MF(x Encoder, start *xml.StartElement) error
type AnyAttr ¶ added in v0.24.0
type AnyAttr []AttrGroup
func (AnyAttr) Marshal3MF ¶ added in v0.24.0
func (a AnyAttr) Marshal3MF(x Encoder, start *xml.StartElement) error
type AppendTokenElementDecoder ¶ added in v0.23.0
type AppendTokenElementDecoder interface { ElementDecoder AppendToken(xml.Token) }
AppendTokenElementDecoder must be implemented by element decoders that need to accumulate tokens to support loseless encoding.
type AttrGroup ¶ added in v0.24.0
type AttrGroup interface { UnmarshalerAttr Marshaler Namespace() string }
AttrGroup defines a container for different attributes of the same namespace. It supports encoding and decoding to XML.
type CharDataElementDecoder ¶
type CharDataElementDecoder interface { ElementDecoder CharData([]byte) }
CharDataElementDecoder must be implemented by element decoders that need to decode raw text.
type ChildElementDecoder ¶
type ChildElementDecoder interface { ElementDecoder Child(xml.Name) (int, ElementDecoder) }
ChildElementDecoder must be implemented by element decoders that need decoding nested elements.
type ElementDecoder ¶
ElementDecoder defines the minimum contract to decode a 3MF node.
type Encoder ¶
type Encoder interface { AddRelationship(Relationship) FloatPresicion() int EncodeToken(xml.Token) Flush() error SetAutoClose(bool) // Use SetSkipAttrEscape(true) when there is no need to escape // StartElement attribute values, such as as when all attributes // are filled using strconv. SetSkipAttrEscape(bool) }
Encoder provides de necessary methods to encode specs. It should not be implemented by spec authors but will be provided be go3mf itself.
type GetterElementDecoder ¶ added in v0.24.0
type GetterElementDecoder interface { ElementDecoder Element() interface{} }
func NewElementDecoder ¶ added in v0.24.0
func NewElementDecoder(name xml.Name) GetterElementDecoder
type Marshaler ¶
type Marshaler interface {
Marshal3MF(Encoder, *xml.StartElement) error
}
Marshaler is the interface implemented by objects that can marshal themselves into valid XML elements.
type PropertyGroup ¶
type PropertyGroup interface {
Len() int
}
type Relationship ¶
type Spec ¶
type Spec interface { NewAttrGroup(parent xml.Name) AttrGroup NewElementDecoder(name xml.Name) GetterElementDecoder }
Spec is the interface that must be implemented by a 3mf spec.
Specs may implement ValidateSpec.
type UnknownAttrs ¶ added in v0.23.0
An UnknownAttrs represents a list of attributes that are not supported by any loaded Spec.
func (UnknownAttrs) Marshal3MF ¶ added in v0.24.0
func (u UnknownAttrs) Marshal3MF(enc Encoder, start *xml.StartElement) error
func (UnknownAttrs) Namespace ¶ added in v0.24.0
func (u UnknownAttrs) Namespace() string
func (*UnknownAttrs) Unmarshal3MFAttr ¶ added in v0.24.0
func (u *UnknownAttrs) Unmarshal3MFAttr(a XMLAttr) error
type UnknownTokens ¶ added in v0.23.0
UnknownTokens represents a section of an xml that cannot be decoded by any loaded Spec.
func (UnknownTokens) Marshal3MF ¶ added in v0.23.0
func (u UnknownTokens) Marshal3MF(enc Encoder, _ *xml.StartElement) error
func (UnknownTokens) XMLName ¶ added in v0.24.0
func (u UnknownTokens) XMLName() xml.Name
XMLName returns the xml identifier of the resource.
type UnknownTokensDecoder ¶ added in v0.23.0
UnknownTokensDecoder can be used by spec decoders to maintain the xml tree elements of unknown extensions.
func NewUnknownDecoder ¶ added in v0.24.0
func NewUnknownDecoder(name xml.Name) *UnknownTokensDecoder
func (*UnknownTokensDecoder) AppendToken ¶ added in v0.23.0
func (d *UnknownTokensDecoder) AppendToken(t xml.Token)
func (*UnknownTokensDecoder) Element ¶ added in v0.24.0
func (d *UnknownTokensDecoder) Element() interface{}
func (*UnknownTokensDecoder) End ¶ added in v0.23.0
func (d *UnknownTokensDecoder) End()
func (*UnknownTokensDecoder) Start ¶ added in v0.23.0
func (d *UnknownTokensDecoder) Start(attrs []XMLAttr) error
func (UnknownTokensDecoder) Tokens ¶ added in v0.23.0
func (d UnknownTokensDecoder) Tokens() UnknownTokens
type UnmarshalerAttr ¶ added in v0.24.0
UnmarshalerAttr is the interface implemented by objects that can unmarshal an XML element description of themselves.
type ValidateSpec ¶
type ValidateSpec interface { Spec Validate(model interface{}, path string, element interface{}) error }
If a Spec implemented ValidateSpec, then model.Validate will call Validate and aggregate the resulting erros.
model is guaranteed to be a *go3mf.Model
func LoadValidator ¶ added in v0.24.0
func LoadValidator(ns string) (ValidateSpec, bool)