Adapted to recent changes of %build_linklib.
[AROS-Contrib.git] / FryingPan / framework / Generic / Locale.h
blob25a288fe18cca84561945df0a37232f6979226b1
1 /*
2 * Amiga Generic Set - set of libraries and includes to ease sw development for all Amiga platforms
3 * Copyright (C) 2001-2011 Tomasz Wiszkowski Tomasz.Wiszkowski at gmail.com.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #ifndef _LOCALE_H_
21 #define _LOCALE_H_
23 #include "Types.h"
24 #include "HashT.h"
25 #include "String.h"
27 class LocaleIFace;
28 struct Locale;
30 namespace GenNS
32 class Localization
34 protected:
35 struct locale_set
37 String str;
38 const char* group;
39 const char* id;
40 char accel[2];
42 locale_set() :
43 str(0), group(0), id(0)
45 accel[0] = accel[1] = 0;
48 locale_set(const char* a, const char* b, const char* c, char d=0) :
49 str(a), group(b), id(c)
51 accel[0] = d;
52 accel[1] = 0;
56 protected:
57 class ::LocaleIFace *locale;
58 struct ::Locale *lang;
59 locale_set deflt;
60 HashT<uint32, locale_set> hash;
62 public:
63 struct LocaleSet
65 uint32 key;
66 const char* value;
67 const char* locale_id;
69 enum
71 Set_Last = 0xffffffff
75 void split(String s, char &accelerator, String &text);
76 public:
77 Localization(LocaleSet set[] = 0, const char* group=0);
78 virtual ~Localization();
79 void Add(LocaleSet set[], const char* group=0);
80 const String& operator[] (uint key);
81 const String& Str(uint key);
82 const char Accel(uint key); // give back single char
83 const char* Shortcut(uint key); // give back complete string
84 bool ReadCatalog(const char* name, sint version=0);
86 bool ExportCD(const char* filename, sint version=0);
87 bool ExportCT(const char* filename, sint version=0);
88 String FormatNumber(sint integer, sint millionth=0);
93 #endif