From: Matthew G. <mat...@gm...> - 2008-01-26 01:05:22
Attachments:
StelIniParser.tar.gz
|
I took the code from the parser example I posted to this list recently, and integrated it into Stellarium. It seems to work fine in so far as the QSettings object is currently used for reading the config for some classes. The call to str_to_vec3f changes back to a string call rather than QStringList. It doesn't suffer from the " (longitude) problem, and copes with comments properely (i.e. doesn't consider them to be keys and/or values). Fabien, I'd like to add this to SVN (attachment - untar in src dir). You can modify the QT ini parser code and replace it later if you like. I looked at the QT code, and it's a lot more compicated than mine. It also stills to be modified to handle comments and quotes how we want it to. The QT parser does everything char by char or with basic string operations, making it a lot harder to understand than mine, which uses QRegExp to do all the work. While it might be better tested and is probably more efficient than my code, it seems like a lot of effort for not much benefit. Matthew |
From: <fab...@go...> - 2008-01-27 17:36:31
|
Hi, My idea was just to keep things simple, so if it's simpler with mailing list code it's fine for me. Fab On Jan 26, 2008 2:05 AM, Matthew Gates <mat...@gm...> wrote: > I took the code from the parser example I posted to this list recently, > and > integrated it into Stellarium. It seems to work fine in so far as the > QSettings object is currently used for reading the config for some > classes. > The call to str_to_vec3f changes back to a string call rather than > QStringList. > > It doesn't suffer from the " (longitude) problem, and copes with comments > properely (i.e. doesn't consider them to be keys and/or values). > > Fabien, I'd like to add this to SVN (attachment - untar in src dir). You > can > modify the QT ini parser code and replace it later if you like. I looked > at the QT code, and it's a lot more compicated than mine. It also stills > to be modified to handle comments and quotes how we want it to. > > The QT parser does everything char by char or with basic string > operations, > making it a lot harder to understand than mine, which uses QRegExp to do > all the work. While it might be better tested and is probably more > efficient than my code, it seems like a lot of effort for not much > benefit. > > > Matthew > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Stellarium-pubdevel mailing list > Ste...@li... > https://lists.sourceforge.net/lists/listinfo/stellarium-pubdevel > > |
From: Matthew G. <mat...@gm...> - 2008-01-27 18:34:56
|
OK, I have committed it. There are some drawbacks, perhaps which we might want to change before the= =20 next release. e.g. the order of sections within the file are not preserved= =20 when it is saved. If we write a class to store state like this for each=20 ini file, we might also be able to write something to preserve comments on= =20 saving. All init(const InitParser&) members have been replaced with init(), and I=20 updated the StelModule base class to make init() pure virtual (so we need=20 to update all modules). StelApp::init also reads settings using the=20 StelApp::confSettings object now. There are still some InitParser usages to remove (for saving config.ini and= =20 for other ini files parsing than the main config.ini file). I shall=20 continue to work on these over the next week. Matthew On Sunday 27 January 2008, Fabien Ch=C3=A9reau wrote: > Hi, > My idea was just to keep things simple, so if it's simpler with mailing > list code it's fine for me. > Fab > > On Jan 26, 2008 2:05 AM, Matthew Gates <mat...@gm...> wrote: > > I took the code from the parser example I posted to this list recently, > > and > > integrated it into Stellarium. It seems to work fine in so far as the > > QSettings object is currently used for reading the config for some > > classes. > > The call to str_to_vec3f changes back to a string call rather than > > QStringList. > > > > It doesn't suffer from the " (longitude) problem, and copes with > > comments properely (i.e. doesn't consider them to be keys and/or > > values). > > > > Fabien, I'd like to add this to SVN (attachment - untar in src dir). > > You can > > modify the QT ini parser code and replace it later if you like. I > > looked at the QT code, and it's a lot more compicated than mine. It > > also stills to be modified to handle comments and quotes how we want it > > to. > > > > The QT parser does everything char by char or with basic string > > operations, > > making it a lot harder to understand than mine, which uses QRegExp to > > do all the work. While it might be better tested and is probably more > > efficient than my code, it seems like a lot of effort for not much > > benefit. > > > > > > Matthew > > > > > > ----------------------------------------------------------------------- > >-- This SF.net email is sponsored by: Microsoft > > Defy all challenges. Microsoft(R) Visual Studio 2008. > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > _______________________________________________ > > Stellarium-pubdevel mailing list > > Ste...@li... > > https://lists.sourceforge.net/lists/listinfo/stellarium-pubdevel |
From: <fab...@go...> - 2008-01-28 10:25:28
|
Well done! Fab On Jan 27, 2008 7:34 PM, Matthew Gates <mat...@gm...> wrote: > OK, I have committed it. > > There are some drawbacks, perhaps which we might want to change before th= e > next release. e.g. the order of sections within the file are not > preserved > when it is saved. If we write a class to store state like this for each > ini file, we might also be able to write something to preserve comments o= n > saving. > > All init(const InitParser&) members have been replaced with init(), and I > updated the StelModule base class to make init() pure virtual (so we need > to update all modules). StelApp::init also reads settings using the > StelApp::confSettings object now. > > There are still some InitParser usages to remove (for saving config.inian= d > for other ini files parsing than the main config.ini file). I shall > continue to work on these over the next week. > > > Matthew > > > > On Sunday 27 January 2008, Fabien Ch=E9reau wrote: > > Hi, > > My idea was just to keep things simple, so if it's simpler with mailing > > list code it's fine for me. > > Fab > > > > On Jan 26, 2008 2:05 AM, Matthew Gates <mat...@gm...> wrote: > > > I took the code from the parser example I posted to this list > recently, > > > and > > > integrated it into Stellarium. It seems to work fine in so far as th= e > > > QSettings object is currently used for reading the config for some > > > classes. > > > The call to str_to_vec3f changes back to a string call rather than > > > QStringList. > > > > > > It doesn't suffer from the " (longitude) problem, and copes with > > > comments properely (i.e. doesn't consider them to be keys and/or > > > values). > > > > > > Fabien, I'd like to add this to SVN (attachment - untar in src dir). > > > You can > > > modify the QT ini parser code and replace it later if you like. I > > > looked at the QT code, and it's a lot more compicated than mine. It > > > also stills to be modified to handle comments and quotes how we want > it > > > to. > > > > > > The QT parser does everything char by char or with basic string > > > operations, > > > making it a lot harder to understand than mine, which uses QRegExp to > > > do all the work. While it might be better tested and is probably mor= e > > > efficient than my code, it seems like a lot of effort for not much > > > benefit. > > > > > > > > > Matthew > > > > > > > > > > ----------------------------------------------------------------------- > > >-- This SF.net email is sponsored by: Microsoft > > > Defy all challenges. Microsoft(R) Visual Studio 2008. > > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > > _______________________________________________ > > > Stellarium-pubdevel mailing list > > > Ste...@li... > > > https://lists.sourceforge.net/lists/listinfo/stellarium-pubdevel > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Stellarium-pubdevel mailing list > Ste...@li... > https://lists.sourceforge.net/lists/listinfo/stellarium-pubdevel > |