Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / ACE / apps / JAWS / clients / WebSTONE / src / nsapi-includes / base / cinfo.h
blob321169048002fbc4f5c1b2c73f4508f05267e16d
1 /*
2 * Copyright (c) 1994, 1995. Netscape Communications Corporation. All
3 * rights reserved.
5 * Use of this software is governed by the terms of the license agreement for
6 * the Netscape Communications or Netscape Comemrce Server between the
7 * parties.
8 */
11 /* ------------------------------------------------------------------------ */
15 * cinfo.h: Content Information for a file, i.e. its type, etc.
17 * See cinfo.c for dependency information.
19 * Rob McCool
23 #ifndef CINFO_H
24 #define CINFO_H
27 /* ------------------------------ Constants ------------------------------- */
31 * This will be the first string in the file, followed by x.x version
32 * where x is an integer.
34 * Updated due to trendy name change
37 #define MCC_MT_MAGIC "#--Mosaic Communications Corporation MIME Information"
38 #define MCC_MT_MAGIC_LEN 53
39 #define NCC_MT_MAGIC "#--Netscape Communications Corporation MIME Information"
40 #define NCC_MT_MAGIC_LEN 55
42 /* The character which separates extensions with cinfo_find */
44 #define CINFO_SEPARATOR '.'
46 /* The maximum length of a line in this file */
48 #define CINFO_MAX_LEN 1024
50 /* The hash function for the database. Hashed on extension. */
51 #include <ctype.h>
52 #define CINFO_HASH(s) (isalpha(s[0]) ? tolower(s[0]) - 'a' : 26)
54 /* The hash table size for that function */
55 #define CINFO_HASHSIZE 27
58 /* ------------------------------ Structures ------------------------------ */
62 * The ContentInfo structure.
64 * Currently, we support the following attributes:
66 * 1. Type: This identifies what kind of data is in the file.
67 * 2. Encoding: Identifies any compression or otherwise content-independent
68 * transformation which has been applied to the file (uuencode, etc.)
69 * 3. Language: Identifies the language a text document is in.
70 * 4. Description: A text string describing the file.
71 * 5. Viewer: The program to use to view the file.
73 * Multiple items are separated with a comma, e.g.
74 * encoding="x-gzip, x-uuencode"
77 typedef struct {
78 char *type;
79 char *encoding;
80 char *language;
81 } cinfo;
84 /* ------------------------------ Prototypes ------------------------------ */
88 * cinfo_init initializes the content info system. Call this before
89 * cinfo_merge.
92 void cinfo_init();
95 * cinfo_terminate frees the database for shutdown.
98 void cinfo_terminate();
101 * cinfo_merge merges the contents of the given filename with the current
102 * cinfo database. It returns NULL upon success and a string (which you
103 * must deallocate) upon error.
106 char *cinfo_merge(char *fn);
110 * cinfo_find finds any content information for the given uri. The file name
111 * is the string following the last / in the uri. Multiple extensions are
112 * separated by CINFO_SEPARATOR. You may pass in a filename instead of uri.
114 * Returns a newly allocated cinfo structure with the information it
115 * finds. The elements of this structure are coming right out of the types
116 * database and so if you change it or want to keep it around for long you
117 * should strdup it. You should free only the structure itself when finished
118 * with it.
120 * If there is no information for any one of the extensions it
121 * finds, it will ignore that extension. If it cannot find information for
122 * any of the extensions, it will return NULL.
125 cinfo *cinfo_find(char *uri);
128 * cinfo_lookup finds the information about the given content-type, and
129 * returns a cinfo structure so you can look up description and icon.
132 cinfo *cinfo_lookup(char *type);
135 * cinfo_dump_database dumps the current database to the given file desc.
138 #include <stdio.h>
139 void cinfo_dump_database(FILE *dump);
142 #endif