inireader

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: GPL-3.0 Imports: 10 Imported by: 1

Documentation

Overview

Okay we need to create syntax. To augment currently possible stuff

Index

Constants

View Source
const (
	OPTIONAL_p = true
	REQUIRED_p = false
)
View Source
const KEY_COMMENT string = "00e0fc91e00300ed" // random hash

Variables

View Source
var CASE_SENSETIVE_KEYS = [...]string{"BGCS_base_run_by", "NavMapScale"}

Functions

This section is empty.

Types

type INIFile

type INIFile struct {
	File     *file.File
	Comments []string

	Sections []*Section

	// denormalization
	SectionMap map[inireader_types.IniHeader][]*Section

	// Enforce unique keys
	ConstraintUniqueSectionType map[string]inireader_types.IniHeader
}

func Read added in v0.17.0

func Read(fileref *file.File) *INIFile

func (*INIFile) AddSection

func (config *INIFile) AddSection(key inireader_types.IniHeader, section *Section)

func (INIFile) Write

func (config INIFile) Write(fileref *file.File) *file.File

type Param

type Param struct {
	Key       string
	Values    []UniValue
	IsComment bool     // if commented out
	First     UniValue // denormalization due to very often being needed
}

abc = qwe, 1, 2, 3, 4 abc is key qwe is first value qwe, 1, 2, 3, 4 are values ;abc = qwe, 1, 2, 3 is Comment

func (*Param) AddValue

func (p *Param) AddValue(value UniValue) *Param

func (Param) ToString

func (p Param) ToString() string

type Section

type Section struct {
	Type   inireader_types.IniHeader
	Params []*Param
	// denormialization of Param list due to being more comfortable
	ParamMap map[string][]*Param
}

[BaseGood] // this is Type abc = 123 // this is Param going into list and hashmap

func (*Section) AddParam

func (section *Section) AddParam(key string, param *Param)

func (*Section) AddParamToStart

func (section *Section) AddParamToStart(key string, param *Param)

func (*Section) GetParamBool

func (section *Section) GetParamBool(key string, optional bool, default_value bool) bool

func (*Section) GetParamInt

func (section *Section) GetParamInt(key string, optional bool) int

func (*Section) GetParamNumber

func (section *Section) GetParamNumber(key string, optional bool) ValueNumber

func (*Section) GetParamStr

func (section *Section) GetParamStr(key string, optional bool) string

func (*Section) GetParamStrToLower

func (section *Section) GetParamStrToLower(key string, optional bool) string

type UniValue

type UniValue interface {
	AsString() string
}

func UniParse

func UniParse(input string) (UniValue, error)

func UniParseF

func UniParseF(input string) UniValue

func UniParseFloat added in v0.8.0

func UniParseFloat(input float64, precision int) UniValue

func UniParseInt

func UniParseInt(input int) UniValue

func UniParseStr

func UniParseStr(input string) UniValue

type ValueBool

type ValueBool bool

func (ValueBool) AsString

func (v ValueBool) AsString() string

type ValueNumber

type ValueNumber struct {
	Value     float64
	Precision int
}

func (ValueNumber) AsString

func (v ValueNumber) AsString() string

type ValueString

type ValueString string

func (ValueString) AsString

func (v ValueString) AsString() string

func (ValueString) ToLowerValue

func (v ValueString) ToLowerValue() ValueString

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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