history

package
v0.0.0-...-07d2fe9 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2014 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package history provides a seekable sequence of rpg.State.

Index

Constants

View Source
const (
	SeekStart = iota
	SeekCur
	SeekEnd
)

See also: io.Seeker

Variables

This section is empty.

Functions

This section is empty.

Types

type History

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

History is a seekable sequence of rpg.State.

func NewHistory

func NewHistory(f io.ReadWriteSeeker) *History

NewHistory returns a new History that reads from and writes to f.

func (*History) Append

func (h *History) Append(s *rpg.State) error

Append adds s to the end of h. h.Seek(0, SeekEnd) is called before writing. A non-nil error means that h is no longer safe to use.

func (*History) Reset

func (h *History) Reset()

Reset sets the cursor to position -1, equivalent to calling NewHistory on the same io.ReadWriteSeeker.

func (*History) Seek

func (h *History) Seek(offset int64, whence int) (*rpg.State, error)

Seek moves the cursor to an offset from the start, end, or current position and returns the value at the cursor. If the error returned is io.EOF, Seek was asked to pass the start or end of the file. Any other non-nil error means that History is no longer safe to use.

func (*History) Tell

func (h *History) Tell() int64

Tell returns the current position of this History's cursor. -1 is a special state that is either before the start or after the end, depending on the direction of the next Seek.

Jump to

Keyboard shortcuts

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