iniutils

package module
v0.0.0-...-73e0c68 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2017 License: BSD-2-Clause Imports: 7 Imported by: 0

README

iniutils

Mainly translated from TMemIniFile in Delphi(2007) RTL.

It's simple and VERY easy to use:

inifile := iniutils.NewIniFile(sysutils.GetApplicationPath()+"cfg.ini", false)
defer inifile.Close()
fmt.Println(inifile)
fmt.Printf("info.name=%s\n", inifile.ReadString("info", "name", "ecofast"))

or:
fmt.Println(iniutils.IniReadString("cfg.ini", "test", "value", "inidemo"))

Note:
This repo is NO longer maintained, you can use RTL instead.

Documentation

Overview

Package iniutils was translated from TMemIniFile in Delphi(2007) RTL, which loads an entire INI file into memory and allows all operations to be performed on the memory image. The image can then be written out to the disk file.

Index

Constants

View Source
const (
	LineEndings = "\n" // OS-specific line endings
)

Variables

This section is empty.

Functions

func IniDeleteIdent

func IniDeleteIdent(fileName, section, ident string)

func IniEraseSection

func IniEraseSection(fileName, section string)

func IniIdentExists

func IniIdentExists(fileName, section, ident string) bool

func IniReadInt

func IniReadInt(fileName, section, ident string, defaultValue int) int

func IniReadSectionIdents

func IniReadSectionIdents(fileName, section string) []string

func IniReadSectionValues

func IniReadSectionValues(fileName, section string) []string

func IniReadSections

func IniReadSections(fileName string) []string

func IniReadString

func IniReadString(fileName, section, ident, defaultValue string) string

func IniSectionExists

func IniSectionExists(fileName, section string) bool

func IniWriteInt

func IniWriteInt(fileName, section, ident string, value int)

func IniWriteString

func IniWriteString(fileName, section, ident, value string)

Types

type IniFile

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

func NewIniFile

func NewIniFile(filename string, casesensitive bool) *IniFile

func (*IniFile) CaseSensitive

func (ini *IniFile) CaseSensitive() bool

func (*IniFile) Close

func (ini *IniFile) Close()

func (*IniFile) DeleteIdent

func (ini *IniFile) DeleteIdent(section, ident string)

func (*IniFile) EraseSection

func (ini *IniFile) EraseSection(section string)

func (*IniFile) FileName

func (ini *IniFile) FileName() string

func (*IniFile) IdentExists

func (ini *IniFile) IdentExists(section, ident string) bool

func (*IniFile) ReadBool

func (ini *IniFile) ReadBool(section, ident string, defaultValue bool) bool

func (*IniFile) ReadFloat

func (ini *IniFile) ReadFloat(section, ident string, defaultValue float64) float64

func (*IniFile) ReadInt

func (ini *IniFile) ReadInt(section, ident string, defaultValue int) int

func (*IniFile) ReadSectionIdents

func (ini *IniFile) ReadSectionIdents(section string) []string

func (*IniFile) ReadSectionValues

func (ini *IniFile) ReadSectionValues(section string) []string

func (*IniFile) ReadSections

func (ini *IniFile) ReadSections() []string

func (*IniFile) ReadString

func (ini *IniFile) ReadString(section, ident, defaultValue string) string

func (*IniFile) SectionExists

func (ini *IniFile) SectionExists(section string) bool

func (*IniFile) String

func (ini *IniFile) String() string

func (*IniFile) WriteBool

func (ini *IniFile) WriteBool(section, ident string, value bool)

func (*IniFile) WriteFloat

func (ini *IniFile) WriteFloat(section, ident string, value float64)

func (*IniFile) WriteInt

func (ini *IniFile) WriteInt(section, ident string, value int)

func (*IniFile) WriteString

func (ini *IniFile) WriteString(section, ident, value string)

Jump to

Keyboard shortcuts

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