Documentation ¶
Overview ¶
Package meta provides interfaces for read / write interaction with models. a meta model holds all of the data for a single game. TODO: Evaluate if the enumeration interfaces ( NumEvent,GetEvent ) make sense -- a more generic "type" iteration might be better. TODO: Add interfaces for Querying, especially, but not only, for relations. ( probably key-object with property filter )
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action interface { GetId() ident.Id // GetActionName returns the original name given by the scripter. GetActionName() string // GetEvent: raised by this action when the action occurs. GetEvent() Event // GetNouns: the classes for required by the action. GetNouns() Nouns // GetCallbacks() (Callbacks, bool) }
type CallbackOptions ¶
type CallbackOptions int
const ( UseTargetOnly CallbackOptions = 1 << iota UseAfterQueue )
func (CallbackOptions) UseAfterQueue ¶
func (opt CallbackOptions) UseAfterQueue() bool
func (CallbackOptions) UseTargetOnly ¶
func (opt CallbackOptions) UseTargetOnly() bool
type Event ¶
type Event interface { GetId() ident.Id // GetEventName returns the original name given by the scripter. GetEventName() string // GetListeners returns the capture or bubbling callbacks associated with this event // if GetListeners returns false, Listeners should be set to NoListeners. GetListeners(capture bool) (Listeners, bool) }
type Model ¶
type Model interface { NumAction() int ActionNum(int) Action GetAction(ident.Id) (Action, bool) NumEvent() int EventNum(int) Event GetEvent(ident.Id) (Event, bool) NumClass() int ClassNum(int) Class GetClass(ident.Id) (Class, bool) NumInstance() int InstanceNum(int) Instance GetInstance(ident.Id) (Instance, bool) NumRelation() int RelationNum(int) Relation GetRelation(ident.Id) (Relation, bool) NumParserAction() int ParserActionNum(int) ParserAction Pluralize(string) string AreCompatible(child, parent ident.Id) bool MatchNounName(string, func(ident.Id) bool) (tries int, err bool) }
type NoListeners ¶
type NoListeners [0]Listener
func (NoListeners) ListenerNum ¶
func (no NoListeners) ListenerNum(i int) Listener
func (NoListeners) NumListener ¶
func (no NoListeners) NumListener() int
type ParserAction ¶
NOTE: ParserActions aren't id'd, so they are represented as structs.
type Property ¶
type Property interface { GetId() ident.Id GetName() string GetType() PropertyType //GetObjectType()? // or maybe IsCompatible(inst) bool GetValue() Value GetValues() Values // GetRelative returns false if there is no relation, for example: a pure array or object value. GetRelative() (Relative, bool) }
type PropertyType ¶
type PropertyType int
const ( InvalidProperty PropertyType = iota NumProperty // float64 TextProperty // string StateProperty // string.Id ObjectProperty // string.Id ArrayProperty = 1 << 16 )
type Prototype ¶
type Prototype interface { GetId() ident.Id // GetParentClass returns empty id for classes if no parent; // panics if no class can be found for an instance. GetParentClass() ident.Id GetOriginalName() string NumProperty() int PropertyNum(int) Property // FindProperty by its user given name. FindProperty(string) (Property, bool) // GetProperty by the property unique id. GetProperty(ident.Id) (Property, bool) // GetPropertyByChoice evalutes all properties to find an enumeration which can store the passed choice GetPropertyByChoice(ident.Id) (Property, bool) }
Prototype holds properties; it supports both instance and class type things.
type Value ¶
type Value interface { GetNum() float64 SetNum(float64) error GetText() string SetText(string) error GetState() ident.Id SetState(ident.Id) error GetObject() ident.Id SetObject(ident.Id) error SetRelation(ident.Id) error }
get and set panic if the value is not of the requested type; set can return error when the value, when of the correct type, violates a property constraint