Re: [Wconsole-devel] Useful STL Classes
Status: Pre-Alpha
Brought to you by:
abzero
|
From: Evan M. <eva...@bt...> - 2002-02-13 22:23:36
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Steven,
Yes i did mean to overload AddFunction so that you can add a function
using parameters or using a CFunction class. I thought it would add
flexibility.
About the tmp, I was assuming (as i'm not an expert on these things) that
when you push into the list it creates a copy inside the list. So the
problem with scope is not a worry?
Evan,
At 09:09 PM 12/02/2002 -0800, Steven Kilby wrote:
>Evan,
>
>Did you mean to overload AddFunction? Also, aren't you adding a temporary
>variable (tmp) to the list? tmp will go out of scope once the function
>ends.
>
>Steven
>
>////////////////////////////////////////////////////////////////////////////
>//////////////
>int CFunctionList::AddFunction (CFunction &pCFunc)
>{
> FunctionList.push_back (pCFunc);
> nFunctions++;
>#ifdef _DEBUG
> char buffer[1024];
> wsprintf(buffer, "AddFunction: %s", pCFunc.GetName);
> LOG(buffer);
>#endif
> return 1;
>}
>////////////////////////////////////////////////////////////////////////////
>//////////////
>int CFunctionList::AddFunction (string ModName, int ModIdx, string
>FunctionName, string FunctionHelp, MODFUNC pmf)
>{
> CFunction tmp (ModName, ModIdx, FunctionName, FunctionHelp, pmf);
> FunctionList.push_back(tmp);
>
>#ifdef _DEBUG
> char buffer[1024];
> wsprintf(buffer, "AddFunction: %s", FunctionName.c_str());
> LOG(buffer);
>#endif
> return 1;
>}
>////////////////////////////////////////////////////////////////////////////
>//////////////
>
>----- Original Message -----
>From: "Evan Marchant" <eva...@bt...>
>To: <wco...@li...>
>Sent: Thursday, January 10, 2002 2:11 PM
>Subject: Re: [Wconsole-devel] Useful STL Classes
>
>
> >
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > Hey,
> > With the STL, as i've started working on at (i'm porting the StatusWindow
> > and ConsoleWindow at the moment)
> > its not too bad, and has cleared up some code.
> > I really at the moment can only see a usage for <list> and <string>.
> > Which is basically to replace my link list code, and all the char *'s.
> > Nothing wrong with the other containers, just i can't see a straight port.
> > I agree about the Classes in the bottom, most will (at this point)
> > be straight rewrite of existing code, that is related.
> > Unless anything is ridiculously wrong with with the design, should we get
> > started?,
> > oh yeah, we need to flesh out the design slightly (methods etc..)
> > Some of the Classes are a bit vague on design.
> >
> > I propose we delegate the tasks as follows:
> >
> > Main *
> > CFunction * Evan
> >
> > CErrorHandler * Dimiter
> > CModule * (You have three because Module and
>ModuleManage
> > would need to be written, togetherish)
> > CModuleManager *
> >
> > CCmdProcessor *
> > CConfig * Steven
> >
> > Sidd: I havn't included you, but see what you want to do, depending on all
> > the info flying around,
> >
> > Of cause if you want to swap modules that fine. We haven't fleshed them
>out
> > yet.
> > Evan,
> > At 02:08 PM 10/01/2002 +0200, you wrote:
> > >Hello,
> > >
> > >After becoming familiar with STL classes more thoroughly,
> > >I think we could use these in our project:
> > >
> > >1) string in <string>
> > >2) vector - as a dynamic array, in <vector>
> > >3) valarray - maybe as a dynamic array that needs applying
> > >arithmetical operations as a whole, in <valarray>
> > >4) pair and map - for pairs of items, like command name
> > >and function pointer _or_ FUNCTION_INFO struct and the
> > >module info as a struct, in <utility> and <map>
> > >5) stack and queue - for delayed processing or caching,
> > >in <stack> and <queue>
> > >6) list - for a linked list, in <list>
> > >
> > >We could also define these classes, as Evan pointed out:
> > >1) CFunction - like FUNCTION_INFO but with the necessary
> > >operators so it could be used with STL.
> > >2) CModule - like the above, but describes one loaded
> > >module.
> > >3) CErrorHandler - a descendant of STL's exception to be
> > >able to throw our own exceptions (and maybe also write
> > >the errors to a log or smth.).
> > >4) CModuleManager - implements the module loading/
> > >unloading/searching/etc. by using an internal list
> > >object or similar _and_ the ability to call functions
> > >from that modules (i.e. has also an internal list for
> > >the loaded routines, maybe using a map object).
> > >5) CCmdProcessor - ability to parse commands and queue
> > >them in a STL queue class for execution (the queuing
> > >will allow to employ command history, etc.).
> > >6) CConfig - for storing configuration data (in the
> > >registry or in a file, ex. XML) - every class that
> > >needs this functionality will be a descendant of this.
> > >
> > >We should also use exception handling, the C++ style,
> > >with try and catch().
> > >
> > >This is my proposal, tell me what you think :)
> > >Regards,
> > >Dimiter
> > >
> > >_______________________________________________
> > >Wconsole-devel mailing list
> > >Wco...@li...
> > >https://lists.sourceforge.net/lists/listinfo/wconsole-devel
> >
> >
> > Evan Marchant
> > eva...@bt...
> >
> > -----BEGIN PGP SIGNATURE-----
> > Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
> >
> > iQA/AwUBPD4RhCi6Rn1gme9zEQKLCgCfXiHziXLrgdkI0WosoWlnxmrRvroAn1RM
> > aFlVKAkgYDNCy8+Hsh/8FAeO
> > =0hqg
> > -----END PGP SIGNATURE-----
> >
> >
> > _______________________________________________
> > Wconsole-devel mailing list
> > Wco...@li...
> > https://lists.sourceforge.net/lists/listinfo/wconsole-devel
> >
> >
>
>
>
>_______________________________________________
>Wconsole-devel mailing list
>Wco...@li...
>https://lists.sourceforge.net/lists/listinfo/wconsole-devel
Evan Marchant
eva...@bt...
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBPGrm1Ci6Rn1gme9zEQJTbACfcBH8pe4RqHZdDcTM2HZkHbSVO5wAn1Xb
04Y6Y385Q3lseD+XT14qq+QU
=SuW/
-----END PGP SIGNATURE-----
|