Documentation
¶
Overview ¶
Package ini provides structures and methods for parsing and managing INI files with special enhancements.
Index ¶
- Constants
- type MagicIni
- func (ini *MagicIni) Get(section string, key string) string
- func (ini *MagicIni) GetSectionKeys(section string) []string
- func (ini *MagicIni) GetSections() []string
- func (ini *MagicIni) LoadAdditionalIni(path string) error
- func (ini *MagicIni) LoadIni(path string) error
- func (ini *MagicIni) Parse(source string)
- func (ini *MagicIni) ParseKeyValue(line string)
- func (ini *MagicIni) ParseSection(line string)
- func (ini *MagicIni) ParseSectionInlineKeyValue(line string)
- func (ini *MagicIni) Save(path string) error
- func (ini *MagicIni) Set(section string, key string, value string)
- func (ini *MagicIni) Translate(str string) string
Constants ¶
const DEFAULT_TRANSLATABLE_SECTION = "MAGIC_LOGICAL_NAMES"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MagicIni ¶
type MagicIni struct { Ini map[string]map[string]string // Parsed INI content organized as Section -> Key -> Value. TranslatableSection string // Specifies the section containing translatable strings. SectionsOrder []string // Maintains the order of sections as they appear in the INI file. KeysOrder map[string][]string // Maintains the order of keys within sections. // contains filtered or unexported fields }
MagicIni represents the structured content of an INI file. It provides functionalities for parsing, modifying, and saving INI content.
func NewMagicIni ¶
func NewMagicIni() *MagicIni
NewMagicIni initializes a new MagicIni instance with default values. By default, it sets the translatable section as "MAGIC_LOGICAL_NAMES".
func (*MagicIni) Get ¶
Get fetches the value associated with a given key within a specified section.
func (*MagicIni) GetSectionKeys ¶
GetSectionKeys retrieves all key names from a specified section.
func (*MagicIni) GetSections ¶
ParseKeyValue processes a single key-value pair line.
func (*MagicIni) LoadAdditionalIni ¶
LoadAdditionalIni merges content from another INI file into the current instance. Useful for layering configurations or adding supplemental data.
func (*MagicIni) LoadIni ¶
LoadIni reads and parses the content of the INI file located at the specified path.
func (*MagicIni) ParseKeyValue ¶
ParseKeyValue processes a single key-value pair line.
func (*MagicIni) ParseSection ¶
ParseSection handles the parsing of a section declaration line.
func (*MagicIni) ParseSectionInlineKeyValue ¶
ParseSectionInlineKeyValue handles special case sections where a key-value pair is declared inline.