Documentation ¶
Index ¶
- Variables
- func DumpBytesToString(data []byte) string
- func GetDictionaryFromParsedTags(pt ParsedTags) (distilled map[string]string)
- func GetModuleRootPath() string
- func GetSimpleDictionaryFromParsedTags(pt ParsedTags) (distilled map[string]string)
- func GetTestAssetsPath() string
- func GetTestDataFilepath() string
- func ParseStream(r io.Reader) (tags map[StreamTagKey][]TagData, err error)
- type ParsedTags
- type StreamTagInfo
- type StreamTagKey
- type Tag
- type TagData
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidTagMarker indicates that the tag can not be parsed because the // tag boundary marker is not the expected value. ErrInvalidTagMarker = errors.New("invalid tag marker") )
var ( // ErrTagNotStandard indicates that the given tag is not known among the // documented standard set. ErrTagNotStandard = errors.New("not a standard tag") )
Functions ¶
func DumpBytesToString ¶
DumpBytesToString returns a stringified list of hex-encoded bytes.
func GetDictionaryFromParsedTags ¶
func GetDictionaryFromParsedTags(pt ParsedTags) (distilled map[string]string)
GetDictionaryFromParsedTags returns all tags. It will keep non-printable values, though will not print a placeholder instead. This will keep non- standard tags (and print the fully-qualified dataset ID rather than the name). It will keep repeated values (with the counter value appended to the end).
func GetModuleRootPath ¶
func GetModuleRootPath() string
GetModuleRootPath returns the root-path of the module.
func GetSimpleDictionaryFromParsedTags ¶
func GetSimpleDictionaryFromParsedTags(pt ParsedTags) (distilled map[string]string)
GetSimpleDictionaryFromParsedTags returns a dictionary of tag names to tag values, where all values are strings and any tag that had a non-printable value is omitted. We will also only return the first value, therefore dropping any follow-up values for repeatable tags. This will ignore non- standard tags. This will trim whitespace from the ends of strings.
This is a convenience function for quickly displaying only the summary IPTC metadata that a user might actually be interested in at first glance.
func GetTestAssetsPath ¶
func GetTestAssetsPath() string
GetTestAssetsPath returns the path of the test-assets.
func GetTestDataFilepath ¶
func GetTestDataFilepath() string
GetTestDataFilepath returns the file-path of the common test-data.
func ParseStream ¶
func ParseStream(r io.Reader) (tags map[StreamTagKey][]TagData, err error)
ParseStream parses a serial sequence of tags and tag data out of the stream.
Types ¶
type ParsedTags ¶
type ParsedTags map[StreamTagKey][]TagData
ParsedTags is the complete, unordered set of tags parsed from the stream.
type StreamTagInfo ¶
type StreamTagInfo struct { // Description is the human-readable description of the tag. Description string }
StreamTagInfo encapsulates the properties of each tag.
func GetTagInfo ¶
func GetTagInfo(recordNumber, datasetNumber int) (sti StreamTagInfo, err error)
GetTagInfo return the info for the given tag. Returns ErrTagNotStandard if not known.
type StreamTagKey ¶
type StreamTagKey struct { // RecordNumber is the major classification of the dataset. RecordNumber uint8 // DatasetNumber is the minor classification of the dataset. DatasetNumber uint8 }
StreamTagKey is a convenience type that lets us key our index with a high- level type.
func (StreamTagKey) String ¶
func (stk StreamTagKey) String() string
String returns a descriptive string.
type Tag ¶
type Tag struct {
// contains filtered or unexported fields
}
Tag describes one tag read from the stream.
type TagData ¶
type TagData []byte
TagData is a convenience wrapper around a byte-slice.
func (TagData) IsPrintable ¶
IsPrintable returns true if all characters are printable.