feragstring

package module
v0.0.0-...-8b47e76 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 3 Imported by: 0

README

feragstring

feragstring is a Go package for creating a FERAG string file programmatically. If you don't know what FERAG (the company) or a FERAG string is you probably don't need this package ;-)

The shortest possible FERAG string

According to FERAG's documentation this is the shortest possible FERAG string:

%2440+40DEMO2009!
%2401+11E1_ROUTE_100 !
%2402+11E1_ROUTE_100 +590+91000000+20E1                            !
%2403+12R100RE001 +1300123!
%2406+11E1_ROUTE_100 !
%2441+40DEMO2009!

The variable values are:

  • the title is 'DEMO2009'
  • a route named 'E1_ROUTE_100'
  • an edition called 'E1'
  • a production drop 'R100RE001' with 123 copies

Usage

// create a FERAG string object
fs := feragstring.NewFeragString()
fs.SetTitleName("EDITION1")

// set title parameters
fs.TitleInfo.SetPrintObjectName("EDITION1A")
fs.TitleInfo.SetPublicationDate("2020-05-31")
fs.TitleInfo.SetCountryCode("13")
fs.TitleInfo.SetPrintObjectColor("00000000")

// add a product
pr1 := feragstring.NewProductReference()
pr1.SetProductName("MAIN")
pr1.SetCopiesAssigned(25000)
pr1.SetSupervision(1)
pr1.SetOverlap(5)
mp := feragstring.NewMissingParameter(1, 1)
pr1.SetMissingParameter(mp)
pr1.SetIssueReference("MAIN01")
fs.AddProductReference(pr1)

// add a route
rt := feragstring.NewRoute()
rt.SetRouteName("ROUTE001")
rt.SetRouteCode(fs.NextRouteCode())
rt.SetRampNumber(0)
rt.SetCopiesInRoute(1500)
rt.SetLimit(1)
rt.SetMaxStack(13)
rt.SetStandard(40)
rt.SetParameterN(4)
rt.SetMaxBundle(40)
rt.SetTopsheetMarker(5)
rt.SetEaMarker(0)
rt.SetTopsheetTemplateDirectory(20)
rt.AddProductReferenceNumber(1)
fs.AddRoute(rt)

// get the FERAG string (the write it to a file...) 
feragString := fs.PrintOut()

Supported messages

  • Title Info (%2440)
  • Title End (%2441)
  • Product Reference (%2450)
  • Route List Entry (%2401)
  • Route Info (%2402)
  • Production Drop (%2403)
  • Topsheet Data for TSL (%2414)
  • Route End (%2406)

Installation

go get -u code.jakoubek.net/jakoubek/feragstring

Need commercial support?

I offer commercial support for newspaper companies who want to setup their own FERAG string generation.

See https://www.jakoubek.net/ferag-string-erzeugen (German) or write an email to info@jakoubek.net.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ControlCharacterSet

type ControlCharacterSet struct {
	DontProduce            bool
	BundlesToSecondaryExit bool
}

