[MonoDevelop] Some changes to ambiences

Michael Hutchinson m.j.hutchinson at gmail.com
Fri Nov 28 13:39:35 EST 2008

On Fri, Nov 28, 2008 at 4:37 AM, Mike Krüger <mkrueger at novell.com> wrote:
> Hi
>> How about:
>> public abstract string GetString (IDomVisitable domVisitable,
>> OutputSettings settings);
>> public string GetString (IDomVisitable domVisitable, OutputFlags flags)
>> {
>>     return GetString (domVisitable, new OutputSettings (flags));
>> }
> It's more complicated to use than just the 'object' version for the
> ambience implementor. The ambience implementor uses a visitor pattern
> and gets the flags/settings object as object parameter. It's easier to
> use in this case.

How's at any harder? There's a single override to implement, and they
know that the argument is an OutputSettings object so they don't have
to do type checks. The OutputSettings object could even have
convenience properties for accessing the flags, e.g.
bool UseMarkup { get { return flags & OutputFlags.UseMarkup != 0; } }
The outputsettings object could handle the null checks on the
postprocessing delegates too, e.g.

public virtual string PostProcess (IDomVisitable domVisitable, string str)
    if (PostProcessHandler != null)
        return PostProcessHandler (domVisitable, str);
        return str;

Michael Hutchinson

More information about the Monodevelop-list mailing list