Documentation
¶
Index ¶
- type QrElement
- type QrElements
- func (elem *QrElements) FromPNGs(files []string) error
- func (elements *QrElements) Len() int
- func (elements *QrElements) Less(i, j int) bool
- func (elem *QrElements) StoreData(fileObject *QrFile) error
- func (elements *QrElements) Swap(i, j int)
- func (elem *QrElements) WritePNGs(workPath string, fnamePrefix string) error
- type QrFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type QrElement ¶
type QrElement struct {
Index uint64
MaxIndex uint64
PayloadLength uint64 // nescessary to store this since we will pad up to max length
Payload string
}
QrElement describes the data stored inside a single QR image
func GetElement ¶
GetElement creates a single QrElement
func (*QrElement) ParsePNG ¶
ParsePNG parses a png image. This makes use of zbarimg from the zbar suite (http://zbar.sourceforge.net/) for parsing.
func (*QrElement) ParseString ¶
ParseString is used during conversion from a parsed QR code. This parses the string contents & stores them in the QrElement.
type QrElements ¶
type QrElements struct {
Elements []QrElement
}
QrElements is a collection of QrElement entries; provides global methods such as QR creation etc. Implements sort.Interface
func GetElements ¶
func GetElements(payload string) (elements *QrElements, err error)
GetElements creates a number of elements from a given string to be stored (usually a hex-encoded string containing the data of a given file)
func MakeQrElements ¶
func MakeQrElements(elementCount uint64) *QrElements
MakeQrElements prepares the data structure QrElements with a pre-defined element count. Used in GetElements.
func (*QrElements) FromPNGs ¶
func (elem *QrElements) FromPNGs(files []string) error
FromPNGs reads a set of png files & stores their contents in a set of QrElement structs. Also provides basic sanity tests (complete set, no duplicates etc...). The file list may contain wildcards (each entry is parsed using filepath.Glob)
func (*QrElements) Len ¶
func (elements *QrElements) Len() int
func (*QrElements) Less ¶
func (elements *QrElements) Less(i, j int) bool
func (*QrElements) StoreData ¶
func (elem *QrElements) StoreData(fileObject *QrFile) error
StoreData writes the data stored in all QrElement structs in a provided QrFile object. The QrFile object then is used to write the contents to disc.
func (*QrElements) Swap ¶
func (elements *QrElements) Swap(i, j int)
type QrFile ¶
Data types QrFile provides means to read and write the input or output files (not the PNGs, though) zbar (http://zbar.sourceforge.net/) ist used for reading/interpreting qr code images. zbarimg needs to be available in PATH
func (*QrFile) ReadFile ¶
ReadFile reads the file defined by Fname (in binary mode) and stores in in the internal buffer
func (*QrFile) ToFile ¶
ToFile stores the data contained in the QrFile instance to a file (filename stored in QrFile instance as well)
func (*QrFile) ToHexString ¶
ToHexString provides the file contents encoded in a hex string