Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
November 30, 2003 INI files | ||||
---|---|---|---|---|
| ||||
Attachments: | I just made a portable module for reading and writing INI files. INI files come in handy! This code is public domain. Here's a little example: Ini ini = new Ini("foo.ini"); with(ini.addSection("mysection")) { value("keyname", "hello world"); } ini.save(); |
December 02, 2003 Re: INI files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vathix | Unit tests too! I like it. "Vathix" <vathix@dprogramming.com> wrote in message news:bqdfpi$125h$1@digitaldaemon.com... > I just made a portable module for reading and writing INI files. INI files come in handy! This code is public domain. Here's a little example: > > Ini ini = new Ini("foo.ini"); > with(ini.addSection("mysection")) > { > value("keyname", "hello world"); > } > ini.save(); > > > > > |
December 02, 2003 Re: INI files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vathix | Vathix wrote:
> I just made a portable module for reading and writing INI files. INI files
> come in handy! This code is public domain. Here's a little example:
>
> Ini ini = new Ini("foo.ini");
> with(ini.addSection("mysection"))
> {
> value("keyname", "hello world");
> }
> ini.save();
>
I'd thought of doing my own INI lib, now I guess I won't have to. I like your concept of wrapping sections into objects, very slick.
C. Sauls
Invironz
|
December 04, 2003 Re: INI files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vathix | I still love it, just wanted to throw in a few suggestions. First off, do you think IniSection.keys() might be rewritable to the following?: IniKey[] keys() { IniKey[] ikeys; foreach(IniKey ikey; this) { ikeys ~= ikey; } return ikeys; } I tried to preserve your coding style, but I think its a bit cleaner. Correct or ignore me if I missed an important reason for it being the way it already is. Also, could we get IniSection.value(IniKey, char[]) and IniSection.value(char[], char[]) to return the new value back to the calling expression? Makes for a more transparent interface in my opinion, but I'm odd. C. Sauls Invironz |
December 04, 2003 Re: INI files | ||||
---|---|---|---|---|
| ||||
Posted in reply to Chris Sauls | "Chris Sauls" <ibisbasenji@yahoo.com> wrote in message news:bqnis4$m4p$1@digitaldaemon.com... > I still love it, just wanted to throw in a few suggestions. First off, do you think IniSection.keys() might be rewritable to the following?: > > IniKey[] keys() > { > IniKey[] ikeys; > foreach(IniKey ikey; this) > { > ikeys ~= ikey; > } > return ikeys; > } > > I tried to preserve your coding style, but I think its a bit cleaner. Correct or ignore me if I missed an important reason for it being the way it already is. The way I have it, ikeys doesn't need to be reallocated at all. It might waste a few bytes, but I don't think it's enough to worry about. > > Also, could we get IniSection.value(IniKey, char[]) and IniSection.value(char[], char[]) to return the new value back to the calling expression? Makes for a more transparent interface in my opinion, but I'm odd. The way I see it is that you already have the value, why have the function do a bit more work when it doesn't need to :) - I know I'm way over concerned with efficiency. |
Copyright © 1999-2021 by the D Language Foundation