Loading...
Searching...
No Matches
Public Member Functions | List of all members
BCountry Class Reference

Class representing a country. More...

Public Member Functions

 BCountry (const BCountry &other)
 Initialize a BCountry from another BCountry object.
 
 BCountry (const char *countryCode=NULL)
 Initialize a BCountry from a country code.
 
 ~BCountry ()
 Destructor method.
 
const char * Code () const
 Gets the ISO country code for the country.
 
status_t GetIcon (BBitmap *result) const
 Render the country's flag to the given BBitmap.
 
status_t GetName (BString &name, const BLanguage *displayLanguage=NULL) const
 Writes the country's name into the supplied BString.
 
status_t GetPreferredLanguage (BLanguage &) const
 Get the most likely language to use in that country.
 
status_t InitCheck () const
 Check validity of the BCountry object.
 
BCountryoperator= (const BCountry &other)
 Initialize a BCountry from another BCountry object by overloading the = operator.
 
status_t SetTo (const char *countryCode)
 Initialize a BCountry from a country code.
 

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

◆ GetPreferredLanguage()

status_t BCountry::GetPreferredLanguage ( BLanguage &  language) const

Get the most likely language to use in that country.

Parameters
languageA reference to a BLanguage to set to the preferred language.
Returns
A status code, B_OK if everything went fine, or an error code otherwise.
Since
Haiku R1

◆ InitCheck()

status_t BCountry::InitCheck ( ) const

Check validity of the BCountry object.

Returns
B_OK if everything went fine, B_BAD_DATA if the specified country code is not valid, B_NO_MEMORY if the object could not be allocated properly.
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

◆ SetTo()

status_t BCountry::SetTo ( const char *  countryCode)

Initialize a BCountry from a country code.

Parameters
countryCodeThe country code to initialize from.
Returns
Same value as InitCheck.
Since
Haiku R1