Merge lp://qastaging/~smspillaz/compiz-core/compiz-core.option-variant-type-fixes into lp://qastaging/compiz-core/0.9.5

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 2965
Proposed branch: lp://qastaging/~smspillaz/compiz-core/compiz-core.option-variant-type-fixes
Merge into: lp://qastaging/compiz-core/0.9.5
Diff against target: 372 lines (+243/-38)
4 files modified
include/core/abiversion.h (+1/-1)
include/core/option.h (+115/-34)
src/option.cpp (+1/-1)
src/option/tests/option.cpp (+126/-2)
To merge this branch: bzr merge lp://qastaging/~smspillaz/compiz-core/compiz-core.option-variant-type-fixes
Reviewer Review Type Date Requested Status
Daniel van Vugt Needs Fixing
Alan Griffiths Approve
Thomas Voß Approve
Review via email: mp+90242@code.qastaging.launchpad.net

Description of the change

Fixes up a bunch of boost::variant edge cases

1. Fixes a case where const char * would be converted to bool, add a wrapper to ensure it gets converted to CompString
2. Fixes a case where unsigned short [] and unsigned short * would get converted to bool also, add a wrapper to ensure they are stored correctly
3. Adds some template specializations for the above, especially the reading part.

To post a comment you must log in.
Revision history for this message
Thomas Voß (thomas-voss) wrote :

Looks OK to me. Unit tests are passing and have been extended to check for the edge cases together with boost::variant. Nevertheless, the modelling of a color should be adjusted to an (unambiguous) struct in the future.

review: Approve
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

+1

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

OK

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Conflict encountered while I was trying to merge this...

include/core/option.h:
<<<<<<< TREE
                template<typename T>
                void set (const T & t)
                {
                    mValue = t;
                }

                template<typename T>
                const T & get () const
                {
                    try
                    {
                        return boost::get<T> (mValue);
                    }
                    catch (...)
                    {
                        static T inst;
                        return inst;
                    }
                }
=======

                template<typename T>
                void set (const T & t);

                void set( unsigned short const (&color)[4] )
                {
                    mValue = ColorVector (color, color + 4);
                }

                void set (const char *c)
                {
                    mValue = CompString (c);
                }

                template<typename T>
                const T & get () const;
>>>>>>> MERGE-SOURCE

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches