adifparser

package module
v0.0.0-...-2c46573 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2023 License: BSD-2-Clause Imports: 13 Imported by: 1

README

ADIFParser

ADIFParser is a Go library for reading and writing Amateur Data Interchange Format files. It wraps io.Reader and io.Writer interfaces to handle I/O and attempts to handle the irregularities of parsing files as much as possible.

Shortcomings

Currently, no validation of the content of fields is done. Also, no transformations are done, the fields are all handled as strings.

License

This library is released under a 2-clause BSD license. See COPYING for the license.

Bugs

Please report bugs on GitHub at https://github.com/Matir/adifparser, and please include an ADIF test case to demonstrate your bug.

Documentation

Index

Constants

View Source
const (
	ADIFBoolean = iota
	ADIFNumber
	ADIFString
	ADIFDate
	ADIFTime
	ADIFLocation
)
View Source
const LOTWAPI string = "https://lotw.arrl.org/lotwuser/lotwreport.adi"

Variables

View Source
var ADIFfieldInfo map[string]fieldMetadata
View Source
var ADIFfieldOrder []string
View Source
var InvalidField = errors.New("Invalid field definition.")
View Source
var InvalidFieldLength = errors.New("Invalid field length.")

Errors

View Source
var NoData = errors.New("No data to parse.")

Errors

View Source
var NoSuchField = errors.New("No such field.")
View Source
var OutputStarted = errors.New("Output already started.")
View Source
var TypeCodeExceedOneByte = errors.New("Type Code exceeds one byte.")
View Source
var UnknownColons = errors.New("Unknown colons in the tag.")

Functions

func NewADIFReader

func NewADIFReader(r io.Reader) *baseADIFReader

func NewADIFRecord

func NewADIFRecord() *baseADIFRecord

Create a new ADIFRecord from scratch

func NewADIFWriter

func NewADIFWriter(w io.Writer) *baseADIFWriter

Construct a new writer

func NewDedupeADIFReader

func NewDedupeADIFReader(r io.Reader) *dedupeADIFReader

func NewLOTWClient

func NewLOTWClient(username, password string) *lotwClientImpl

Create a new client

Types

type ADIFReader

type ADIFReader interface {
	ReadRecord() (ADIFRecord, error)
	RecordCount() int
}

Interface for ADIFReader

type ADIFRecord

type ADIFRecord interface {
	// Print as ADIF String
	ToString() string
	// Fingerprint for duplication detection
	Fingerprint() string
	// Setters and getters
	GetValue(string) (string, error)
	SetValue(string, string)
	// Get all of the present field names
	GetFields() []string
}

Public interface for ADIFRecords

type ADIFWriter

type ADIFWriter interface {
	WriteRecord(ADIFRecord) error
	Flush() error
	SetComment(string) error
}

Basic writer type

type LOTWClient

type LOTWClient interface {
	// Implement reader
	Read([]byte) (int, error)
	Close() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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