File: exportxml.h

package info (click to toggle)
denemo 0.5.9-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,500 kB
  • ctags: 2,415
  • sloc: ansic: 23,057; sh: 3,321; yacc: 1,737; makefile: 449; lex: 376
file content (138 lines) | stat: -rw-r--r-- 4,486 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/* exportxml.h
 * Header file for exporting "native" Denemo XML files
 *
 * for Denemo, a gtk+ frontend to GNU Lilypond
 * (c) 2001 Eric Galluzzo
 */

#ifndef EXPORTXML_H
#define EXPORTXML_H

#include "datastructures.h"
#include "xmldefs.h"

#include <glib.h>

/* libxml includes: for libxml2 this should be <libxml/tree.h> */
#include <libxml/tree.h>


/*
 * This is the "interface" that all export handlers must "implement" if they
 * wish to export data from Denemo.  If any of the callbacks in the structure
 * are NULL, then they are not called.  However, all other fields must be
 * non-NULL.
 */
typedef struct _DenemoExportXMLNSHandler
{
  /*
   * The prefix of the XML namespace (e.g. "lily")
   */
  gchar * xmlnsPrefix;

  /*
   * The actual XML namespace URI (e.g.
   * "http://www.denemo.sourceforge.net/Denemo/Lilypond")
   */
  gchar * xmlnsURI;

  /*
   * The mudelaobject types for which to call this structure's exportObjectInfo
   * and createXMLObject callbacks
   */
  gint    numHandlerObjectTypes;
  gint *  handlerObjectTypes;

  /*
   * Create and return user data necessary for importing the given score.  If
   * no user data is required, set this startScore function to NULL.
   */
  gpointer (* startScore) (struct scoreinfo * si);

  /*
   * Delete the given user data.  If no user data is required, set this
   * endScore function to NULL.
   */
  void (* endScore) (struct scoreinfo * si, gpointer userData);

  /*
   * Export any information related to this score as children of
   * scoreInfoElem.  All XML elements should be in the given namespace.
   */
  void (* exportScoreInfo) (struct scoreinfo * si,
                            xmlNsPtr           ns,
                            xmlNodePtr         scoreInfoElem);

  /*
   * Export any information related to this staff as children of
   * staffInfoElem.  All XML elements should be in the given namespace.
   */
  void (* exportStaffInfo) (struct scoreinfo * si,
                            xmlNsPtr           ns,
                            xmlNodePtr         staffInfoElem);

  /*
   * Export any metadata about this voice as children of voiceInfoElem.  All
   * XML elements should be in the given namespace.
   */
  void (* exportVoiceInfo) (struct scoreinfo * si,
                            xmlNsPtr           ns,
                            xmlNodePtr         voiceInfoElem);

  /*
   * Export any non-built-in initial parameters for this voice as children of
   * voiceInitParamsElem.  All XML elements should be in the given namespace.
   */
  void (* exportVoiceInitParams) (struct scoreinfo * si,
                                  xmlNsPtr           ns,
                                  xmlNodePtr         voiceInitParamsElem);

  /*
   * Export any information related to this measure as children of measureElem.
   * All XML elements should be in the given namespace.
   */
  void (* exportMeasure) (struct scoreinfo * si,
                          xmlNsPtr           ns,
                          xmlNodePtr         measureElem);

  /*
   * Export any information related to this built-in type mudelaobject as
   * children of objectElem.  All XML elements should be in the given
   * namespace.
   */
  void (* exportObjectInfo) (struct scoreinfo * si,
                             xmlNsPtr           ns,
                             xmlNodePtr         objectElem);

  /*
   * Export any information related to this note as children of chordElem.
   * All XML elements should be in the given namespace.
   */
  void (* exportNoteInfo) (struct scoreinfo * si,
                           xmlNsPtr           ns,
                           xmlNodePtr         chordElem);

  /*
   * Create a new XML element or multiple elements corresponding to the given
   * custom type mudelaobject, as children of measureElem.  All XML elements
   * should be in the given namespace.
   */
  void (* exportCustomObject) (struct scoreinfo * si,
                               xmlNsPtr           ns,
                               xmlNodePtr         measureElem);
} DenemoExportXMLNSHandler;


/*
 * Export the given score as Denemo's "native" XML file format to the given
 * filename.  The file will be exported from the measures numbered start to
 * end.
 */
void exportXML (gchar * thefilename, struct scoreinfo *si, gint start,
		gint end);

void registerExportXMLNSHandler (DenemoExportXMLNSHandler * handler);

void unregisterExportXMLNSHandler (DenemoExportXMLNSHandler * handler);

#endif