Documentation
¶
Overview ¶
The parse package contains structures and functions for parsing Mo/Po files with the respective options.
Index ¶
- Constants
- func Mo(path string, opts ...MoOption) (*po.File, error)
- func MoFromBytes(b []byte, name string, opts ...MoOption) (*po.File, error)
- func MoFromFile(f *os.File, opts ...MoOption) (*po.File, error)
- func MoFromReader(r io.Reader, name string, opts ...MoOption) (*po.File, error)
- func Po(path string, opts ...PoOption) (*po.File, error)
- func PoFromBytes(b []byte, name string, opts ...PoOption) (*po.File, error)
- func PoFromFile(f *os.File, opts ...PoOption) (*po.File, error)
- func PoFromReader(r io.Reader, name string, opts ...PoOption) (*po.File, error)
- func PoFromString(s, name string, opts ...PoOption) (*po.File, error)
- type Endianness
- type MoConfig
- type MoOption
- type MoParser
- type PoConfig
- type PoOption
- func PoWithCleanDuplicates(cd bool) PoOption
- func PoWithConfig(cfg PoConfig) PoOption
- func PoWithCustomObsoletePrefix(r rune) PoOption
- func PoWithIgnoreAllComments(iag bool) PoOption
- func PoWithIgnoreComments(ig bool) PoOption
- func PoWithLogger(logger *log.Logger) PoOption
- func PoWithParseObsolete(p bool) PoOption
- func PoWithSkipHeader(s bool) PoOption
- func PoWithUseCustomObsoletePrefix(u bool) PoOption
- func PoWithVerbose(v bool) PoOption
- type PoParser
- func NewPo(path string, options ...PoOption) (*PoParser, error)
- func NewPoFromBytes(data []byte, name string, options ...PoOption) *PoParser
- func NewPoFromFile(f *os.File, options ...PoOption) (*PoParser, error)
- func NewPoFromReader(r io.Reader, name string, options ...PoOption) (*PoParser, error)
- func NewPoFromString(s, name string, options ...PoOption) *PoParser
Constants ¶
View Source
const ( LittleEndian = util.LittleEndian BigEndian = util.BigEndian NativeEndian = util.NativeEndian )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Endianness ¶ added in v2.3.0
type Endianness = util.Endianness
type MoConfig ¶ added in v2.3.0
type MoConfig struct {
// The logger can be nil, otherwise this logger will be used to print all errors by default.
Logger *log.Logger
// Specifies the endianness to work with,
// if [NativeEndian], the endianness
// automatically determined by the magic number will be used,
// otherwise, the specified endianness will be used.
Endianness Endianness
// Causes parsing to fail if the entries are not sorted properly.
MustBeSorted bool
// contains filtered or unexported fields
}
func DefaultMoConfig ¶ added in v2.3.0
func (*MoConfig) ApplyOptions ¶ added in v2.3.0
Overwrite the configuration with the options provided, saving the previous state so that it can be restored later with MoConfig.RestoreLastCfg if desired.
func (*MoConfig) RestoreLastCfg ¶ added in v2.3.0
func (mc *MoConfig) RestoreLastCfg()
Restores the configuration state prior to the last MoConfig.ApplyOptions if it exists, otherwise it does nothing.
type MoOption ¶ added in v2.3.0
type MoOption func(*MoConfig)
func MoWithConfig ¶ added in v2.3.0
func MoWithEndianness ¶ added in v2.3.0
func MoWithEndianness(e Endianness) MoOption
func MoWithLogger ¶ added in v2.5.0
func MoWithMustBeSorted ¶ added in v2.5.0
type MoParser ¶
type MoParser struct {
Config MoConfig
// contains filtered or unexported fields
}
func NewMoFromReader ¶
type PoConfig ¶
type PoConfig struct {
IgnoreComments bool
IgnoreAllComments bool
// The logger can be nil, otherwise this logger will be used to print all errors by default.
Logger *log.Logger
Verbose bool
SkipHeader bool
CleanDuplicates bool
ParseObsoletes bool
UseCustomObsoletePrefix bool
CustomObsoletePrefix rune
// contains filtered or unexported fields
}
func DefaultPoConfig ¶
func (*PoConfig) ApplyOptions ¶
Overwrite the configuration with the options provided, saving the previous state so that it can be restored later with PoConfig.RestoreLastCfg if desired.
func (*PoConfig) RestoreLastCfg ¶
func (p *PoConfig) RestoreLastCfg()
Restores the configuration state prior to the last PoConfig.ApplyOptions if it exists, otherwise it does nothing.
type PoOption ¶
type PoOption func(*PoConfig)
func PoWithCleanDuplicates ¶
func PoWithConfig ¶
func PoWithIgnoreAllComments ¶
func PoWithIgnoreComments ¶
func PoWithLogger ¶
func PoWithParseObsolete ¶
func PoWithSkipHeader ¶
func PoWithVerbose ¶ added in v2.5.0
type PoParser ¶
type PoParser struct {
Config PoConfig
// contains filtered or unexported fields
}
func NewPoFromReader ¶
func NewPoFromString ¶
Click to show internal directories.
Click to hide internal directories.
