BPicture: Fix archive constructor.
[haiku.git] / src / kits / locale / Format.cpp
blob198874fe845d3d426f99cd22ab4f52e274f8b522
1 #include <Format.h>
3 #include <new>
5 #include <Autolock.h>
6 #include <Locale.h>
7 #include <LocaleRoster.h>
10 BFormat::BFormat(const BLocale* locale)
12 if (locale == NULL)
13 locale = BLocaleRoster::Default()->GetDefaultLocale();
15 if (locale == NULL) {
16 fInitStatus = B_BAD_DATA;
17 return;
20 _Initialize(*locale);
24 BFormat::BFormat(const BLanguage& language,
25 const BFormattingConventions& conventions)
27 _Initialize(language, conventions);
31 BFormat::BFormat(const BFormat &other)
33 fConventions(other.fConventions),
34 fLanguage(other.fLanguage),
35 fInitStatus(other.fInitStatus)
40 BFormat::~BFormat()
45 status_t
46 BFormat::InitCheck() const
48 return fInitStatus;
52 status_t
53 BFormat::_Initialize(const BLocale& locale)
55 BFormattingConventions conventions;
56 BLanguage language;
58 fInitStatus = locale.GetFormattingConventions(&conventions);
59 if (fInitStatus != B_OK)
60 return fInitStatus;
62 fInitStatus = locale.GetLanguage(&language);
63 if (fInitStatus != B_OK)
64 return fInitStatus;
66 return _Initialize(language, conventions);
70 status_t
71 BFormat::_Initialize(const BLanguage& language,
72 const BFormattingConventions& conventions)
74 fConventions = conventions;
75 fLanguage = language;
76 fInitStatus = B_OK;
77 return fInitStatus;