]>
Commit | Line | Data |
---|---|---|
f11a948a MS |
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
2 | <html> | |
3 | <!-- SECTION: Programming --> | |
4 | <head> | |
0268488e MS |
5 | <title>MIME API </title> |
6 | <meta name="keywords" content="Programming"> | |
7 | <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> | |
8 | <meta name="creator" content="Mini-XML v2.7"> | |
f11a948a MS |
9 | <style type="text/css"><!-- |
10 | BODY { | |
11 | font-family: lucida grande, geneva, helvetica, arial, sans-serif; | |
12 | } | |
13 | ||
14 | H1, H2, H3, H4, H5, H6, P, TD, TH { | |
15 | font-family: lucida grande, geneva, helvetica, arial, sans-serif; | |
16 | } | |
17 | ||
18 | KBD { | |
19 | font-family: monaco, courier, monospace; | |
20 | font-weight: bold; | |
21 | } | |
22 | ||
23 | PRE { | |
24 | font-family: monaco, courier, monospace; | |
25 | } | |
26 | ||
27 | PRE.command { | |
10d09e33 | 28 | border: dotted thin #7f7f7f; |
f11a948a | 29 | margin-left: 36pt; |
10d09e33 | 30 | padding: 10px; |
f11a948a MS |
31 | } |
32 | ||
33 | P.compact { | |
34 | margin: 0; | |
35 | } | |
36 | ||
37 | P.example { | |
38 | font-style: italic; | |
39 | margin-left: 36pt; | |
40 | } | |
41 | ||
42 | PRE.example { | |
43 | background: #eeeeee; | |
44 | border: dotted thin #999999; | |
45 | margin-left: 36pt; | |
178cb736 | 46 | padding: 10pt; |
f11a948a MS |
47 | } |
48 | ||
49 | PRE.command EM, PRE.example EM { | |
50 | font-family: lucida grande, geneva, helvetica, arial, sans-serif; | |
51 | } | |
52 | ||
53 | P.command { | |
54 | font-family: monaco, courier, monospace; | |
55 | margin-left: 36pt; | |
56 | } | |
57 | ||
58 | P.formula { | |
59 | font-style: italic; | |
60 | margin-left: 36pt; | |
61 | } | |
62 | ||
63 | BLOCKQUOTE { | |
178cb736 | 64 | background: #eeeeee; |
f11a948a MS |
65 | border: solid thin #999999; |
66 | padding: 10pt; | |
67 | } | |
68 | ||
69 | A IMG { | |
70 | border: none; | |
71 | } | |
72 | ||
73 | A:link:hover IMG { | |
74 | background: #f0f0f0; | |
75 | border-radius: 10px; | |
76 | -moz-border-radius: 10px; | |
77 | } | |
78 | ||
79 | A:link, A:visited { | |
80 | font-weight: normal; | |
81 | text-decoration: none; | |
82 | } | |
83 | ||
84 | A:link:hover, A:visited:hover, A:active { | |
85 | text-decoration: underline; | |
86 | } | |
87 | ||
88 | SUB, SUP { | |
89 | font-size: 50%; | |
90 | } | |
91 | ||
92 | TR.data, TD.data, TR.data TD { | |
93 | margin-top: 10pt; | |
94 | padding: 5pt; | |
95 | border-bottom: solid 1pt #999999; | |
96 | } | |
97 | ||
98 | TR.data TH { | |
99 | border-bottom: solid 1pt #999999; | |
100 | padding-top: 10pt; | |
101 | padding-left: 5pt; | |
102 | text-align: left; | |
103 | } | |
104 | ||
105 | DIV.table TABLE { | |
106 | border: solid thin #999999; | |
107 | border-collapse: collapse; | |
108 | border-spacing: 0; | |
109 | margin-left: auto; | |
110 | margin-right: auto; | |
111 | } | |
112 | ||
113 | DIV.table CAPTION { | |
114 | caption-side: top; | |
115 | font-size: 120%; | |
116 | font-style: italic; | |
117 | font-weight: bold; | |
118 | margin-left: auto; | |
119 | margin-right: auto; | |
120 | } | |
121 | ||
122 | DIV.table TABLE TD { | |
123 | border: solid thin #cccccc; | |
124 | padding-top: 5pt; | |
125 | } | |
126 | ||
127 | DIV.table TABLE TH { | |
128 | background: #cccccc; | |
129 | border: none; | |
130 | border-bottom: solid thin #999999; | |
131 | } | |
132 | ||
133 | DIV.figure TABLE { | |
134 | margin-left: auto; | |
135 | margin-right: auto; | |
136 | } | |
137 | ||
138 | DIV.figure CAPTION { | |
139 | caption-side: bottom; | |
140 | font-size: 120%; | |
141 | font-style: italic; | |
142 | font-weight: bold; | |
143 | margin-left: auto; | |
144 | margin-right: auto; | |
145 | } | |
146 | ||
147 | TH.label { | |
148 | text-align: right; | |
149 | vertical-align: top; | |
150 | } | |
151 | ||
152 | TH.sublabel { | |
153 | text-align: right; | |
154 | font-weight: normal; | |
155 | } | |
156 | ||
157 | HR { | |
158 | border: solid thin; | |
159 | } | |
160 | ||
161 | SPAN.info { | |
162 | background: black; | |
163 | border: thin solid black; | |
164 | color: white; | |
165 | font-size: 80%; | |
166 | font-style: italic; | |
167 | font-weight: bold; | |
168 | white-space: nowrap; | |
169 | } | |
170 | ||
171 | H2 SPAN.info, H3 SPAN.info, H4 SPAN.info { | |
172 | float: right; | |
173 | font-size: 100%; | |
174 | } | |
175 | ||
178cb736 MS |
176 | H1.title { |
177 | } | |
178 | ||
f11a948a MS |
179 | H2.title, H3.title { |
180 | border-bottom: solid 2pt #000000; | |
181 | } | |
182 | ||
183 | DIV.indent, TABLE.indent { | |
184 | margin-top: 2em; | |
185 | margin-left: auto; | |
186 | margin-right: auto; | |
187 | width: 90%; | |
188 | } | |
189 | ||
190 | TABLE.indent { | |
191 | border-collapse: collapse; | |
192 | } | |
193 | ||
194 | TABLE.indent TD, TABLE.indent TH { | |
195 | padding: 0; | |
196 | } | |
197 | ||
198 | TABLE.list { | |
199 | border-collapse: collapse; | |
200 | margin-left: auto; | |
201 | margin-right: auto; | |
202 | width: 90%; | |
203 | } | |
204 | ||
205 | TABLE.list TH { | |
206 | background: white; | |
207 | border-bottom: solid thin #cccccc; | |
208 | color: #444444; | |
209 | padding-top: 10pt; | |
210 | padding-left: 5pt; | |
211 | text-align: left; | |
212 | vertical-align: bottom; | |
213 | white-space: nowrap; | |
214 | } | |
215 | ||
216 | TABLE.list TH A { | |
217 | color: #4444cc; | |
218 | } | |
219 | ||
220 | TABLE.list TD { | |
221 | border-bottom: solid thin #eeeeee; | |
222 | padding-top: 5pt; | |
223 | padding-left: 5pt; | |
224 | } | |
225 | ||
226 | TABLE.list TR:nth-child(even) { | |
227 | background: #f8f8f8; | |
228 | } | |
229 | ||
230 | TABLE.list TR:nth-child(odd) { | |
231 | background: #f4f4f4; | |
232 | } | |
233 | ||
234 | DT { | |
235 | margin-left: 36pt; | |
236 | margin-top: 12pt; | |
237 | } | |
238 | ||
239 | DD { | |
240 | margin-left: 54pt; | |
241 | } | |
242 | ||
243 | DL.category DT { | |
244 | font-weight: bold; | |
245 | } | |
246 | ||
247 | P.summary { | |
248 | margin-left: 36pt; | |
249 | font-family: monaco, courier, monospace; | |
250 | } | |
251 | ||
252 | DIV.summary TABLE { | |
253 | border: solid thin #999999; | |
254 | border-collapse: collapse; | |
255 | border-spacing: 0; | |
256 | margin: 10px; | |
257 | } | |
258 | ||
259 | DIV.summary TABLE TD, DIV.summary TABLE TH { | |
260 | border: solid thin #999999; | |
261 | padding: 5px; | |
262 | text-align: left; | |
263 | vertical-align: top; | |
264 | } | |
265 | ||
266 | DIV.summary TABLE THEAD TH { | |
267 | background: #eeeeee; | |
268 | } | |
269 | ||
270 | /* API documentation styles... */ | |
271 | div.body h1 { | |
272 | margin: 0; | |
273 | } | |
274 | div.body h2 { | |
275 | margin-top: 1.5em; | |
276 | } | |
277 | div.body h3, div.body h4, div.body h5 { | |
278 | margin-bottom: 0.5em; | |
279 | margin-top: 1.5em; | |
280 | } | |
281 | .class, .enumeration, .function, .struct, .typedef, .union { | |
282 | border-bottom: solid thin #999999; | |
283 | margin-bottom: 0; | |
284 | margin-top: 2em; | |
285 | } | |
286 | .description { | |
287 | margin-top: 0.5em; | |
288 | } | |
289 | code, p.code, pre, ul.code li { | |
290 | font-family: monaco, courier, monospace; | |
291 | font-size: 90%; | |
292 | } | |
293 | ul.code, ul.contents, ul.subcontents { | |
294 | list-style-type: none; | |
295 | margin: 0; | |
296 | padding-left: 0; | |
297 | } | |
298 | ul.code li { | |
299 | margin: 0; | |
300 | } | |
301 | ul.contents > li { | |
302 | margin-top: 1em; | |
303 | } | |
304 | ul.contents li ul.code, ul.contents li ul.subcontents { | |
305 | padding-left: 2em; | |
306 | } | |
307 | div.body dl { | |
308 | margin-left: 0; | |
309 | margin-top: 0; | |
310 | } | |
311 | div.body dt { | |
312 | font-style: italic; | |
313 | margin-left: 0; | |
314 | margin-top: 0; | |
315 | } | |
316 | div.body dd { | |
317 | margin-bottom: 0.5em; | |
318 | } | |
319 | ||
320 | /* This is just for the HTML files generated with the framedhelp target */ | |
321 | div.contents { | |
322 | background: #e8e8e8; | |
323 | border: solid thin black; | |
324 | padding: 10px; | |
325 | } | |
326 | div.contents h1 { | |
327 | font-size: 110%; | |
328 | } | |
329 | div.contents h2 { | |
330 | font-size: 100%; | |
331 | } | |
332 | div.contents ul.contents { | |
333 | font-size: 80%; | |
334 | } | |
335 | div.contents ul.subcontents li { | |
336 | margin-left: 1em; | |
337 | text-indent: -1em; | |
338 | } | |
339 | --></style> | |
340 | </head> | |
341 | <body> | |
342 | <div class='body'> | |
178cb736 | 343 | <!-- |
9c0e8e5d | 344 | "$Id: api-array.header 8087 2008-10-27 21:37:05Z mike $" |
178cb736 MS |
345 | |
346 | MIME API header for CUPS. | |
347 | ||
348 | Copyright 2009 by Apple Inc. | |
349 | ||
350 | These coded instructions, statements, and computer programs are the | |
351 | property of Apple Inc. and are protected by Federal copyright | |
352 | law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
353 | which should have been included with this file. If this file is | |
354 | file is missing or damaged, see the license at "http://www.cups.org/". | |
355 | --> | |
356 | ||
357 | <h1 class='title'>MIME API</h1> | |
358 | ||
359 | <div class='summary'><table summary='General Information'> | |
360 | <thead> | |
361 | <tr> | |
362 | <th>Header</th> | |
363 | <th>cups/mime.h</th> | |
364 | </tr> | |
365 | </thead> | |
366 | <tbody> | |
367 | <tr> | |
368 | <th>Library</th> | |
369 | <td>-lcupsmime</td> | |
370 | </tr> | |
371 | <tr> | |
372 | <th>See Also</th> | |
373 | <td>Programming: <a href='api-overview.html' target='_top'>Introduction to CUPS Programming</a></td> | |
374 | </tr> | |
375 | </tbody> | |
376 | </table></div> | |
f11a948a MS |
377 | <h2 class="title">Contents</h2> |
378 | <ul class="contents"> | |
178cb736 | 379 | <li><a href="#OVERVIEW">Overview</a></li> |
f11a948a | 380 | <li><a href="#FUNCTIONS">Functions</a><ul class="code"> |
0268488e MS |
381 | <li><a href="#mimeAddFilter" title="Add a filter to the current MIME database.">mimeAddFilter</a></li> |
382 | <li><a href="#mimeAddType" title="Add a MIME type to a database.">mimeAddType</a></li> | |
383 | <li><a href="#mimeAddTypeRule" title="Add a detection rule for a file type.">mimeAddTypeRule</a></li> | |
384 | <li><a href="#mimeDelete" title="Delete (free) a MIME database.">mimeDelete</a></li> | |
385 | <li><a href="#mimeDeleteFilter" title="Delete a filter from the MIME database.">mimeDeleteFilter</a></li> | |
386 | <li><a href="#mimeDeleteType" title="Delete a type from the MIME database.">mimeDeleteType</a></li> | |
387 | <li><a href="#mimeFileType" title="Determine the type of a file.">mimeFileType</a></li> | |
388 | <li><a href="#mimeFilter" title="Find the fastest way to convert from one type to another.">mimeFilter</a></li> | |
22c9029b MS |
389 | <li><a href="#mimeFilter2" title="Find the fastest way to convert from one type to another, |
390 | including file size.">mimeFilter2</a></li> | |
391 | <li><a href="#mimeFilterLookup" title="Lookup a filter.">mimeFilterLookup</a></li> | |
0268488e MS |
392 | <li><a href="#mimeFirstFilter" title="Get the first filter in the MIME database.">mimeFirstFilter</a></li> |
393 | <li><a href="#mimeFirstType" title="Get the first type in the MIME database.">mimeFirstType</a></li> | |
394 | <li><a href="#mimeLoad" title="Create a new MIME database from disk.">mimeLoad</a></li> | |
395 | <li><a href="#mimeLoadFilters" title="Load filter definitions from disk.">mimeLoadFilters</a></li> | |
396 | <li><a href="#mimeLoadTypes" title="Load type definitions from disk.">mimeLoadTypes</a></li> | |
321d8d57 | 397 | <li><a href="#mimeNew" title="Create a new, empty MIME database.">mimeNew</a></li> |
0268488e MS |
398 | <li><a href="#mimeNextFilter" title="Get the next filter in the MIME database.">mimeNextFilter</a></li> |
399 | <li><a href="#mimeNextType" title="Get the next type in the MIME database.">mimeNextType</a></li> | |
22c9029b | 400 | <li><a href="#mimeNumFilters" title="Next type">mimeNumFilters</a></li> |
0268488e | 401 | <li><a href="#mimeNumTypes" title="MIME database">mimeNumTypes</a></li> |
321d8d57 | 402 | <li><a href="#mimeSetErrorCallback" title="Set the callback for error messages.">mimeSetErrorCallback</a></li> |
0268488e | 403 | <li><a href="#mimeType" title="Lookup a file type.">mimeType</a></li> |
f11a948a MS |
404 | </ul></li> |
405 | <li><a href="#TYPES">Data Types</a><ul class="code"> | |
321d8d57 | 406 | <li><a href="#const" title="MIME Database">const</a></li> |
f11a948a MS |
407 | <li><a href="#mime_filter_t" title="MIME Conversion Filter Data">mime_filter_t</a></li> |
408 | <li><a href="#mime_magic_t" title="MIME Magic Data">mime_magic_t</a></li> | |
409 | <li><a href="#mime_op_t" title="Types/structures...">mime_op_t</a></li> | |
410 | <li><a href="#mime_t" title="MIME Database">mime_t</a></li> | |
411 | <li><a href="#mime_type_t" title="MIME Type Data">mime_type_t</a></li> | |
412 | </ul></li> | |
0268488e | 413 | </ul> |
178cb736 | 414 | <!-- |
9c0e8e5d | 415 | "$Id: api-array.shtml 7616 2008-05-28 00:34:13Z mike $" |
178cb736 MS |
416 | |
417 | MIME API introduction for CUPS. | |
418 | ||
419 | Copyright 2009 by Apple Inc. | |
420 | ||
421 | These coded instructions, statements, and computer programs are the | |
422 | property of Apple Inc. and are protected by Federal copyright | |
423 | law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
424 | which should have been included with this file. If this file is | |
425 | file is missing or damaged, see the license at "http://www.cups.org/". | |
426 | --> | |
427 | ||
428 | <h2 class='title'><a name='OVERVIEW'>Overview</a></h2> | |
429 | ||
430 | <p>The MIME API provides file typing and conversion services for CUPS.</p> | |
f11a948a MS |
431 | <h2 class="title"><a name="FUNCTIONS">Functions</a></h2> |
432 | <h3 class="function"><a name="mimeAddFilter">mimeAddFilter</a></h3> | |
433 | <p class="description">Add a filter to the current MIME database.</p> | |
434 | <p class="code"> | |
435 | <a href="#mime_filter_t">mime_filter_t</a> *mimeAddFilter (<br> | |
436 | <a href="#mime_t">mime_t</a> *mime,<br> | |
437 | <a href="#mime_type_t">mime_type_t</a> *src,<br> | |
438 | <a href="#mime_type_t">mime_type_t</a> *dst,<br> | |
439 | int cost,<br> | |
321d8d57 | 440 | <a href="#const">const</a> char *filter<br> |
f11a948a MS |
441 | );</p> |
442 | <h4 class="parameters">Parameters</h4> | |
443 | <dl> | |
444 | <dt>mime</dt> | |
445 | <dd class="description">MIME database</dd> | |
446 | <dt>src</dt> | |
447 | <dd class="description">Source type</dd> | |
448 | <dt>dst</dt> | |
449 | <dd class="description">Destination type</dd> | |
450 | <dt>cost</dt> | |
451 | <dd class="description">Relative time/resource cost</dd> | |
452 | <dt>filter</dt> | |
453 | <dd class="description">Filter program to run</dd> | |
454 | </dl> | |
455 | <h4 class="returnvalue">Return Value</h4> | |
456 | <p class="description">New filter</p> | |
457 | <h3 class="function"><a name="mimeAddType">mimeAddType</a></h3> | |
458 | <p class="description">Add a MIME type to a database.</p> | |
459 | <p class="code"> | |
460 | <a href="#mime_type_t">mime_type_t</a> *mimeAddType (<br> | |
461 | <a href="#mime_t">mime_t</a> *mime,<br> | |
321d8d57 MS |
462 | <a href="#const">const</a> char *super,<br> |
463 | <a href="#const">const</a> char *type<br> | |
f11a948a MS |
464 | );</p> |
465 | <h4 class="parameters">Parameters</h4> | |
466 | <dl> | |
467 | <dt>mime</dt> | |
468 | <dd class="description">MIME database</dd> | |
469 | <dt>super</dt> | |
470 | <dd class="description">Super-type name</dd> | |
471 | <dt>type</dt> | |
472 | <dd class="description">Type name</dd> | |
473 | </dl> | |
474 | <h4 class="returnvalue">Return Value</h4> | |
475 | <p class="description">New (or existing) MIME type</p> | |
476 | <h3 class="function"><a name="mimeAddTypeRule">mimeAddTypeRule</a></h3> | |
477 | <p class="description">Add a detection rule for a file type.</p> | |
478 | <p class="code"> | |
479 | int mimeAddTypeRule (<br> | |
480 | <a href="#mime_type_t">mime_type_t</a> *mt,<br> | |
321d8d57 | 481 | <a href="#const">const</a> char *rule<br> |
f11a948a MS |
482 | );</p> |
483 | <h4 class="parameters">Parameters</h4> | |
484 | <dl> | |
485 | <dt>mt</dt> | |
486 | <dd class="description">Type to add to</dd> | |
487 | <dt>rule</dt> | |
488 | <dd class="description">Rule to add</dd> | |
489 | </dl> | |
490 | <h4 class="returnvalue">Return Value</h4> | |
491 | <p class="description">0 on success, -1 on failure</p> | |
492 | <h3 class="function"><a name="mimeDelete">mimeDelete</a></h3> | |
493 | <p class="description">Delete (free) a MIME database.</p> | |
494 | <p class="code"> | |
495 | void mimeDelete (<br> | |
496 | <a href="#mime_t">mime_t</a> *mime<br> | |
497 | );</p> | |
498 | <h4 class="parameters">Parameters</h4> | |
499 | <dl> | |
500 | <dt>mime</dt> | |
501 | <dd class="description">MIME database</dd> | |
502 | </dl> | |
503 | <h3 class="function"><a name="mimeDeleteFilter">mimeDeleteFilter</a></h3> | |
504 | <p class="description">Delete a filter from the MIME database.</p> | |
505 | <p class="code"> | |
506 | void mimeDeleteFilter (<br> | |
507 | <a href="#mime_t">mime_t</a> *mime,<br> | |
508 | <a href="#mime_filter_t">mime_filter_t</a> *filter<br> | |
509 | );</p> | |
510 | <h4 class="parameters">Parameters</h4> | |
511 | <dl> | |
512 | <dt>mime</dt> | |
513 | <dd class="description">MIME database</dd> | |
514 | <dt>filter</dt> | |
515 | <dd class="description">Filter</dd> | |
516 | </dl> | |
517 | <h3 class="function"><a name="mimeDeleteType">mimeDeleteType</a></h3> | |
518 | <p class="description">Delete a type from the MIME database.</p> | |
519 | <p class="code"> | |
520 | void mimeDeleteType (<br> | |
521 | <a href="#mime_t">mime_t</a> *mime,<br> | |
522 | <a href="#mime_type_t">mime_type_t</a> *mt<br> | |
523 | );</p> | |
524 | <h4 class="parameters">Parameters</h4> | |
525 | <dl> | |
526 | <dt>mime</dt> | |
527 | <dd class="description">MIME database</dd> | |
528 | <dt>mt</dt> | |
529 | <dd class="description">Type</dd> | |
530 | </dl> | |
531 | <h3 class="function"><a name="mimeFileType">mimeFileType</a></h3> | |
532 | <p class="description">Determine the type of a file.</p> | |
533 | <p class="code"> | |
534 | <a href="#mime_type_t">mime_type_t</a> *mimeFileType (<br> | |
535 | <a href="#mime_t">mime_t</a> *mime,<br> | |
321d8d57 MS |
536 | <a href="#const">const</a> char *pathname,<br> |
537 | <a href="#const">const</a> char *filename,<br> | |
f11a948a MS |
538 | int *compression<br> |
539 | );</p> | |
540 | <h4 class="parameters">Parameters</h4> | |
541 | <dl> | |
542 | <dt>mime</dt> | |
543 | <dd class="description">MIME database</dd> | |
544 | <dt>pathname</dt> | |
545 | <dd class="description">Name of file to check on disk</dd> | |
546 | <dt>filename</dt> | |
547 | <dd class="description">Original filename or NULL</dd> | |
548 | <dt>compression</dt> | |
549 | <dd class="description">Is the file compressed?</dd> | |
550 | </dl> | |
551 | <h4 class="returnvalue">Return Value</h4> | |
552 | <p class="description">Type of file</p> | |
553 | <h3 class="function"><a name="mimeFilter">mimeFilter</a></h3> | |
554 | <p class="description">Find the fastest way to convert from one type to another.</p> | |
555 | <p class="code"> | |
556 | cups_array_t *mimeFilter (<br> | |
557 | <a href="#mime_t">mime_t</a> *mime,<br> | |
558 | <a href="#mime_type_t">mime_type_t</a> *src,<br> | |
559 | <a href="#mime_type_t">mime_type_t</a> *dst,<br> | |
560 | int *cost<br> | |
561 | );</p> | |
562 | <h4 class="parameters">Parameters</h4> | |
563 | <dl> | |
564 | <dt>mime</dt> | |
565 | <dd class="description">MIME database</dd> | |
566 | <dt>src</dt> | |
567 | <dd class="description">Source file type</dd> | |
568 | <dt>dst</dt> | |
569 | <dd class="description">Destination file type</dd> | |
570 | <dt>cost</dt> | |
571 | <dd class="description">Cost of filters</dd> | |
572 | </dl> | |
573 | <h4 class="returnvalue">Return Value</h4> | |
574 | <p class="description">Array of filters to run</p> | |
22c9029b MS |
575 | <h3 class="function"><a name="mimeFilter2">mimeFilter2</a></h3> |
576 | <p class="description">Find the fastest way to convert from one type to another, | |
577 | including file size.</p> | |
578 | <p class="code"> | |
579 | cups_array_t *mimeFilter2 (<br> | |
580 | <a href="#mime_t">mime_t</a> *mime,<br> | |
581 | <a href="#mime_type_t">mime_type_t</a> *src,<br> | |
582 | size_t srcsize,<br> | |
583 | <a href="#mime_type_t">mime_type_t</a> *dst,<br> | |
584 | int *cost<br> | |
585 | );</p> | |
586 | <h4 class="parameters">Parameters</h4> | |
587 | <dl> | |
588 | <dt>mime</dt> | |
589 | <dd class="description">MIME database</dd> | |
590 | <dt>src</dt> | |
591 | <dd class="description">Source file type</dd> | |
592 | <dt>srcsize</dt> | |
593 | <dd class="description">Size of source file</dd> | |
594 | <dt>dst</dt> | |
595 | <dd class="description">Destination file type</dd> | |
596 | <dt>cost</dt> | |
597 | <dd class="description">Cost of filters</dd> | |
598 | </dl> | |
599 | <h4 class="returnvalue">Return Value</h4> | |
600 | <p class="description">Array of filters to run</p> | |
f11a948a | 601 | <h3 class="function"><a name="mimeFilterLookup">mimeFilterLookup</a></h3> |
22c9029b | 602 | <p class="description">Lookup a filter.</p> |
f11a948a MS |
603 | <p class="code"> |
604 | <a href="#mime_filter_t">mime_filter_t</a> *mimeFilterLookup (<br> | |
605 | <a href="#mime_t">mime_t</a> *mime,<br> | |
606 | <a href="#mime_type_t">mime_type_t</a> *src,<br> | |
607 | <a href="#mime_type_t">mime_type_t</a> *dst<br> | |
608 | );</p> | |
609 | <h4 class="parameters">Parameters</h4> | |
610 | <dl> | |
611 | <dt>mime</dt> | |
612 | <dd class="description">MIME database</dd> | |
613 | <dt>src</dt> | |
614 | <dd class="description">Source type</dd> | |
615 | <dt>dst</dt> | |
616 | <dd class="description">Destination type</dd> | |
617 | </dl> | |
618 | <h4 class="returnvalue">Return Value</h4> | |
619 | <p class="description">Filter for src->dst</p> | |
620 | <h3 class="function"><a name="mimeFirstFilter">mimeFirstFilter</a></h3> | |
621 | <p class="description">Get the first filter in the MIME database.</p> | |
622 | <p class="code"> | |
623 | <a href="#mime_filter_t">mime_filter_t</a> *mimeFirstFilter (<br> | |
624 | <a href="#mime_t">mime_t</a> *mime<br> | |
625 | );</p> | |
626 | <h4 class="parameters">Parameters</h4> | |
627 | <dl> | |
628 | <dt>mime</dt> | |
629 | <dd class="description">MIME database</dd> | |
630 | </dl> | |
631 | <h4 class="returnvalue">Return Value</h4> | |
632 | <p class="description">Filter or NULL</p> | |
633 | <h3 class="function"><a name="mimeFirstType">mimeFirstType</a></h3> | |
634 | <p class="description">Get the first type in the MIME database.</p> | |
635 | <p class="code"> | |
636 | <a href="#mime_type_t">mime_type_t</a> *mimeFirstType (<br> | |
637 | <a href="#mime_t">mime_t</a> *mime<br> | |
638 | );</p> | |
639 | <h4 class="parameters">Parameters</h4> | |
640 | <dl> | |
641 | <dt>mime</dt> | |
642 | <dd class="description">MIME database</dd> | |
643 | </dl> | |
644 | <h4 class="returnvalue">Return Value</h4> | |
645 | <p class="description">Type or NULL</p> | |
646 | <h3 class="function"><a name="mimeLoad">mimeLoad</a></h3> | |
647 | <p class="description">Create a new MIME database from disk.</p> | |
648 | <p class="code"> | |
649 | <a href="#mime_t">mime_t</a> *mimeLoad (<br> | |
321d8d57 MS |
650 | <a href="#const">const</a> char *pathname,<br> |
651 | <a href="#const">const</a> char *filterpath<br> | |
f11a948a MS |
652 | );</p> |
653 | <h4 class="parameters">Parameters</h4> | |
654 | <dl> | |
655 | <dt>pathname</dt> | |
656 | <dd class="description">Directory to load</dd> | |
657 | <dt>filterpath</dt> | |
658 | <dd class="description">Directory to load</dd> | |
659 | </dl> | |
660 | <h4 class="returnvalue">Return Value</h4> | |
661 | <p class="description">New MIME database</p> | |
662 | <h4 class="discussion">Discussion</h4> | |
663 | <p class="discussion">This function uses <a href="#mimeLoadFilters"><code>mimeLoadFilters</code></a> and <a href="#mimeLoadTypes"><code>mimeLoadTypes</code></a> to | |
664 | create a MIME database from a single directory.</p> | |
665 | <h3 class="function"><a name="mimeLoadFilters">mimeLoadFilters</a></h3> | |
666 | <p class="description">Load filter definitions from disk.</p> | |
667 | <p class="code"> | |
668 | <a href="#mime_t">mime_t</a> *mimeLoadFilters (<br> | |
669 | <a href="#mime_t">mime_t</a> *mime,<br> | |
321d8d57 MS |
670 | <a href="#const">const</a> char *pathname,<br> |
671 | <a href="#const">const</a> char *filterpath<br> | |
f11a948a MS |
672 | );</p> |
673 | <h4 class="parameters">Parameters</h4> | |
674 | <dl> | |
675 | <dt>mime</dt> | |
676 | <dd class="description">MIME database</dd> | |
677 | <dt>pathname</dt> | |
678 | <dd class="description">Directory to load from</dd> | |
679 | <dt>filterpath</dt> | |
680 | <dd class="description">Default filter program directory</dd> | |
681 | </dl> | |
682 | <h4 class="returnvalue">Return Value</h4> | |
683 | <p class="description">MIME database</p> | |
684 | <h4 class="discussion">Discussion</h4> | |
685 | <p class="discussion">This function loads all of the .convs files from the specified directory. | |
686 | Use <a href="#mimeLoadTypes"><code>mimeLoadTypes</code></a> to load all types before you load the filters.</p> | |
687 | <h3 class="function"><a name="mimeLoadTypes">mimeLoadTypes</a></h3> | |
688 | <p class="description">Load type definitions from disk.</p> | |
689 | <p class="code"> | |
690 | <a href="#mime_t">mime_t</a> *mimeLoadTypes (<br> | |
691 | <a href="#mime_t">mime_t</a> *mime,<br> | |
321d8d57 | 692 | <a href="#const">const</a> char *pathname<br> |
f11a948a MS |
693 | );</p> |
694 | <h4 class="parameters">Parameters</h4> | |
695 | <dl> | |
696 | <dt>mime</dt> | |
697 | <dd class="description">MIME database or <code>NULL</code> to create a new one</dd> | |
698 | <dt>pathname</dt> | |
699 | <dd class="description">Directory to load from</dd> | |
700 | </dl> | |
701 | <h4 class="returnvalue">Return Value</h4> | |
702 | <p class="description">MIME database</p> | |
703 | <h4 class="discussion">Discussion</h4> | |
704 | <p class="discussion">This function loads all of the .types files from the specified directory. | |
705 | Use <a href="#mimeLoadFilters"><code>mimeLoadFilters</code></a> to load all filters after you load the types.</p> | |
321d8d57 MS |
706 | <h3 class="function"><a name="mimeNew">mimeNew</a></h3> |
707 | <p class="description">Create a new, empty MIME database.</p> | |
708 | <p class="code"> | |
709 | <a href="#mime_t">mime_t</a> *mimeNew (void);</p> | |
710 | <h4 class="returnvalue">Return Value</h4> | |
711 | <p class="description">MIME database</p> | |
f11a948a MS |
712 | <h3 class="function"><a name="mimeNextFilter">mimeNextFilter</a></h3> |
713 | <p class="description">Get the next filter in the MIME database.</p> | |
714 | <p class="code"> | |
715 | <a href="#mime_filter_t">mime_filter_t</a> *mimeNextFilter (<br> | |
716 | <a href="#mime_t">mime_t</a> *mime<br> | |
717 | );</p> | |
718 | <h4 class="parameters">Parameters</h4> | |
719 | <dl> | |
720 | <dt>mime</dt> | |
721 | <dd class="description">MIME database</dd> | |
722 | </dl> | |
723 | <h4 class="returnvalue">Return Value</h4> | |
724 | <p class="description">Filter or NULL</p> | |
725 | <h3 class="function"><a name="mimeNextType">mimeNextType</a></h3> | |
726 | <p class="description">Get the next type in the MIME database.</p> | |
727 | <p class="code"> | |
728 | <a href="#mime_type_t">mime_type_t</a> *mimeNextType (<br> | |
729 | <a href="#mime_t">mime_t</a> *mime<br> | |
730 | );</p> | |
731 | <h4 class="parameters">Parameters</h4> | |
732 | <dl> | |
733 | <dt>mime</dt> | |
734 | <dd class="description">MIME database</dd> | |
735 | </dl> | |
736 | <h4 class="returnvalue">Return Value</h4> | |
737 | <p class="description">Type or NULL</p> | |
738 | <h3 class="function"><a name="mimeNumFilters">mimeNumFilters</a></h3> | |
22c9029b | 739 | <p class="description">Next type</p> |
f11a948a MS |
740 | <p class="code"> |
741 | int mimeNumFilters (<br> | |
742 | <a href="#mime_t">mime_t</a> *mime<br> | |
743 | );</p> | |
744 | <h4 class="parameters">Parameters</h4> | |
745 | <dl> | |
746 | <dt>mime</dt> | |
747 | <dd class="description">MIME database</dd> | |
748 | </dl> | |
749 | <h4 class="returnvalue">Return Value</h4> | |
750 | <p class="description">Get the number of filters in a MIME database.</p> | |
751 | <h3 class="function"><a name="mimeNumTypes">mimeNumTypes</a></h3> | |
752 | <p class="description">MIME database</p> | |
753 | <p class="code"> | |
754 | int mimeNumTypes (<br> | |
755 | <a href="#mime_t">mime_t</a> *mime<br> | |
756 | );</p> | |
757 | <h4 class="parameters">Parameters</h4> | |
758 | <dl> | |
759 | <dt>mime</dt> | |
760 | <dd class="description">MIME database</dd> | |
761 | </dl> | |
762 | <h4 class="returnvalue">Return Value</h4> | |
763 | <p class="description">Get the number of types in a MIME database.</p> | |
321d8d57 MS |
764 | <h3 class="function"><a name="mimeSetErrorCallback">mimeSetErrorCallback</a></h3> |
765 | <p class="description">Set the callback for error messages.</p> | |
766 | <p class="code"> | |
767 | void mimeSetErrorCallback (<br> | |
768 | <a href="#mime_t">mime_t</a> *mime,<br> | |
769 | mime_error_cb_t cb,<br> | |
770 | void *ctx<br> | |
771 | );</p> | |
772 | <h4 class="parameters">Parameters</h4> | |
773 | <dl> | |
774 | <dt>mime</dt> | |
775 | <dd class="description">MIME database</dd> | |
776 | <dt>cb</dt> | |
777 | <dd class="description">Callback function</dd> | |
778 | <dt>ctx</dt> | |
779 | <dd class="description">Context pointer for callback</dd> | |
780 | </dl> | |
f11a948a MS |
781 | <h3 class="function"><a name="mimeType">mimeType</a></h3> |
782 | <p class="description">Lookup a file type.</p> | |
783 | <p class="code"> | |
784 | <a href="#mime_type_t">mime_type_t</a> *mimeType (<br> | |
785 | <a href="#mime_t">mime_t</a> *mime,<br> | |
321d8d57 MS |
786 | <a href="#const">const</a> char *super,<br> |
787 | <a href="#const">const</a> char *type<br> | |
f11a948a MS |
788 | );</p> |
789 | <h4 class="parameters">Parameters</h4> | |
790 | <dl> | |
791 | <dt>mime</dt> | |
792 | <dd class="description">MIME database</dd> | |
793 | <dt>super</dt> | |
794 | <dd class="description">Super-type name</dd> | |
795 | <dt>type</dt> | |
796 | <dd class="description">Type name</dd> | |
797 | </dl> | |
798 | <h4 class="returnvalue">Return Value</h4> | |
799 | <p class="description">Matching file type definition</p> | |
800 | <h2 class="title"><a name="TYPES">Data Types</a></h2> | |
321d8d57 MS |
801 | <h3 class="typedef"><a name="const">const</a></h3> |
802 | <p class="description">MIME Database</p> | |
803 | <p class="code"> | |
804 | typedef void (*constmime_error_cb_t)(void *; | |
805 | </p> | |
f11a948a MS |
806 | <h3 class="typedef"><a name="mime_filter_t">mime_filter_t</a></h3> |
807 | <p class="description">MIME Conversion Filter Data</p> | |
808 | <p class="code"> | |
809 | typedef struct _mime_filter_s mime_filter_t; | |
810 | </p> | |
811 | <h3 class="typedef"><a name="mime_magic_t">mime_magic_t</a></h3> | |
812 | <p class="description">MIME Magic Data</p> | |
813 | <p class="code"> | |
814 | typedef struct _mime_magic_s mime_magic_t; | |
815 | </p> | |
816 | <h3 class="typedef"><a name="mime_op_t">mime_op_t</a></h3> | |
817 | <p class="description">Types/structures...</p> | |
818 | <p class="code"> | |
819 | typedef enum mime_op_t; | |
820 | </p> | |
821 | <h3 class="typedef"><a name="mime_t">mime_t</a></h3> | |
822 | <p class="description">MIME Database</p> | |
823 | <p class="code"> | |
824 | typedef struct _mime_s mime_t; | |
825 | </p> | |
826 | <h3 class="typedef"><a name="mime_type_t">mime_type_t</a></h3> | |
827 | <p class="description">MIME Type Data</p> | |
828 | <p class="code"> | |
829 | typedef struct _mime_type_s mime_type_t; | |
830 | </p> | |
831 | </div> | |
832 | </body> | |
833 | </html> |