[Libreoffice] [Pushed] Macro Cleanup in UNO

Norbert Thiebaud nthiebaud at gmail.com
Sun Oct 31 22:50:35 PDT 2010


On Sun, Oct 31, 2010 at 11:44 PM, Joseph Powers <jpowers27 at cox.net> wrote:
> In UNO land, each header would declare macros to make defining the class
> easier; however, these macros where never used outside of the header they
> where declared in. Thus we'd get the following:
>
> #define UNO3_ANY ::com::sun::star::uno::Any
>
> #define UNO3_RECTANGLE ::com::sun::star::awt::Rectangle
>
> class {
>
> … some code using the above macros.
>
> }
>
> The problem with above code, is now UNO3_ANY is defined everywhere the
> header is included. The second issue I have is that Rectangle is part of awt
> and not uno so why is the macro UNO3.
>
> I modified the code so the macros only override the name space and not the
> function (I hate uppercase only); thus, I now have CSS_UNO for
> ::com::sun::star::uno and CSS_AWT for ::com::sun::star::awt. I also added
> #undefs to the bottom of the header to drop the name space overrides.
>
> While there I discovered that the header
> components/UnoControls/inc/definesunocontrols.hxx isn't used any where.
> Which explains why the macros defined there aren't used anywhere. The macros
> in the file where somewhat redefined in the normal header along with the
> classes.
>
> The defaults for the classes where defined in the header (good); however,
> they used generic names like DEFAULT_VALUE, FREESPACE, … (bad). I went ahead
> and renamed them by prefixing CLASSNAME_ to the start of them. Someone
> already found this issue since I found some #undefs before #defines so the
> values could be changed.
>
> Naturally, I found some unused macros; I just deleted them.
>
> The reset is mostly minor formatting issues to make things fit nicer into
> 100 column screens (yes, I didn't get more excited to cut the lines down to
> 80). Some of the 160 columns lines, just didn't fit on my screen.
>
> The program builds and seems to run fine under OS X 10.6.4.


Thanks Joseph,

It builds on Linux too.

Pushed.

Norbert

>
> Joe P.
>
> PS: I left the CreateFromASCII() work to the other team. I will note that
> anything CreateFromASCII( ALLUPPERCASE ) is a constant and can be optimize
> (check the header file of the same name).
>
> PS: Patch released under LGPL 3+
>
> _______________________________________________
> LibreOffice mailing list
> LibreOffice at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libreoffice
>
>


More information about the LibreOffice mailing list