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