eventhandler

package
Version: v0.0.0-...-725082c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2022 License: BSD-2-Clause Imports: 1 Imported by: 0

Documentation

Overview

This eventhandler implementation is optional for the parser package, in order to avoid a mutual dependency with ogdl.

This eventhandler implementation is optional for the parser package, in order to avoid a mutual dependency with ogdl.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventHandler

type EventHandler struct {
	// contains filtered or unexported fields
}

EventHandler receives events and produces a tree.

func New

func New() *EventHandler

func (*EventHandler) Add

func (e *EventHandler) Add(s string)

Add creates a string node at the current level.

func (*EventHandler) AddAt

func (e *EventHandler) AddAt(s string, lv int)

AddAt creates a string node at the specified level.

func (*EventHandler) Dec

func (e *EventHandler) Dec()

Dec decrements the current level by 1.

func (*EventHandler) Delete

func (e *EventHandler) Delete()

Delete removes the last node added

func (*EventHandler) Graph

func (e *EventHandler) Graph() *ogdl.Graph

Tree returns the Graph object built from the events sent to this event handler.

func (*EventHandler) Inc

func (e *EventHandler) Inc()

Inc increments the current level by 1.

func (*EventHandler) Item

func (e *EventHandler) Item(i int) (string, int)

func (*EventHandler) Len

func (e *EventHandler) Len() int

func (*EventHandler) Level

func (e *EventHandler) Level() int

Level returns the current level

func (*EventHandler) SetLevel

func (e *EventHandler) SetLevel(l int)

SetLevel sets the current level

type EventHandler2

type EventHandler2 struct {
	// contains filtered or unexported fields
}

EventHandler2 receives events and produces a tree. TODO benchmark agains the pure string version. Keep this one if difference is small

func New2

func New2() *EventHandler2

func (*EventHandler2) Add

func (e *EventHandler2) Add(s interface{})

Add creates a string node at the current level.

func (*EventHandler2) AddAt

func (e *EventHandler2) AddAt(s interface{}, lv int)

AddAt creates a string node at the specified level.

func (*EventHandler2) Dec

func (e *EventHandler2) Dec()

Dec decrements the current level by 1.

func (*EventHandler2) Delete

func (e *EventHandler2) Delete()

Delete removes the last node added

func (*EventHandler2) Graph

func (e *EventHandler2) Graph() *ogdl.Graph

Tree returns the Graph object built from the events sent to this event handler.

func (*EventHandler2) Inc

func (e *EventHandler2) Inc()

Inc increments the current level by 1.

func (*EventHandler2) Item

func (e *EventHandler2) Item(i int) (interface{}, int)

func (*EventHandler2) Len

func (e *EventHandler2) Len() int

func (*EventHandler2) Level

func (e *EventHandler2) Level() int

Level returns the current level

func (*EventHandler2) SetLevel

func (e *EventHandler2) SetLevel(l int)

SetLevel sets the current level

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL