export the Region API for callbacks
This commit is contained in:
parent
19a8816827
commit
72c657c378
|
|
@ -58,6 +58,10 @@ func NewEditor(version *Version, srcFile string) (*Editor, error) {
|
||||||
return e, nil
|
return e, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (e *Editor) Region(str string) *Region {
|
||||||
|
return e.rgCache.Region(str)
|
||||||
|
}
|
||||||
|
|
||||||
// Load all the segments from the source file
|
// Load all the segments from the source file
|
||||||
func (e *Editor) loadSegments() error {
|
func (e *Editor) loadSegments() error {
|
||||||
var last *Segment = nil
|
var last *Segment = nil
|
||||||
|
|
@ -66,7 +70,7 @@ func (e *Editor) loadSegments() error {
|
||||||
|
|
||||||
_, _, iErr := IterateSegments(e.srcHandle, true, func(l string) {
|
_, _, iErr := IterateSegments(e.srcHandle, true, func(l string) {
|
||||||
// do nothing here
|
// do nothing here
|
||||||
}, nil, e.rgCache.Region, func(seg *Segment) error {
|
}, nil, e.Region, func(seg *Segment) error {
|
||||||
// version check
|
// version check
|
||||||
if len(seg.StartIP) != e.verison.Bytes {
|
if len(seg.StartIP) != e.verison.Bytes {
|
||||||
return fmt.Errorf("invalid ip segment(%s expected)", e.verison.Name)
|
return fmt.Errorf("invalid ip segment(%s expected)", e.verison.Name)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue