feat(cpp/inih): add inih parser_3
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
expected output:
|
expected output:
|
||||||
section: owner name: name value: John Doe
|
section: owner name: name value: John Doe
|
||||||
section: owner name: organization value: Acme Widgets Inc.
|
section: owner name: organization value: Acme Widgets Inc.
|
||||||
section: database name: server value: 192.0.2.62
|
section: database name: server value: 192.0.2.62
|
||||||
@@ -22,11 +22,11 @@ import (
|
|||||||
section: settings name: username value: lee
|
section: settings name: username value: lee
|
||||||
section: settings name: timeout value: 20
|
section: settings name: timeout value: 20
|
||||||
Config file parsed successfully
|
Config file parsed successfully
|
||||||
|
s : 192.0.2.62
|
||||||
isDatabaseEnabled: true port: 143
|
isDatabaseEnabled: true port: 143
|
||||||
0x10e2c8e20
|
0x109f54da0
|
||||||
0
|
0
|
||||||
value: 100
|
value: 100
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -38,8 +38,8 @@ func main() {
|
|||||||
}
|
}
|
||||||
isDatabaseEnabled := reader.GetBoolean(inih.Str("database"), inih.Str("enabled"), false)
|
isDatabaseEnabled := reader.GetBoolean(inih.Str("database"), inih.Str("enabled"), false)
|
||||||
port := reader.GetInteger(inih.Str("database"), inih.Str("port"), 0)
|
port := reader.GetInteger(inih.Str("database"), inih.Str("port"), 0)
|
||||||
s := reader.GetString(inih.Str("database"), inih.Str("server"), inih.Str("unknown")).String()
|
s := reader.GetString(inih.Str("database"), inih.Str("server"), inih.Str("unknown"))
|
||||||
println("s :", s)
|
println("s :", s.String())
|
||||||
println("isDatabaseEnabled:", isDatabaseEnabled, "port:", port)
|
println("isDatabaseEnabled:", isDatabaseEnabled, "port:", port)
|
||||||
demo2()
|
demo2()
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,6 @@ func (*Reader) GetBoolean(section *StdString, name *StdString, defaultValue bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
// llgo:link (*Reader).GetString C._ZNK9INIReader9GetStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_S8_
|
// llgo:link (*Reader).GetString C._ZNK9INIReader9GetStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_S8_
|
||||||
func (*Reader) GetString(section *StdString, name *StdString, defaultValue *StdString) *StdString {
|
func (*Reader) GetString(section *StdString, name *StdString, defaultValue *StdString) StdString {
|
||||||
return &StdString{}
|
return StdString{}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user