Generic class for safe %variable substitution
Waldo Bastian
bastian at kde.org
Thu Jan 16 12:47:37 GMT 2003
On Monday 06 January 2003 16:51, Oswald Buddenhagen wrote:
> On Mon, Jan 06, 2003 at 01:14:27PM +0100, Waldo Bastian wrote:
> > On Sunday 22 December 2002 18:26, Oswald Buddenhagen wrote:
> > > moin!
> > >
> > > i was interrupted by various minor tasks, so it took me longer than
> > > expected. anyway, here is the result.
> > >
> > > the class names are somewhat scary. if you can think of equally
> > > descriptive shorter names, then yell.
> >
> > I think the goal should be to have all callable functions in the
> > "KMacroExpander" class and then the other stuff can be as hairy/scary as
> > you like. (And removed from the .h file)
>
> hmm, i tend to two classes: an abstract base class and a mixed
> KMacroMapExpander class. i'd prefer not to have the specialized
> functions in the base class. even the escapechar specialization is ugly,
> but calling a virtual function for every character seems insane.
>
> > What is the difference between KSelfDelimitingMacroMapExpander and
> > KHandDelimitedMacroMapExpander?
>
> selfdelimiting is printf-like: "text%macrotext"
> handdelimited is shell-like: "text%macro text" or "text%{macro}text" or
> "text%macro:text", etc.
>
> the question still remains: create static wrappers?
I have changed the API slightly and put the stuff in kdelibs/kdecore. There
are now 4 functions:
* 2 with and 2 without shell quoting
* 2 which take QMap<QChar,QString> and are selfdelimiting and
2 which take QMap<QString, QString> and are handdelimited.
I don't think that application developers will otherwise be able to make a
sensible choice between selfdelimiting and handdelimited.
I have moved the class declarations to the .cpp file since I don't expect that
anyone actually wants to derive from them. If I'm wrong we can always change
that later on.
Regression test in kdelibs/kdecore/tests/kmacroexpandertest
Feedback welcome.
Cheers,
Waldo
--
bastian at kde.org -=|[ SuSE, The Linux Desktop Experts ]|=- bastian at suse.com
More information about the kde-core-devel
mailing list