Make UEFI boot-platform build again
[haiku.git] / headers / os / locale / Locale.h
blob51f4559ca7fb6a87308731b5fec95f64ad3b2552
1 /*
2 * Copyright 2003-2014, Haiku, Inc.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef _B_LOCALE_H_
6 #define _B_LOCALE_H_
9 #include <Collator.h>
10 #include <FormattingConventions.h>
11 #include <Language.h>
12 #include <Locker.h>
15 class BCatalog;
16 class BString;
19 class BLocale {
20 public:
21 BLocale(const BLanguage* language = NULL,
22 const BFormattingConventions* conventions
23 = NULL);
24 BLocale(const BLocale& other);
25 ~BLocale();
27 static const BLocale* Default();
29 BLocale& operator=(const BLocale& other);
31 status_t GetCollator(BCollator* collator) const;
32 status_t GetLanguage(BLanguage* language) const;
33 status_t GetFormattingConventions(
34 BFormattingConventions* conventions) const;
36 void SetFormattingConventions(
37 const BFormattingConventions& conventions);
38 void SetCollator(const BCollator& newCollator);
39 void SetLanguage(const BLanguage& newLanguage);
41 // see definitions in LocaleStrings.h
42 const char* GetString(uint32 id) const;
44 // Collator short-hands
45 int StringCompare(const char* s1,
46 const char* s2) const;
47 int StringCompare(const BString* s1,
48 const BString* s2) const;
50 void GetSortKey(const char* string,
51 BString* sortKey) const;
53 private:
54 mutable BLocker fLock;
55 BCollator fCollator;
56 BFormattingConventions fConventions;
57 BLanguage fLanguage;
61 //--- collator short-hands inlines ---
62 // #pragma mark -
64 inline int
65 BLocale::StringCompare(const char* s1, const char* s2) const
67 return fCollator.Compare(s1, s2);
71 inline int
72 BLocale::StringCompare(const BString* s1, const BString* s2) const
74 return fCollator.Compare(s1->String(), s2->String());
78 inline void
79 BLocale::GetSortKey(const char* string, BString* sortKey) const
81 fCollator.GetSortKey(string, sortKey);
85 #endif /* _B_LOCALE_H_ */