X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Finclude%2Fobject-key.hh;h=c163d4c0e9a09ebfda25c5ab55ee4d1054692841;hb=9e69cb84d6ee5b0a861cd97869b10e3bdf0c833c;hp=c64fcc9deb488a6fabd64486387eb29c267f3799;hpb=4a964b10c411827584eb720c63cd0d6fc5b65d72;p=lilypond.git diff --git a/lily/include/object-key.hh b/lily/include/object-key.hh index c64fcc9deb..c163d4c0e9 100644 --- a/lily/include/object-key.hh +++ b/lily/include/object-key.hh @@ -3,8 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 2004 Han-Wen Nienhuys - + (c) 2004--2006 Han-Wen Nienhuys */ #ifndef OBJECT_KEY_HH @@ -18,41 +17,59 @@ In the future, they might also act as handles for external processes requesting notation to be drawn. - */ +*/ class Object_key { - DECLARE_SMOBS(Object_key,); + DECLARE_SMOBS (Object_key); protected: - Object_key(); + Object_key (); virtual void derived_mark () const; virtual int get_type () const; - virtual int do_compare (Object_key const * other) const; + virtual int do_compare (Object_key const *other) const; public: + virtual SCM as_scheme () const; + static Object_key *from_scheme (SCM); + static Object_key *undump (SCM); int compare (Object_key const *other) const; + SCM dump () const; }; -enum Object_key_type { - GENERAL_KEY, - GROB_KEY, - CONTEXT_KEY, - COPIED_KEY, -}; +enum Object_key_type + { + BASE_KEY, + COPIED_KEY, + GENERAL_KEY, + GROB_KEY, + CONTEXT_KEY, + KEY_COUNT, + }; class Copied_key : public Object_key { private: - Object_key const * original_; + Object_key const *original_; int copy_count_; + protected: virtual void derived_mark () const; virtual int get_type () const; - virtual int do_compare (Object_key const * other) const; + virtual int do_compare (Object_key const *other) const; + virtual SCM as_scheme () const; public: - Copied_key (Object_key const*, int); + static Object_key *from_scheme (SCM); + Copied_key (Object_key const *, int); }; -DECLARE_UNSMOB(Object_key, key); +DECLARE_UNSMOB (Object_key, key); + +struct Object_key_less +{ + bool operator () (Object_key const *const &t1, Object_key const *const &t2) const + { + return t1->compare (t2); + } +}; #endif /* OBJECT_KEY_HH */