]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/object-key.hh
* lily/context.cc (Context): take key argument in ctor.
[lilypond.git] / lily / include / object-key.hh
1 /*
2   object-key.hh -- declare Object_key
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
7
8 */
9
10 #ifndef OBJECT_KEY_HH
11 #define OBJECT_KEY_HH
12
13 #include "smobs.hh"
14
15 /*
16   Object_keys are read-only values, suitable for storing references to
17   transient objects (such as grobs or contexts) on disk.
18
19   In the future, they might also act as handles for external processes
20   requesting notation to be drawn.
21  */
22 class Object_key
23 {
24   DECLARE_SMOBS(Object_key,);
25
26 protected:
27   Object_key();
28   virtual void derived_mark () const;
29   virtual int get_type () const;
30   virtual int do_compare (Object_key const * other) const;
31 public:
32   int compare (Object_key const *other) const;
33 };
34
35 enum Object_key_type {
36   GENERAL_KEY, 
37   GROB_KEY,
38   CONTEXT_KEY,
39   COPIED_KEY,
40 };
41
42 class Copied_key : public Object_key
43 {
44
45 private:
46   Object_key const * original_;
47   int copy_count_;
48 protected:
49   virtual void derived_mark () const;
50   virtual int get_type () const;
51   virtual int do_compare (Object_key const * other) const;
52 public:
53   Copied_key (Object_key const*, int); 
54 };
55
56 DECLARE_UNSMOB(Object_key, key);
57
58 #endif /* OBJECT_KEY_HH */