BRL-CAD

Functions generated by the mime.cmake script - see the generated files mime.c and mime_types.h for the resulting C code and mime type declarations. More...

Collaboration diagram for Mime Types:

Files

file  mime.h
 

Functions

int bu_file_mime (const char *ext, bu_mime_context_t context)
 Use the file extension to attempt to determine the media type of the file within the specified context. More...
 
const char * bu_file_mime_ext (int t, bu_mime_context_t context)
 Given a mime type and a context, return the file extension(s) associated with that type. More...
 
const char * bu_file_mime_str (int t, bu_mime_context_t context)
 Given a mime type and a context, return a human readable string spelling out the type (corresponding to the enum string in source code.) More...
 
int bu_file_mime_int (const char *str)
 Given a string produced by bu_file_mime_str, convert it back into integer form. More...
 

Detailed Description

Functions generated by the mime.cmake script - see the generated files mime.c and mime_types.h for the resulting C code and mime type declarations.

Standard types are maintained in misc/mime.types - that file is a copy of the Apache file and is not changed locally: http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types

Customizations for BRL-CAD are maintained in misc/mime_cad.types and any types not covered by the standard mime set (such as the majority of geometry formats) are added there instead of changing mime.types.

Function Documentation

◆ bu_file_mime()

int bu_file_mime ( const char *  ext,
bu_mime_context_t  context 
)

Use the file extension to attempt to determine the media type of the file within the specified context.

returns -1 if no match was found, or an integer if a result was found. It is the responsibility of the caller to cast the return int to the correct mime_CONTEXT_t type.

◆ bu_file_mime_ext()

const char * bu_file_mime_ext ( int  t,
bu_mime_context_t  context 
)

Given a mime type and a context, return the file extension(s) associated with that type.

returns NULL if no match was found, or a comma separated string containing the extensions if a result was found. It is the responsibility of the caller to free the returned string.

◆ bu_file_mime_str()

const char * bu_file_mime_str ( int  t,
bu_mime_context_t  context 
)

Given a mime type and a context, return a human readable string spelling out the type (corresponding to the enum string in source code.)

returns NULL if no match was found, or a string if a result was found. It is the responsibility of the caller to free the returned string.

◆ bu_file_mime_int()

int bu_file_mime_int ( const char *  str)

Given a string produced by bu_file_mime_str, convert it back into integer form.

returns -1 if no match was found, or an integer if a result was found. It is the responsibility of the caller to cast the return int to the correct mime_CONTEXT_t type.