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/item-scheme.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/item-scheme.cc')
-rw-r--r-- | lily/item-scheme.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lily/item-scheme.cc b/lily/item-scheme.cc index 24ccf5bf0d..48f3218f22 100644 --- a/lily/item-scheme.cc +++ b/lily/item-scheme.cc @@ -25,7 +25,7 @@ LY_DEFINE (ly_item_p, "ly:item?", 1, 0, 0, (SCM g), "Is @var{g} an @code{Item} object?") { - Grob *me = Grob::unsmob (g); + Grob *me = unsmob<Grob> (g); bool b = dynamic_cast<Item *> (me); return ly_bool2scm (b); } @@ -37,7 +37,7 @@ LY_DEFINE (ly_item_break_dir, "ly:item-break-dir", " @code{1}@tie{}beginning of line.") { LY_ASSERT_SMOB (Item, it, 1); - Item *me = Item::unsmob (it); + Item *me = unsmob<Item> (it); return scm_from_int (me->break_status_dir ()); } @@ -47,7 +47,7 @@ LY_DEFINE (ly_item_get_column, "ly:item-get-column", " associated with this @code{Item}.") { LY_ASSERT_SMOB (Item, it, 1); - Item *me = Item::unsmob (it); + Item *me = unsmob<Item> (it); if (Paper_column *col = me->get_column ()) return col->self_scm (); |