1a33f8fbdSAdrien Destugues/* 270cdd7d4SAdrien Destugues * Copyright 2011-2019 Haiku, Inc. All rights reserved. 3a33f8fbdSAdrien Destugues * Distributed under the terms of the MIT License. 4a33f8fbdSAdrien Destugues * 5a33f8fbdSAdrien Destugues * Authors: 6a33f8fbdSAdrien Destugues * Axel Dörfler, axeld@pinc-software.de. 7a33f8fbdSAdrien Destugues * Adrien Destugues, pulkomandy@gmail.com. 8a33f8fbdSAdrien Destugues * John Scipione, jscipione@gmail.com 9a33f8fbdSAdrien Destugues * 10a33f8fbdSAdrien Destugues * Corresponds to: 1170cdd7d4SAdrien Destugues * headers/os/locale/Country.h rev 53489 1270cdd7d4SAdrien Destugues * src/kits/locale/Country.cpp rev 53489 13a33f8fbdSAdrien Destugues */ 14a33f8fbdSAdrien Destugues 15a33f8fbdSAdrien Destugues 16820dca4dSJohn Scipione/*! 17820dca4dSJohn Scipione \file Country.h 18820dca4dSJohn Scipione \ingroup locale 19820dca4dSJohn Scipione \ingroup libbe 20a33f8fbdSAdrien Destugues \brief BCountry class definition. 21a33f8fbdSAdrien Destugues*/ 22a33f8fbdSAdrien Destugues 23a33f8fbdSAdrien Destugues 24820dca4dSJohn Scipione/*! 25820dca4dSJohn Scipione \class BCountry 26e82e8f36SAdrien Destugues \ingroup locale 27820dca4dSJohn Scipione \ingroup libbe 28820dca4dSJohn Scipione \brief Class representing a country. 29e82e8f36SAdrien Destugues 30820dca4dSJohn Scipione BCountry provides information about a particular country including the 31820dca4dSJohn Scipione countries flag (as an HVIF icon), the localized name of the country, 32820dca4dSJohn Scipione and the ISO country code. 33e82e8f36SAdrien Destugues 34820dca4dSJohn Scipione Date, time, and number formatting also depends to some extent on the 35820dca4dSJohn Scipione language used so they are found in the BLocale class instead. 36edc845a3SJohn Scipione 37edc845a3SJohn Scipione \since Haiku R1 38e82e8f36SAdrien Destugues*/ 39e82e8f36SAdrien Destugues 40a33f8fbdSAdrien Destugues 41e82e8f36SAdrien Destugues/*! 42a33f8fbdSAdrien Destugues \fn BCountry::BCountry(const char* countryCode) 43a33f8fbdSAdrien Destugues \brief Initialize a BCountry from a country code. 44e82e8f36SAdrien Destugues 45a33f8fbdSAdrien Destugues \param countryCode The country code to initialize from. 46edc845a3SJohn Scipione 47edc845a3SJohn Scipione \since Haiku R1 48e82e8f36SAdrien Destugues*/ 49e82e8f36SAdrien Destugues 50a33f8fbdSAdrien Destugues 51a33f8fbdSAdrien Destugues/*! 52a33f8fbdSAdrien Destugues \fn BCountry::BCountry(const BCountry& other) 53a33f8fbdSAdrien Destugues \brief Initialize a BCountry from another BCountry object. 54a33f8fbdSAdrien Destugues 55a33f8fbdSAdrien Destugues \param other The BCountry object to initialize from. 56edc845a3SJohn Scipione 57edc845a3SJohn Scipione \since Haiku R1 58a33f8fbdSAdrien Destugues*/ 59a33f8fbdSAdrien Destugues 60a33f8fbdSAdrien Destugues 61a33f8fbdSAdrien Destugues/*! 62a33f8fbdSAdrien Destugues \fn BCountry& BCountry::operator=(const BCountry& other) 63edc845a3SJohn Scipione \brief Initialize a BCountry from another BCountry object by overloading 64edc845a3SJohn Scipione the = operator. 65edc845a3SJohn Scipione 66edc845a3SJohn Scipione \param other The BCountry object to initialize from. 67edc845a3SJohn Scipione 68edc845a3SJohn Scipione \since Haiku R1 69a33f8fbdSAdrien Destugues*/ 70a33f8fbdSAdrien Destugues 71a33f8fbdSAdrien Destugues 72a33f8fbdSAdrien Destugues/*! 73a33f8fbdSAdrien Destugues \fn BCountry::~BCountry() 74a33f8fbdSAdrien Destugues \brief Destructor method. 75edc845a3SJohn Scipione 76edc845a3SJohn Scipione \since Haiku R1 77a33f8fbdSAdrien Destugues*/ 78a33f8fbdSAdrien Destugues 79a33f8fbdSAdrien Destugues 80e82e8f36SAdrien Destugues/*! 8170cdd7d4SAdrien Destugues \fn status_t BCountry::SetTo(const char* countryCode) 8270cdd7d4SAdrien Destugues \brief Initialize a BCountry from a country code. 8370cdd7d4SAdrien Destugues 8470cdd7d4SAdrien Destugues \param countryCode The country code to initialize from. 8570cdd7d4SAdrien Destugues 8670cdd7d4SAdrien Destugues \returns Same value as InitCheck. 8770cdd7d4SAdrien Destugues 8870cdd7d4SAdrien Destugues \since Haiku R1 8970cdd7d4SAdrien Destugues*/ 9070cdd7d4SAdrien Destugues 9170cdd7d4SAdrien Destugues 9270cdd7d4SAdrien Destugues/*! 9370cdd7d4SAdrien Destugues \fn status_t BCountry::InitCheck() 9470cdd7d4SAdrien Destugues \brief Check validity of the BCountry object. 9570cdd7d4SAdrien Destugues 9670cdd7d4SAdrien Destugues \returns B_OK if everything went fine, B_BAD_DATA if the specified country 9770cdd7d4SAdrien Destugues code is not valid, B_NO_MEMORY if the object could not be 9870cdd7d4SAdrien Destugues allocated properly. 9970cdd7d4SAdrien Destugues 10070cdd7d4SAdrien Destugues \since Haiku R1 10170cdd7d4SAdrien Destugues*/ 10270cdd7d4SAdrien Destugues 10370cdd7d4SAdrien Destugues 10470cdd7d4SAdrien Destugues/*! 105bcd9244eSJohn Scipione \fn status_t BCountry::GetName(BString& name, 106bcd9244eSJohn Scipione const BLanguage* displayLanguage = NULL) const 107bcd9244eSJohn Scipione \brief Writes the country's name into the supplied BString. 108e82e8f36SAdrien Destugues 109bcd9244eSJohn Scipione \param name A reference to a BString to write the country name to. 110bcd9244eSJohn Scipione \param displayLanguage The language to use when writing the name. Can be 111bcd9244eSJohn Scipione \c NULL to use the language set by the user's locale. 112bcd9244eSJohn Scipione 113bcd9244eSJohn Scipione \returns A status code, B_OK if everything went fine, or an error code 114bcd9244eSJohn Scipione otherwise. 115edc845a3SJohn Scipione 116edc845a3SJohn Scipione \since Haiku R1 117e82e8f36SAdrien Destugues*/ 118e82e8f36SAdrien Destugues 119a33f8fbdSAdrien Destugues 120e82e8f36SAdrien Destugues/*! 121*e5fb17f0SAdrien Destugues \fn status_t BCountry::GetPreferredLanguage(BLanguage& language) const 122*e5fb17f0SAdrien Destugues \brief Get the most likely language to use in that country. 123*e5fb17f0SAdrien Destugues 124*e5fb17f0SAdrien Destugues \param language A reference to a BLanguage to set to the preferred language. 125*e5fb17f0SAdrien Destugues 126*e5fb17f0SAdrien Destugues \returns A status code, B_OK if everything went fine, or an error code 127*e5fb17f0SAdrien Destugues otherwise. 128*e5fb17f0SAdrien Destugues 129*e5fb17f0SAdrien Destugues \since Haiku R1 130*e5fb17f0SAdrien Destugues*/ 131*e5fb17f0SAdrien Destugues 132*e5fb17f0SAdrien Destugues 133*e5fb17f0SAdrien Destugues/*! 134e82e8f36SAdrien Destugues \fn const char* BCountry::Code() const 135a33f8fbdSAdrien Destugues \brief Gets the ISO country code for the country. 136a33f8fbdSAdrien Destugues 137a33f8fbdSAdrien Destugues \returns The ISO country code for the country. 138edc845a3SJohn Scipione 139edc845a3SJohn Scipione \since Haiku R1 140e82e8f36SAdrien Destugues*/ 141e82e8f36SAdrien Destugues 142a33f8fbdSAdrien Destugues 143e82e8f36SAdrien Destugues/*! 144e82e8f36SAdrien Destugues \fn status_t BCountry::GetIcon(BBitmap* result) const; 145a33f8fbdSAdrien Destugues \brief Render the country's flag to the given BBitmap. 146e82e8f36SAdrien Destugues 147a33f8fbdSAdrien Destugues This function renders the country's flag to the given BBitmap. The bitmap 148e82e8f36SAdrien Destugues should already be set to the pixel format and size you want to use. 149e82e8f36SAdrien Destugues 150a33f8fbdSAdrien Destugues The flag is stored in HVIF format so it can be rendered at any size and 151a33f8fbdSAdrien Destugues color depth. 152e82e8f36SAdrien Destugues 153820dca4dSJohn Scipione \param result The BBitmap object to draw the flag into. 154e82e8f36SAdrien Destugues 155a33f8fbdSAdrien Destugues \returns \c B_OK if the drawing was successful. 156edc845a3SJohn Scipione 157edc845a3SJohn Scipione \since Haiku R1 158e82e8f36SAdrien Destugues*/ 159