Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » Bazaar » Simple INI parser (15 mb in 4 s, DualCore 2500 Mhz)
Re: Simple INI parser (15 mb in 4 s, DualCore 2500 Mhz) [message #24511 is a reply to message #24458] Thu, 21 January 2010 18:55 Go to previous messageGo to previous message
Sc0rch is currently offline  Sc0rch
Messages: 99
Registered: February 2008
Location: Russia, Rubtsovsk
Member

IniFile 1.0 - Simple INI parser

Example of ini-file:
[Test]

Title = "Test \"Title\""

Name1 = "Value 1"
"Name 2" = Value2
Number = 1
Characters = \\\"\[\]\,\=
"Name with \\\"\[\]\,\=" = Value

["Section with \\\"\[\]\,\="]
Name = Value


Example of usage:
IniFile p;
p.Add("Test", "Name1", "Value 1");
p.Add("Test", "Name 2", "Value2");
p.AddInt("Test", "Number", 1);

p.Add("Test", "Characters", "\\\"[],=");
p.Add("Test", "Name with \\\"[],=", "Value");
p.Add("Section with \\\"[],=", "Name", "Value");

DUMP(p.Get("Test", "Name1")); // "Value 1" as result
DUMP(p.GetInt("Test", "Number")); // 1 as result
DUMP(p.Get("Test", "Characters")); // \"[],= as result

LOG(p.Dump());
p.Save(ConfigFile("Test1.ini", CHARSET_CP1251));
p.Clear();

p.Load(ConfigFile("Test1.ini", CHARSET_CP1251));
p.Save(ConfigFile("Test2.ini")); // CHARSET_DEFAULT


Version 1.0:
* bugfixes (most of them)
+ charsets support (Load("file...", CHARSET_CP1251) and Save)
+ added \ support to use the chars []=,\

Best regards!
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Very Simple Report Generator (Use QTF format)
Next Topic: GraphCtrl/GraphDraw Candidat to bazaar upload
Goto Forum:
  


Current Time: Tue Dec 01 02:32:45 CET 2020

Total time taken to generate the page: 0.01187 seconds