Public Member Functions | List of all members
BCountry Class Reference

Class representing a country. More...

Public Member Functions

 BCountry (const char *countryCode=NULL)
 Initialize a BCountry from a country code. More...
 
 BCountry (const BCountry &other)
 Initialize a BCountry from another BCountry object. More...
 
 ~BCountry ()
 Destructor method. More...
 
const char * Code () const
 Gets the ISO country code for the country. More...
 
status_t GetIcon (BBitmap *result) const
 Render the country's flag to the given BBitmap. More...
 
status_t GetName (BString &name, const BLanguage *displayLanguage=NULL) const
 Writes the country's name into the supplied BString. More...
 
BCountryoperator= (const BCountry &other)
 Initialize a BCountry from another BCountry object by overloading the = operator. More...
 

Detailed Description

Class representing a country.

BCountry provides information about a particular country including the countries flag (as an HVIF icon), the localized name of the country, and the ISO country code.

Date, time, and number formatting also depends to some extent on the language used so they are found in the BLocale class instead.

Since
Haiku R1

Constructor & Destructor Documentation

◆ BCountry() [1/2]

BCountry::BCountry ( const char *  countryCode = NULL)

Initialize a BCountry from a country code.

Parameters
countryCodeThe country code to initialize from.
Since
Haiku R1

◆ BCountry() [2/2]

BCountry::BCountry ( const BCountry other)

Initialize a BCountry from another BCountry object.

Parameters
otherThe BCountry object to initialize from.
Since
Haiku R1

◆ ~BCountry()

BCountry::~BCountry ( )

Destructor method.

Since
Haiku R1

Member Function Documentation

◆ Code()

const char * BCountry::Code ( ) const

Gets the ISO country code for the country.

Returns
The ISO country code for the country.
Since
Haiku R1

◆ GetIcon()

status_t BCountry::GetIcon ( BBitmap result) const

Render the country's flag to the given BBitmap.

This function renders the country's flag to the given BBitmap. The bitmap should already be set to the pixel format and size you want to use.

The flag is stored in HVIF format so it can be rendered at any size and color depth.

Parameters
resultThe BBitmap object to draw the flag into.
Returns
B_OK if the drawing was successful.
Since
Haiku R1

◆ GetName()

status_t BCountry::GetName ( BString name,
const BLanguage *  displayLanguage = NULL 
) const

Writes the country's name into the supplied BString.

Parameters
nameA reference to a BString to write the country name to.
displayLanguageThe language to use when writing the name. Can be NULL to use the language set by the user's locale.
Returns
A status code, B_OK if everything went fine, or an error code otherwise.
Since
Haiku R1

◆ operator=()

BCountry & BCountry::operator= ( const BCountry other)

Initialize a BCountry from another BCountry object by overloading the = operator.

Parameters
otherThe BCountry object to initialize from.
Since
Haiku R1