diff options
author | Dan Eble <nine.fierce.ballads@gmail.com> | 2015-05-01 22:21:43 -0400 |
---|---|---|
committer | Dan Eble <nine.fierce.ballads@gmail.com> | 2015-05-22 22:23:26 -0400 |
commit | 0c14539bc83d6bb405141b6f21430b33d1e8fcf0 (patch) | |
tree | e662f6f5dc73fccbba2297f7fdfc877caf0338bf /lily/separation-item.cc | |
parent | e52c5d72fc45e123c8574803ba52871e6fe8a596 (diff) |
Issue 4365: non-member unsmob<T> replaces T::unsmob and T::is_smob
Hide Smob_base<>::is_smob() to prevent the misleading situation of
D::is_smob(S) returning true when S represents an ancestor of D rather
than a D. This issue was previously worked around by overriding
is_smob in several derived smob classes; that is no longer needed.
LY_ASSERT_SMOB() now returns a smob pointer. This is not used yet,
but is available for future use to avoid unsmobbing twice.
Smob_base<>::smob_p() is hidden because there doesn't seem to be a
need for it to be public.
Files in lily/include were edited by hand. Files in lily itself were
processed with the following sed script.
s/\([A-Za-z_]\+\)::derived_unsmob/unsmob<\1>/g
s/derived_unsmob *<\([A-Za-z_]\+\)>/unsmob<\1>/g
s/\([A-Za-z_]\+\)::unsmob/unsmob<\1>/g
s/\([A-Za-z_]\+\)::is_smob/unsmob<\1>/g
s/Input \*\([A-Za-z_]\+\) = unsmob /Input *\1 = unsmob<Input> /g
s/LY_ASSERT_SMOB (\([^)]*\))$/LY_ASSERT_SMOB (\1);/g
Diffstat (limited to 'lily/separation-item.cc')
-rw-r--r-- | lily/separation-item.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lily/separation-item.cc b/lily/separation-item.cc index 5e93a13e4c..d0cad83d8e 100644 --- a/lily/separation-item.cc +++ b/lily/separation-item.cc @@ -46,8 +46,8 @@ Separation_item::add_conditional_item (Grob *me, Grob *e) Real Separation_item::set_distance (Item *l, Item *r, Real padding) { - Drul_array<Skyline_pair *> lines (Skyline_pair::unsmob (l->get_property ("horizontal-skylines")), - Skyline_pair::unsmob (r->get_property ("horizontal-skylines"))); + Drul_array<Skyline_pair *> lines (unsmob<Skyline_pair> (l->get_property ("horizontal-skylines")), + unsmob<Skyline_pair> (r->get_property ("horizontal-skylines"))); Skyline right = conditional_skyline (r, l); right.merge ((*lines[RIGHT])[LEFT]); @@ -68,7 +68,7 @@ Separation_item::set_distance (Item *l, Item *r, Real padding) bool Separation_item::is_empty (Grob *me) { - Skyline_pair *sky = Skyline_pair::unsmob (me->get_property ("horizontal-skylines")); + Skyline_pair *sky = unsmob<Skyline_pair> (me->get_property ("horizontal-skylines")); return (!sky || sky->is_empty ()); } @@ -87,7 +87,7 @@ MAKE_SCHEME_CALLBACK (Separation_item, calc_skylines, 1); SCM Separation_item::calc_skylines (SCM smob) { - Item *me = Item::unsmob (smob); + Item *me = unsmob<Item> (smob); vector<Box> bs = boxes (me, 0); Skyline_pair sp (bs, Y_AXIS); /* @@ -201,9 +201,9 @@ Separation_item::print (SCM smob) if (!debug_skylines) return SCM_BOOL_F; - Grob *me = Grob::unsmob (smob); + Grob *me = unsmob<Grob> (smob); Stencil ret; - if (Skyline_pair *s = Skyline_pair::unsmob (me->get_property ("horizontal-skylines"))) + if (Skyline_pair *s = unsmob<Skyline_pair> (me->get_property ("horizontal-skylines"))) { ret.add_stencil (Lookup::points_to_line_stencil (0.1, (*s)[LEFT].to_points (Y_AXIS)).in_color (255, 255, 0)); ret.add_stencil (Lookup::points_to_line_stencil (0.1, (*s)[RIGHT].to_points (Y_AXIS)).in_color (0, 255, 255)); |