Geany dev
Data Structures | Macros | Typedefs | Enumerations | Functions
filetypes.h File Reference

Filetype detection, file extensions and filetype menu items. More...

Data Structures

struct  GeanyFiletype
 Represents a filetype. More...
 

Macros

#define filetypes   ((GeanyFiletype **)GEANY(filetypes_array)->pdata)
 Wraps GeanyData::filetypes_array so it can be used with C array syntax. More...
 

Typedefs

typedef struct GeanyFiletype GeanyFiletype
 Represents a filetype.
 

Enumerations

enum  GeanyFiletypeID
 IDs of known filetypes. More...
 

Functions

GeanyFiletypefiletypes_detect_from_file (const gchar *utf8_filename)
 Detects filetype based on a shebang line in the file or the filename extension. More...
 
const gchar * filetypes_get_display_name (GeanyFiletype *ft)
 Gets ft->name or a translation for filetype None. More...
 
const GSList * filetypes_get_sorted_by_name (void)
 Gets a list of filetype pointers sorted by name. More...
 
GeanyFiletypefiletypes_index (gint idx)
 Accessor function for GeanyData::filetypes_array items. More...
 
GeanyFiletypefiletypes_lookup_by_name (const gchar *name)
 Finds a filetype pointer from its name field. More...
 

Detailed Description

Filetype detection, file extensions and filetype menu items.

Macro Definition Documentation

◆ filetypes

#define filetypes   ((GeanyFiletype **)GEANY(filetypes_array)->pdata)

Wraps GeanyData::filetypes_array so it can be used with C array syntax.

Example: filetypes[GEANY_FILETYPES_C]->name = ...;

See also
filetypes_index().

Enumeration Type Documentation

◆ GeanyFiletypeID

IDs of known filetypes.

filetypes will contain an item for each. Use GeanyData::filetypes_array to determine the known filetypes at runtime

Function Documentation

◆ filetypes_detect_from_file()

GeanyFiletype * filetypes_detect_from_file ( const gchar *  utf8_filename)

Detects filetype based on a shebang line in the file or the filename extension.

Parameters
utf8_filenameThe filename in UTF-8 encoding.
Returns
(transfer: none) The detected filetype for utf8_filename or filetypes[GEANY_FILETYPES_NONE] if it could not be detected.

◆ filetypes_get_display_name()

const gchar * filetypes_get_display_name ( GeanyFiletype ft)

Gets ft->name or a translation for filetype None.

Parameters
ft.
Returns
.
Since
Geany 0.20

◆ filetypes_get_sorted_by_name()

const GSList * filetypes_get_sorted_by_name ( void  )

Gets a list of filetype pointers sorted by name.

The list does not change on subsequent calls.

Returns
(element-type: GeanyFiletype) (transfer: none) The list - do not free.
See also
filetypes_by_title.

◆ filetypes_index()

GeanyFiletype * filetypes_index ( gint  idx)

Accessor function for GeanyData::filetypes_array items.

Example:

ft = filetypes_index(GEANY_FILETYPES_C);
GeanyFiletype * filetypes_index(gint idx)
Accessor function for GeanyData::filetypes_array items.
Definition: filetypes.c:1521
Parameters
idxfiletypes_array index.
Returns
(transfer: none) The filetype, or NULL if idx is out of range.
Since
0.16

◆ filetypes_lookup_by_name()

GeanyFiletype * filetypes_lookup_by_name ( const gchar *  name)

Finds a filetype pointer from its name field.

Parameters
nameFiletype name.
Returns
(transfer: none) The filetype found, or NULL.
Since
0.15