]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/pdf.hh
* scm/define-grobs.scm (all-grob-descriptions): put ledger lines
[lilypond.git] / lily / include / pdf.hh
1 /*
2   pdf.hh -- declare Pdf output data structures.
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
7
8 */
9
10 #ifndef PDF_HH
11 #define PDF_HH
12
13 #include <stdio.h>
14
15 #include "parray.hh"
16 #include "smobs.hh"
17
18 class Pdf_object
19 {
20   DECLARE_SMOBS(Pdf_object,);
21   bool written_;
22   int object_number_;
23   SCM value_;
24   long byte_count_;
25
26
27   static void write_dict (FILE*, SCM);
28   static void write_stream (FILE*, SCM);
29   static void write_vector (FILE*, SCM);
30   static void typecheck (SCM);
31   static String escape_string (String);
32
33   String to_string () const;
34   void write_to_file (FILE*, bool) const;
35 public:
36
37   bool is_indirect () const;
38   bool is_stream () const;
39   bool is_dict () const;
40   
41   Pdf_object();
42   void set_value (SCM value);
43
44   friend class Pdf_file;
45 };
46
47 class Pdf_file
48 {
49   Link_array<Pdf_object> indirect_objects_;
50   Pdf_object *root_object_;
51   FILE *file_;
52   
53   DECLARE_SMOBS(Pdf_file,);
54
55 protected:
56   void write_header ();
57   void write_trailer ();
58
59   String get_string ();
60   
61 public:
62   void set_root_document (Pdf_object *obj);
63   Pdf_file (String filename);
64   void make_indirect (Pdf_object *obj);
65   void write_object (Pdf_object *obj);
66   void terminate();
67 };
68
69 DECLARE_UNSMOB(Pdf_object, pdf_object);
70 DECLARE_UNSMOB(Pdf_file, pdf_file);
71
72 #endif