1 /*
2  * Seven Kingdoms: Ancient Adversaries
3  *
4  * Copyright 2018 Jesse Allen
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 //Filename    : LocaleRes.h
22 //Description : Header file for locale resources
23 
24 #ifndef __LOCALERES_H
25 #define __LOCALERES_H
26 
27 #ifdef ENABLE_NLS
28 #include <iconv.h>
29 #endif
30 
31 struct LocaleRec
32 {
33 	enum { LANG_LEN=4, FONTSET_LEN=16, CODESET_LEN=16 };
34 
35 	char lang[LANG_LEN];
36 	char fontset[FONTSET_LEN];
37 	char codeset[CODESET_LEN];
38 };
39 
40 class LocaleRes
41 {
42 public:
43 	int init_flag;
44 	char lang[LocaleRec::LANG_LEN+1];
45 	char fontset[LocaleRec::FONTSET_LEN+1];
46 	char codeset[LocaleRec::CODESET_LEN+1];
47 #ifdef ENABLE_NLS
48 	iconv_t cd;
49 	iconv_t cd_latin;
50 	iconv_t cd_from_sdl;
51 #endif
52 
53 private:
54 	char *in_buf;
55 	char *out_buf;
56 	size_t in_buf_size;
57 	size_t out_buf_size;
58 
59 //---------------------------------------//
60 
61 public:
62 	LocaleRes();
63 	~LocaleRes();
64 
65 	void init();
66 	void deinit();
67 	void load();
68 
69 #ifdef ENABLE_NLS
70 	const char *conv_str(iconv_t cd, const char *s);
71 #endif
72 };
73 
74 extern LocaleRes locale_res;
75 
76 #endif
77