2 * Copyright 2003-2014, Haiku, Inc.
3 * Distributed under the terms of the MIT License.
10 #include <FormattingConventions.h>
21 BLocale(const BLanguage
* language
= NULL
,
22 const BFormattingConventions
* conventions
24 BLocale(const BLocale
& other
);
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;
54 mutable BLocker fLock
;
56 BFormattingConventions fConventions
;
61 //--- collator short-hands inlines ---
65 BLocale::StringCompare(const char* s1
, const char* s2
) const
67 return fCollator
.Compare(s1
, s2
);
72 BLocale::StringCompare(const BString
* s1
, const BString
* s2
) const
74 return fCollator
.Compare(s1
->String(), s2
->String());
79 BLocale::GetSortKey(const char* string
, BString
* sortKey
) const
81 fCollator
.GetSortKey(string
, sortKey
);
85 #endif /* _B_LOCALE_H_ */