ControlCharacterSet is a struct for the control character field in the FERAG messages that support control characters (Route Info, Production Drop). Supports currently only "D" (Don't Produce) and "T" (Bundles to Secondary Exit).

func NewControlCharacterSet

func NewControlCharacterSet() *ControlCharacterSet

NewControlCharacterSet instantiates a new Control Character Set struct and returns a pointer to it.

func (*ControlCharacterSet) GetControlCharactersMessage

func (cc *ControlCharacterSet) GetControlCharactersMessage() string

GetControlCharactersMessage returns the formatted FERAG string for the control character set.

func (*ControlCharacterSet) SetBundlesToSecondaryExit

func (cc *ControlCharacterSet) SetBundlesToSecondaryExit()

SetBundlesToSecondaryExit sets the "bundles to secondary exit" flag (T)

func (*ControlCharacterSet) SetDontProduce

func (cc *ControlCharacterSet) SetDontProduce()

SetDontProduce sets the "don't produce" flag (D)

type FeragMessage

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

FeragMessage is the struct for the "abstract" message. It is meant to be embedded into the real message structs.

func (*FeragMessage) MessageTemplate

func (fm *FeragMessage) MessageTemplate() MessageTemplateFunc

MessageTemplate returns a MessageTemplateFunc - to be called from within the "real" message structs.

type FeragString

type FeragString struct {
	TitleInfo             *TitleInfo
	TitleEnd              *TitleEnd
	ProductReferences     []*ProductReference
	ProductReferencesNr   int
	Routes                []*Route
	RouteCount            int
	RouteListEntries      []*RouteListEntry
	RouteListEntryCount   int
	RouteInfoEntries      []*RouteInfo
	ProductionDropEntries []*ProductionDrop
	RouteEndEntries       []*RouteEnd
}

FeragString is the root struct for creating a FERAG string. One FeragString instance returns the output for one FERAG string.

func NewFeragString

func NewFeragString() *FeragString

NewFeragString instantiates a new FeragString struct and returns a pointer to it.

func (*FeragString) AddProductReference

func (fs *FeragString) AddProductReference(pr *ProductReference) error

AddProductReference adds a Product Reference instance to the list of product references of the FeragString

func (*FeragString) AddProductionDrop deprecated

func (fs *FeragString) AddProductionDrop(pd *ProductionDrop) error

Deprecated: AddProductionDrop adds a ProductionDrop to a FeragString. Use AddProductionDrop on the route struct instead.

func (*FeragString) AddRoute

func (fs *FeragString) AddRoute(r *Route) error

AddRoute adds a Route to the list of routes of the FeragString

func (*FeragString) AddRouteEnd deprecated

func (fs *FeragString) AddRouteEnd(re *RouteEnd) error

Deprecated: AddRouteEnd adds a Route End to a FeragString. Not necessary anymore. Routes are automatically ended now.

func (*FeragString) AddRouteInfo deprecated

func (fs *FeragString) AddRouteInfo(ri *RouteInfo) error

Deprecated: AddRouteInfo adds a route info to a FeragString. Use AddRoute instead.

func (*FeragString) AddRouteListEntry deprecated

func (fs *FeragString) AddRouteListEntry(rl *RouteListEntry) error

Deprecated: AddRouteListEntry adds a route list entry to a FeragString. Use AddRoute instead.

func (*FeragString) NextRouteCode

func (fs *FeragString) NextRouteCode() int

NextRouteCode returns the next numeric route code. Use this method to get an automatically incremented counter value for the routes of a FeragString.

func (*FeragString) PrintOut

func (fs *FeragString) PrintOut() string

PrintOut returns the final FERAG string of the FeragString instance

func (*FeragString) SetTitleName

func (fs *FeragString) SetTitleName(titleName string)

SetTitleName sets the title name field

type MessageTemplateFunc

type MessageTemplateFunc func(*FeragMessage, string) string

MessageTemplateFunc is a func type for the generating the FERAG-formatted message.

type MissingParameter

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

func NewMissingParameter

func NewMissingParameter(missingRate, missingSize int) MissingParameter

type ProductReference

type ProductReference struct {
	FeragMessage
	// contains filtered or unexported fields
}

func NewProductReference

func NewProductReference() *ProductReference

func (*ProductReference) CopiesAssigned

func (pr *ProductReference) CopiesAssigned() string

func (*ProductReference) FeedingMode

func (pr *ProductReference) FeedingMode() string

func (*ProductReference) GetProductReferenceNumber

func (pr *ProductReference) GetProductReferenceNumber() int

func (*ProductReference) IssueReference

func (pr *ProductReference) IssueReference() string

func (*ProductReference) Message

func (pr *ProductReference) Message() string

func (*ProductReference) MissingParameter

func (pr *ProductReference) MissingParameter() string

func (*ProductReference) Overlap

func (pr *ProductReference) Overlap() string

func (*ProductReference) Payload

func (pr *ProductReference) Payload() string

func (*ProductReference) ProductName

func (pr *ProductReference) ProductName() string

func (*ProductReference) ProductReferenceNumber

func (pr *ProductReference) ProductReferenceNumber() string

func (*ProductReference) ProductUsageType

func (pr *ProductReference) ProductUsageType() string

func (*ProductReference) ProductWeight

func (pr *ProductReference) ProductWeight() string

func (*ProductReference) Scatter

func (pr *ProductReference) Scatter() string

func (*ProductReference) SetCopiesAssigned

func (pr *ProductReference) SetCopiesAssigned(copiesAssigned int)

func (*ProductReference) SetFeedingMode

func (pr *ProductReference) SetFeedingMode(feedingMode int)

func (*ProductReference) SetIssueReference

func (pr *ProductReference) SetIssueReference(issueReference string)

func (*ProductReference) SetMissingParameter

func (pr *ProductReference) SetMissingParameter(missingParameter MissingParameter)

func (*ProductReference) SetOverlap

func (pr *ProductReference) SetOverlap(overlap int)

func (*ProductReference) SetProductName

func (pr *ProductReference) SetProductName(productName string)

func (*ProductReference) SetProductReferenceNumber

func (pr *ProductReference) SetProductReferenceNumber(productReferenceNumber int)

func (*ProductReference) SetProductUsageType

func (pr *ProductReference) SetProductUsageType(productUsageType int)

func (*ProductReference) SetProductWeight

func (pr *ProductReference) SetProductWeight(productWeight int)

func (*ProductReference) SetScatter

func (pr *ProductReference) SetScatter(scatter int)

func (*ProductReference) SetSheetLayers

func (pr *ProductReference) SetSheetLayers(sheetLayers int)

func (*ProductReference) SetSupervision

func (pr *ProductReference) SetSupervision(supervision int)

func (*ProductReference) SheetLayers

func (pr *ProductReference) SheetLayers() string

func (*ProductReference) Supervision

func (pr *ProductReference) Supervision() string

type ProductionDrop

type ProductionDrop struct {
	FeragMessage

	ControlCharacters ControlCharacterSet
	// contains filtered or unexported fields
}

ProductionDrop is the struct for one production drop underneath a route

func NewProductionDrop

func NewProductionDrop() *ProductionDrop

NewProductionDrop instantiates a new production drop struct and returns a pointer to it.

func (*ProductionDrop) AddProductReferenceNumber

func (pd *ProductionDrop) AddProductReferenceNumber(productReferenceNumber int)

AddProductReferenceNumber adds a numeric ProductReferenceNumber to the production drop

func (*ProductionDrop) AgentName

func (pd *ProductionDrop) AgentName() string

AgentName returns the formatted agent name

func (*ProductionDrop) Limit

func (pd *ProductionDrop) Limit() string

func (*ProductionDrop) MaxBundle

func (pd *ProductionDrop) MaxBundle() string

func (*ProductionDrop) MaxStack

func (pd *ProductionDrop) MaxStack() string

func (*ProductionDrop) Message

func (pd *ProductionDrop) Message() string

Message returns the formatted FERAG string for the production drop

func (*ProductionDrop) NumberOfCopies

func (pd *ProductionDrop) NumberOfCopies() string

NumberOfCopies returns the formatted number of copies in the route

func (*ProductionDrop) ParameterN

func (pd *ProductionDrop) ParameterN() string

func (*ProductionDrop) ParameterSz

func (pd *ProductionDrop) ParameterSz() string

func (*ProductionDrop) Payload

func (pd *ProductionDrop) Payload() string

Payload returns the formatted FERAG string for embedding in the message

func (*ProductionDrop) ProductReferenceNumbers

func (pd *ProductionDrop) ProductReferenceNumbers() string

ProductReferenceNumbers returns the string of TSL-formatted ProductReferenceNumbers

func (*ProductionDrop) SetAgentName

func (pd *ProductionDrop) SetAgentName(agentName string)

SetAgentName sets the agent name to a given string

func (*ProductionDrop) SetLimit

func (pd *ProductionDrop) SetLimit(limit int)

func (*ProductionDrop) SetMaxBundle

func (pd *ProductionDrop) SetMaxBundle(maxBundle int)

func (*ProductionDrop) SetMaxStack

func (pd *ProductionDrop) SetMaxStack(maxStack int)

func (*ProductionDrop) SetNumberOfCopies

func (pd *ProductionDrop) SetNumberOfCopies(numberOfCopies int)

SetNumberOfCopies sets the number of copies in the production drop

func (*ProductionDrop) SetParameterN

func (pd *ProductionDrop) SetParameterN(parameterN int)

func (*ProductionDrop) SetParameterSz

func (pd *ProductionDrop) SetParameterSz(parameterSz int)

func (*ProductionDrop) SetStandard

func (pd *ProductionDrop) SetStandard(standard int)

func (*ProductionDrop) SetTopsheetData

func (pd *ProductionDrop) SetTopsheetData(topsheetData string)

SetTopsheetData sets the topsheet data to a given string

func (*ProductionDrop) Standard

func (pd *ProductionDrop) Standard() string

func (*ProductionDrop) TopsheetData

func (pd *ProductionDrop) TopsheetData() string

TopsheetData returns the formatted topsheet data segment

type Route

type Route struct {
	ProductionDrops []*ProductionDrop
	// contains filtered or unexported fields
}

func NewRoute

func NewRoute() *Route

func (*Route) AddProductReferenceNumber

func (r *Route) AddProductReferenceNumber(prnr int)

func (*Route) AddProductionDrop

func (r *Route) AddProductionDrop(pd *ProductionDrop) error

func (*Route) GetRouteListEntry

func (r *Route) GetRouteListEntry() *RouteListEntry

func (*Route) GetRouteMessage

func (r *Route) GetRouteMessage() string

func (*Route) SetCopiesInRoute

func (r *Route) SetCopiesInRoute(copiesInRoute int)

func (*Route) SetEaMarker

func (ri *Route) SetEaMarker(eaMarker int)

func (*Route) SetEditionName

func (ri *Route) SetEditionName(editionName string)

func (*Route) SetLimit

func (ri *Route) SetLimit(limit int)

func (*Route) SetMaxBundle

func (ri *Route) SetMaxBundle(maxBundle int)

func (*Route) SetMaxStack

func (ri *Route) SetMaxStack(maxStack int)

func (*Route) SetParameterN

func (ri *Route) SetParameterN(parameterN int)

func (*Route) SetRampNumber

func (r *Route) SetRampNumber(rampNumber int)

func (*Route) SetRouteCode

func (r *Route) SetRouteCode(routeCode int)

func (*Route) SetRouteName

func (r *Route) SetRouteName(routeName string)

func (*Route) SetStandard

func (ri *Route) SetStandard(standard int)

func (*Route) SetTopsheetMarker

func (ri *Route) SetTopsheetMarker(topsheetMarker int)

func (*Route) SetTopsheetTemplateDirectory

func (ri *Route) SetTopsheetTemplateDirectory(topsheetTemplateDirectory int)

type RouteEnd

type RouteEnd struct {
	FeragMessage
	// contains filtered or unexported fields
}

RouteEnd is the struct that automatically ends a route definition

func NewRouteEnd

func NewRouteEnd() *RouteEnd

NewRouteEnd instantiates a new Route End struct and returns a pointer to it.

func (*RouteEnd) Message

func (re *RouteEnd) Message() string

Message returns the formatted FERAG string for the complete route end message

func (*RouteEnd) Payload

func (re *RouteEnd) Payload() string

Payload returns the formatted FERAG string for embedding in the message

func (*RouteEnd) RouteName

func (re *RouteEnd) RouteName() string

RouteName returns the formatted route name segment

func (*RouteEnd) SetRouteName

func (re *RouteEnd) SetRouteName(routeName string)

SetRouteName sets the route name field

type RouteInfo

type RouteInfo struct {
	FeragMessage
	// contains filtered or unexported fields
}

func NewRouteInfo

func NewRouteInfo() *RouteInfo

func (*RouteInfo) AddProductReferenceNumber

func (ri *RouteInfo) AddProductReferenceNumber(productReferenceNumber int)

func (*RouteInfo) EaAddressDefinition

func (ri *RouteInfo) EaAddressDefinition() string

func (*RouteInfo) EaMarker

func (ri *RouteInfo) EaMarker() string

func (*RouteInfo) EditionName

func (ri *RouteInfo) EditionName() string

func (*RouteInfo) Limit

func (ri *RouteInfo) Limit() string

func (*RouteInfo) MaxBundle

func (ri *RouteInfo) MaxBundle() string

func (*RouteInfo) MaxStack

func (ri *RouteInfo) MaxStack() string

func (*RouteInfo) Message

func (ri *RouteInfo) Message() string

func (*RouteInfo) ParameterN

func (ri *RouteInfo) ParameterN() string

func (*RouteInfo) ParameterSz

func (ri *RouteInfo) ParameterSz() string

func (*RouteInfo) Payload

func (ri *RouteInfo) Payload() string

func (*RouteInfo) ProductReferenceNumbers

func (ri *RouteInfo) ProductReferenceNumbers() string

func (*RouteInfo) RouteName

func (ri *RouteInfo) RouteName() string

func (*RouteInfo) SetEaAddressDefinition

func (ri *RouteInfo) SetEaAddressDefinition(eaAddressDefinition int)

func (*RouteInfo) SetEaMarker

func (ri *RouteInfo) SetEaMarker(eaMarker int)

func (*RouteInfo) SetEditionName

func (ri *RouteInfo) SetEditionName(editionName string)

func (*RouteInfo) SetLimit

func (ri *RouteInfo) SetLimit(limit int)

func (*RouteInfo) SetMaxBundle

func (ri *RouteInfo) SetMaxBundle(maxBundle int)

func (*RouteInfo) SetMaxStack

func (ri *RouteInfo) SetMaxStack(maxStack int)

func (*RouteInfo) SetParameterN

func (ri *RouteInfo) SetParameterN(parameterN int)

func (*RouteInfo) SetParameterSz

func (ri *RouteInfo) SetParameterSz(parameterSz int)

func (*RouteInfo) SetRouteName

func (ri *RouteInfo) SetRouteName(routeName string)

func (*RouteInfo) SetStandard

func (ri *RouteInfo) SetStandard(standard int)

func (*RouteInfo) SetTopsheetMarker

func (ri *RouteInfo) SetTopsheetMarker(topsheetMarker int)

func (*RouteInfo) SetTopsheetTemplateDirectory

func (ri *RouteInfo) SetTopsheetTemplateDirectory(topsheetTemplateDirectory int)

func (*RouteInfo) Standard

func (ri *RouteInfo) Standard() string

func (*RouteInfo) TopsheetMarker

func (ri *RouteInfo) TopsheetMarker() string

func (*RouteInfo) TopsheetTemplateDirectory

func (ri *RouteInfo) TopsheetTemplateDirectory() string

type RouteListEntry

type RouteListEntry struct {
	FeragMessage
	// contains filtered or unexported fields
}

RouteListEntry is the struct for one route entry in the list of routes

func NewRouteListEntry

func NewRouteListEntry() *RouteListEntry

NewRouteListEntry instantiates a new Route List Entry struct and returns a pointer to it.

func (*RouteListEntry) CopiesInRoute

func (r *RouteListEntry) CopiesInRoute() string

CopiesInRoute returns the formatted number of copies in the route

func (*RouteListEntry) Message

func (r *RouteListEntry) Message() string

Message returns the formatted FERAG string for the complete route list entry

func (*RouteListEntry) Payload

func (r *RouteListEntry) Payload() string

Payload returns the formatted FERAG string for embedding in the message

func (*RouteListEntry) RampNumber

func (r *RouteListEntry) RampNumber() string

RampNumber returns the formatted ramp number. Segment is returned only if the ramp number is set to a value.

func (*RouteListEntry) RouteCode

func (r *RouteListEntry) RouteCode() string

RouteCode returns the formatted route code.

func (*RouteListEntry) RouteName

func (r *RouteListEntry) RouteName() string

RouteName returns the formatted route name.

func (*RouteListEntry) SetCopiesInRoute

func (r *RouteListEntry) SetCopiesInRoute(copiesInRoute int)

SetCopiesInRoute set the number of copies in the route

func (*RouteListEntry) SetRampNumber

func (r *RouteListEntry) SetRampNumber(rampNumber int)

SetRampNumber sets the ramp number field to an integer value. A value of 0 is allowed.

func (*RouteListEntry) SetRouteCode

func (r *RouteListEntry) SetRouteCode(routeCode int)

SetRouteCode sets the route code field

func (*RouteListEntry) SetRouteName

func (r *RouteListEntry) SetRouteName(routeName string)

SetRouteName sets the route name field

type TitleEnd

type TitleEnd struct {
	FeragMessage
	// contains filtered or unexported fields
}

TitleEnd is the struct for the FERAG title info message (%2441)

func NewTitleEnd

func NewTitleEnd() *TitleEnd

NewTitleEnd returns a new TitleEnd struct

func (*TitleEnd) Message

func (ti *TitleEnd) Message() string

Message returns the complete FERAG-formatted message for title end

func (*TitleEnd) SetTitleName

func (ti *TitleEnd) SetTitleName(titleName string)

SetTitleName sets the title name segment (+40)

func (*TitleEnd) TitleName

func (ti *TitleEnd) TitleName() string

TitleName returns the title name segment (+40) FERAG-formatted

type TitleInfo

type TitleInfo struct {
	FeragMessage
	// contains filtered or unexported fields
}

TitleInfo is the struct for the FERAG title info message (%2440)

func NewTitleInfo

func NewTitleInfo() *TitleInfo

NewTitleInfo returns a new TitleInfo struct

func (*TitleInfo) AdditionalInfo

func (ti *TitleInfo) AdditionalInfo() string

AdditionalInfo returns the additional info segment (+08) FERAG-formatted. It is not returned if empty UNLESS the flag showEmptyAdditionalInfo is set to true.

func (*TitleInfo) CountryCode

func (ti *TitleInfo) CountryCode() string

CountryCode returns the country code segment (+97) FERAG-formatted

func (*TitleInfo) IssueReference

func (ti *TitleInfo) IssueReference() string

func (*TitleInfo) Message

func (ti *TitleInfo) Message() string

Message returns the complete FERAG-formatted message for title info

func (*TitleInfo) Payload

func (ti *TitleInfo) Payload() string

Payload returns the inner content for title info to be included in Message()

func (*TitleInfo) PrintObjectColor

func (ti *TitleInfo) PrintObjectColor() string

PrintObjectColor returns the print object color segment (+94) FERAG-formatted

func (*TitleInfo) PrintObjectName

func (ti *TitleInfo) PrintObjectName() string

PrintObjectName returns the print object name segment (+93) FERAG-formatted

func (*TitleInfo) PublicationDate

func (ti *TitleInfo) PublicationDate() string

PublicationDate returns the publication date segment (+95) FERAG-formatted

func (*TitleInfo) SetAdditionalInfo

func (ti *TitleInfo) SetAdditionalInfo(additionalInfo string)

SetAdditionalInfo sets the additional info segment (+08)

func (*TitleInfo) SetCountryCode

func (ti *TitleInfo) SetCountryCode(countryCode string)

SetCountryCode set the country code segment (+97)

func (*TitleInfo) SetIssueReference

func (ti *TitleInfo) SetIssueReference(issueReference string)

func (*TitleInfo) SetPrintObjectColor

func (ti *TitleInfo) SetPrintObjectColor(printObjectColor string)

SetPrintObjectColor sets the print object color segment (+94)

func (*TitleInfo) SetPrintObjectName

func (ti *TitleInfo) SetPrintObjectName(printObjectName string)

SetPrintObjectName sets the printObjectName segment (+93)

func (*TitleInfo) SetPublicationDate

func (ti *TitleInfo) SetPublicationDate(publicationDateString string)

SetPublicationDate sets the publication date segment (+95)

func (*TitleInfo) SetTitleName

func (ti *TitleInfo) SetTitleName(titleName string)

SetTitleName sets the title name segment (+40)

func (*TitleInfo) ShowEmptyAdditionalInfo

func (ti *TitleInfo) ShowEmptyAdditionalInfo()

ShowEmptyAdditionalInfo sets the flag showEmptyAdditionalInfo to true. The segment additional info is then shown even it is empty (+08).

func (*TitleInfo) TitleName

func (ti *TitleInfo) TitleName() string

TitleName returns the title name segment (+40) FERAG-formatted

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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