Make sure not to leak tmp_errfile if only outf creation fails
[geany-mirror.git] / src / encodingsprivate.h
blob8c574bfefe3fb9811ce80ef9b150b334d363a5ad
1 /*
2 * encodingsprivate.h - this file is part of Geany, a fast and lightweight IDE
4 * Copyright 2005-2012 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
5 * Copyright 2006-2012 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #ifndef ENCODINGSPRIVATE_H
23 #define ENCODINGSPRIVATE_H
25 #include "encodings.h"
27 /* Groups of encodings */
28 typedef enum
30 NONE = 0,
31 WESTEUROPEAN,
32 EASTEUROPEAN,
33 EASTASIAN,
34 ASIAN,
35 MIDDLEEASTERN,
36 UNICODE,
38 GEANY_ENCODING_GROUPS_MAX
40 GeanyEncodingGroup;
42 /* Structure to represent an encoding to be used in Geany. */
43 typedef struct GeanyEncoding
45 GeanyEncodingIndex idx; /* The index of the encoding inside globa encodes array.*/
46 gint order; /* Internally used member for grouping */
47 GeanyEncodingGroup group; /* Internally used member for grouping */
48 const gchar *charset; /* String representation of the encoding, e.g. "ISO-8859-3" */
49 const gchar *name; /* Translatable and descriptive name of the encoding, e.g. "South European" */
51 GeanyEncoding;
53 const GeanyEncoding* encodings_get_from_charset(const gchar *charset);
54 const GeanyEncoding* encodings_get_from_index(gint idx);
56 gchar* encodings_to_string(const GeanyEncoding* enc);
57 const gchar* encodings_get_charset(const GeanyEncoding* enc);
59 void encodings_select_radio_item(const gchar *charset);
61 void encodings_init(void);
62 void encodings_finalize(void);
64 GtkTreeStore *encodings_encoding_store_new(gboolean has_detect);
66 gint encodings_encoding_store_get_encoding(GtkTreeStore *store, GtkTreeIter *iter);
68 gboolean encodings_encoding_store_get_iter(GtkTreeStore *store, GtkTreeIter *iter, gint enc);
70 void encodings_encoding_store_cell_data_func(GtkCellLayout *cell_layout, GtkCellRenderer *cell,
71 GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data);
73 gboolean encodings_is_unicode_charset(const gchar *string);
75 gboolean encodings_convert_to_utf8_auto(gchar **buf, gsize *size, const gchar *forced_enc,
76 gchar **used_encoding, gboolean *has_bom, gboolean *partial);
78 GeanyEncodingIndex encodings_scan_unicode_bom(const gchar *string, gsize len, guint *bom_len);
80 GeanyEncodingIndex encodings_get_idx_from_charset(const gchar *charset);
82 extern GeanyEncoding encodings[GEANY_ENCODINGS_MAX];
84 #endif /* ENCODINGSPRIVATE_H */