func (f *File) ChildSections(name string) []*Section {
	return f.Section(name).ChildSections()
}
ChildSections returns a list of child sections of given section name.
package ini
import (
	"bytes"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"strings"
	"sync"
)
type File struct {
	options     LoadOptions
	dataSources []dataSource
	BlockMode bool
	lock      sync.RWMutex
	sectionList []string
	sections map[string]*Section
	NameMapper
	ValueMapper
}
func newFile(dataSources []dataSource, opts LoadOptions) *File {
	if len(opts.KeyValueDelimiters) == 0 {
		opts.KeyValueDelimiters = "=:"
	}
	return &File{
		BlockMode:   true,
		dataSources: dataSources,
		sections:    make(map[string]*Section),
		sectionList: make([]string, 0, 10),
		options:     opts,
	}
}
func Empty() *File {
	f, _ := Load([]byte(""))
	return f
}
func (f *File) NewSection(name string) (*Section, error) {
	if len(name) == 0 {
		return nil, errors.New("error creating new section: empty section name")
	} else if f.options.Insensitive && name != DefaultSection {
		name = strings.ToLower(name)
	}
	if f.BlockMode {
		f.lock.Lock()
		defer f.lock.Unlock()
	}
	if inSlice(name, f.sectionList) {
		return f.sections[name], nil
	}
	f.sectionList = append(f.sectionList, name)
	f.sections[name] = newSection(f, name)
	return f.sections[name], nil
}
func (f *File) NewRawSection(name, body string) (*Section, error) {
	section, err := f.NewSection(name)
	if err != nil {
		return nil, err
	}
	section.isRawSection = true
	section.rawBody = body
	return section, nil
}
func (f *File) NewSections(names ...string) (err error) {
	for _, name := range names {
		if _, err = f.NewSection(name); err != nil {
			return err
		}
	}
	return nil
}
func (f *File) GetSection(name string) (*Section, error) {
	if len(name) == 0 {
		name = DefaultSection
	}
	if f.options.Insensitive {
		name = strings.ToLower(name)
	}
	if f.BlockMode {
		f.lock.RLock()
		defer f.lock.RUnlock()
	}
	sec := f.sections[name]
	if sec == nil {
		return nil, fmt.Errorf("section '%s' does not exist", name)
	}
	return sec, nil
}
func (f *File) Section(name string) *Section {
	sec, err := f.GetSection(name)
	if err != nil {
		sec, _ = f.NewSection(name)
		return sec
	}
	return sec
}
func (f *File) Sections() []*Section {
	if f.BlockMode {
		f.lock.RLock()
		defer f.lock.RUnlock()
	}
	sections := make([]*Section, len(f.sectionList))
	for i, name := range f.sectionList {
		sections[i] = f.sections[name]
	}
	return sections
}