gomdict

package
v1.2.1-0...-837fef5 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MdictTypeMdd MdictType = 1
	MdictTypeMdx MdictType = 2

	EncryptNoEnc      = 0
	EncryptRecordEnc  = 1
	EncryptKeyInfoEnc = 2
	NumfmtBe8bytesq   = 0
	NumfmtBe4bytesi   = 1
	EncodingUtf8      = 0
	EncodingUtf16     = 1
	EncodingBig5      = 2
	ENCODING_GBK      = 3
	ENCODING_GB2312   = 4
	EncodingGb18030   = 5
)

Variables

This section is empty.

Functions

func BuildRangeTree

func BuildRangeTree(list []*MdictRecordBlockInfoListItem, root *RecordBlockRangeTreeNode)

Types

type Dictionary

type Dictionary struct {
	XMLName                  xml.Name `xml:"Dictionary"`
	Text                     string   `xml:"chardata"`
	GeneratedByEngineVersion string   `xml:"GeneratedByEngineVersion,attr"`
	RequiredEngineVersion    string   `xml:"RequiredEngineVersion,attr"`
	Encrypted                string   `xml:"Encrypted,attr"`
	Encoding                 string   `xml:"IsUTF16,attr"`
	Format                   string   `xml:"Format,attr"`
	Stripkey                 string   `xml:"Stripkey,attr"`
	CreationDate             string   `xml:"creationDate,attr"`
	Compact                  string   `xml:"Compact,attr"`
	Compat                   string   `xml:"Compat,attr"`
	KeyCaseSensitive         string   `xml:"KeyCaseSensitive,attr"`
	Description              string   `xml:"Description,attr"`
	Title                    string   `xml:"Title,attr"`
	DataSourceFormat         string   `xml:"DataSourceFormat,attr"`
	StyleSheet               string   `xml:"StyleSheet,attr"`
	Left2Right               string   `xml:"Left2Right,attr"`
	RegisterBy               string   `xml:"RegisterBy,attr"`
}

Dictionary was generated 2023-09-11 11:07:50 by https://xml-to-go.github.io/ in Ukraine.

type MDictKeywordEntry

type MDictKeywordEntry struct {
	RecordStartOffset int64
	RecordEndOffset   int64
	KeyWord           string
	KeyBlockIdx       int64
}

type MDictKeywordIndex

type MDictKeywordIndex struct {
	//encoding                            int
	//encryptType                         int
	KeywordEntry MDictKeywordEntry
	RecordBlock  MDictKeywordIndexRecordBlock
}

type MDictKeywordIndexRecordBlock

type MDictKeywordIndexRecordBlock struct {
	DataStartOffset          int64
	CompressSize             int64
	DeCompressSize           int64
	KeyWordPartStartOffset   int64
	KeyWordPartDataEndOffset int64
}

type Mdict

type Mdict struct {
	*MdictBase
	// contains filtered or unexported fields
}

func New

func New(filename string) (*Mdict, error)

func (*Mdict) BuildIndex

func (mdict *Mdict) BuildIndex() error

BuildIndex 构建索引

func (*Mdict) CreationDate

func (mdict *Mdict) CreationDate() string

func (*Mdict) Description

func (mdict *Mdict) Description() string

func (*Mdict) Digest

func (mdict *Mdict) Digest() string

func (*Mdict) GeneratedByEngineVersion

func (mdict *Mdict) GeneratedByEngineVersion() string

func (*Mdict) GetKeyWordEntries

func (mdict *Mdict) GetKeyWordEntries() ([]*MDictKeywordEntry, error)

func (*Mdict) GetKeyWordEntriesSize

func (mdict *Mdict) GetKeyWordEntriesSize() int64

func (*Mdict) IsMDD

func (mdict *Mdict) IsMDD() bool

func (*Mdict) IsRecordEncrypted

func (mdict *Mdict) IsRecordEncrypted() bool

func (*Mdict) IsUTF16

func (mdict *Mdict) IsUTF16() bool

func (*Mdict) KeywordEntryToIndex

func (mdict *Mdict) KeywordEntryToIndex(item *MDictKeywordEntry) (*MDictKeywordIndex, error)

func (*Mdict) LocateByKeywordEntry

func (mdict *Mdict) LocateByKeywordEntry(entry *MDictKeywordEntry) ([]byte, error)

func (*Mdict) LocateByKeywordIndex

func (mdict *Mdict) LocateByKeywordIndex(index *MDictKeywordIndex) ([]byte, error)

func (*Mdict) Lookup

func (mdict *Mdict) Lookup(word string) ([]byte, error)

func (*Mdict) Name

func (mdict *Mdict) Name() string

func (*Mdict) Title

func (mdict *Mdict) Title() string

func (*Mdict) Version

func (mdict *Mdict) Version() string

type MdictAccessor

type MdictAccessor struct {
	Filepath          string `json:"filepath"`
	IsRecordEncrypted bool   `json:"is_record_encrypted"`
	IsMDD             bool   `json:"is_mdd"`
	IsUTF16           bool   `json:"is_utf_16"`
}

func NewAccessor

func NewAccessor(mdict *Mdict) *MdictAccessor

func NewAccessorFromJson

func NewAccessorFromJson(data []byte) (*MdictAccessor, error)

func (*MdictAccessor) RetrieveDefByIndex

func (mdi *MdictAccessor) RetrieveDefByIndex(index *MDictKeywordIndex) ([]byte, error)

func (*MdictAccessor) Serialize

func (mdi *MdictAccessor) Serialize() ([]byte, error)

type MdictBase

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

type MdictRecordBlockInfoListItem

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

func QueryRangeData

func QueryRangeData(root *RecordBlockRangeTreeNode, queryRange int64) *MdictRecordBlockInfoListItem

type MdictType

type MdictType int

type RecordBlockRangeTreeNode

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

Jump to

Keyboard shortcuts

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