diff options
Diffstat (limited to 'tomlplusplus/examples/example.toml')
| -rw-r--r-- | tomlplusplus/examples/example.toml | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/tomlplusplus/examples/example.toml b/tomlplusplus/examples/example.toml new file mode 100644 index 0000000000..9612b5301f --- /dev/null +++ b/tomlplusplus/examples/example.toml @@ -0,0 +1,102 @@ +# This is a TOML document. Boom. + +title = "TOML Example" + +# plain signed integers +int1 = -9223372036854775808 +int2 = 9223372036854775807 + +# floats +flt1 = 0.00000000001 +flt2 = 1e-11 +flt3 = 11.0 +flt4 = +1.0 + +# hexadecimal with prefix `0x` +hex1 = 0xDEADBEEF +hex2 = 0xdeadbeef +hex3 = 0xdead_beef + +# octal with prefix `0o` +oct1 = 0o01234567 +oct2 = 0o755 # useful for Unix file permissions + +# binary with prefix `0b` +bin1 = 0b11010110 # 214 + +# local dates and times +tim1 = 07:32:00 +tim2 = 00:32:00.100000000 +dat1 = 1979-05-27 + +# offset date-times +odt1 = 1979-05-27T07:32:00Z +odt2 = 1979-05-27T00:32:00-07:00 +odt3 = 1979-05-27T00:32:00.999999-07:00 + +# strings +str1 = """ +This is a +multi-line +string. +""" +str2 = "This is also\na multi-line\nstring." +str3 = 'C:\highway\to\the\danger\zone' +kosme = "κόσμε" # unicode! + +arr = [ 'this', 'is', 'a', 'long', 'array', 'with', 16, 'elements.', 'it', 'should', 'be', 'printed', 'as', 'a', 'multiline', 'array.'] + +tab = { this = 'is', an = 'inline', table = 'yay'} + +dotted.keys.are = "supported" +dotted.and = "implemented as tables" + +[owner] +name = "Mark Gillard" +dob = 1987-03-16 10:20:00+09:30 + + [[owner.pets]] + name = "Brian" + species = "cat" + + [[owner.pets]] + name = "Skippy" + species = "kangaroo" + +[database] +server = "192.168.1.1" +ports = [ 8001, 8001, 8002 ] +connection_max = 5000 +enabled = true + +[servers] + + # You can indent as you please. Tabs or spaces. TOML don't care. + [servers.alpha] + ip = "10.0.0.1" + dc = "eqdc10" + + [servers.beta] + ip = "10.0.0.2" + dc = "eqdc10" + country = "中国" # This should be parsed as UTF-8 + +[clients] +data = [ ["gamma", "delta"], [1, 2] ] # just an update to make sure parsers support it + +# Line breaks are OK when inside arrays +hosts = [ + "alpha", + "omega" +] + +# Products + + [[products]] + name = "Hammer" + sku = 738594937 + + [[products]] + name = "Nail" + sku = 284758393 + color = "gray" |
