Merge lp://qastaging/~smspillaz/unity/unity.abstract_interface_generator into lp://qastaging/unity

Proposed by Sam Spilsbury
Status: Superseded
Proposed branch: lp://qastaging/~smspillaz/unity/unity.abstract_interface_generator
Merge into: lp://qastaging/unity
Diff against target: 321 lines (+301/-0) (has conflicts)
3 files modified
tests/CMakeLists.txt (+5/-0)
tests/test_abstract_interface_generator.cpp (+175/-0)
unity-shared/AbstractInterfaceGenerator.h (+121/-0)
Text conflict in tests/CMakeLists.txt
To merge this branch: bzr merge lp://qastaging/~smspillaz/unity/unity.abstract_interface_generator
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+138063@code.qastaging.launchpad.net

This proposal has been superseded by a proposal from 2012-12-18.

Commit message

  Added AbstractInterfaceGenerator, which is a helper template to visit
  an interface contained by composition by various concrete objects in a
  collection (eg, if the UnityWindow instance for each window in a
  CompWindowList had some interface XInterface that you wanted to use, you
  could do this):

  unity::AbstractInterfaceCollectionGenerator generator <const XInterface &, Co$

  foo (&generator);

  void foo (const unity::AbstractInterfaceGenerator <const XInterface &> &gen)
  {
    gen.VisitEachInterface ([](const XInterface &iface) { iface.x (); })
  }

Description of the change

  Added AbstractInterfaceGenerator, which is a helper template to visit
  an interface contained by composition by various concrete objects in a
  collection (eg, if the UnityWindow instance for each window in a
  CompWindowList had some interface XInterface that you wanted to use, you
  could do this):

  unity::AbstractInterfaceCollectionGenerator generator <const XInterface &, Co$

  foo (&generator);

  void foo (const unity::AbstractInterfaceGenerator <const XInterface &> &gen)
  {
    gen.VisitEachInterface ([](const XInterface &iface) { iface.x (); })
  }

Extracted from lp:~smspillaz/unity/unity.gesture_tests_no_sed

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Could you update the style so that we have "Type const&" and "Function()" (w/o spaces)?

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

On Tue, Dec 18, 2012 at 1:55 AM, Marco Trevisan (Treviño)
<mail@3v1n0.net> wrote:
> Could you update the style so that we have "Type const&" and "Function()" (w/o spaces)?

Sure thing :)

(I'm too used to compiz style :p)

> --
> https://code.launchpad.net/~smspillaz/unity/unity.abstract_interface_generator/+merge/138063
> You are the owner of lp:~smspillaz/unity/unity.abstract_interface_generator.

--
Sam Spilsbury

Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

67 + ConcreteOwningObject (const AbstractObject &abstract) :

Should be:

67 + ConcreteOwningObject (AbstractObject const& abstract) :

Thats what Marco was mentioning :). There are a few more that also needs some fixing

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

Yep, thanks.

Do any of you have ideas on how I might be able to remove the const cast here:

+ /* Someone help */
+ auto non_const_item = const_cast <typename
ConcreteCollection::value_type *> (&item);
+ AbstractInterface &interface (retreival_ (*non_const_item));
+ visit (interface);

Its pretty ugly with that code there.

On Tue, Dec 18, 2012 at 6:01 AM, Brandon Schaefer
<email address hidden> wrote:
> 67 + ConcreteOwningObject (const AbstractObject &abstract) :
>
> Should be:
>
> 67 + ConcreteOwningObject (AbstractObject const& abstract) :
>
> Thats what Marco was mentioning :). There are a few more that also needs some fixing
> --
> https://code.launchpad.net/~smspillaz/unity/unity.abstract_interface_generator/+merge/138063
> You are the owner of lp:~smspillaz/unity/unity.abstract_interface_generator.

--
Sam Spilsbury

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.