On Sun, Dec 09, 2007 at 11:46:48PM +0000, Angus Leeming wrote:
>     // I see that LyX.h defines "ref" and "cref" static functions
>     // to return reference and const reference views on the global
>     // instance_. It's probably best to do the same here...
>     static Tex2Lyx & Instance()
>     {
>         if (Tex2Lyx::instance_.get() == 0)
>         {
>             instance_.reset(new Tex2Lyx());
>         }
> 
>         return *instance_;
>     }
> 
>     string const & DocumentLanguage() { return documentLanguage_; }
> };
> 
> Your preamble.cpp code would then become:
> 
>     string const & documentLanguage = Tex2Lyx::Instance().DocumentLanguage();

Except, of course, that we use smallCamelBump() and not MicroSoft()
style.

SCNR ;-)

[Btw, this is one of the cases were I do not see actual benefits over
global variables. If we had several instances or needed complicated
construction/destruction matters would be different...]

Andre'


Reply via email to