List Info

Thread: API design question




API design question
user name
2006-02-20 11:48:42
Alle 09:21, lunedì 20 febbraio 2006, Jürgen Schmidt ha
scritto:
> Hi Paolo,
>
> Paolo Mantovani wrote:
> > Hi,
> >
> > the css.util.XSearchable
> >
> > has the methods:
> > findFirst
> > findNext
> > findAll
> >
> > but the css.util.XReplaceable
> >
> > has only the method
> > replaceAll
> >
> > There are any design reasons for this missing?
>
> good question, i don't know. But i assume that
XReplaceable is simply a
> kind of shortcut when you know that you simply want to
replace all
> occurrences of for example a string in one step.
> With XSearchable you can search and iterate over all
occurrences and can
> decide for each occurrence what you want to do. In case
of searching
> string you get a XTextRange and simply modify it.
>
> For what should be a replaceFirst or replaceNext good
for? Do you want
> confirm each call with a second?
> Which use of this API do you have in mind? Can you give
me an example?

In effect, in a 'normal' use case I would accomplish the
thing exactly as you 
described.
Anyway I'm currently "translating" dispatch
commands to API calls.
As you know the S&R dialog in Calc allows the user to
replace occourrences one 
by one.
Translating this action in API calls not having
replaceFirst/Next methods is 
quite difficult (in my understanding), because of the number
of different 
scenarios that I need to manage.
I'm thinking for example to a replacement using regexp
(regexp are not 
implemented in StarBasic)


Thank you 
Paolo Mantovani





------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )