Encapsulates country code information. More...
#include <DwmCountryCode.hh>
Inherits Readable, and Writable.
Public Member Functions | |
| CountryCode ()=default | |
| Default constructor. | |
| CountryCode (const Json::Value &jv) | |
| Construct from a Json::Value. | |
| Json::Value | Json () const |
| Return the country code as a Json::Value. | |
| const std::string & | Alpha2 () const |
| Returns the 2-letter country code. | |
| const std::string & | Alpha2 (const std::string &alpha2) |
| Sets and returns the 2-letter country code. More... | |
| const std::string & | Alpha3 () const |
| Returns the 3-letter country code. | |
| const std::string & | Alpha3 (const std::string &alpha3) |
| Sets and returns the 3-letter country code. More... | |
| const std::string & | Name () const |
| Returns the full country name. | |
| const std::string & | Name (const std::string &name) |
| Sets and returns the full country name. | |
| std::istream & | Read (std::istream &is) |
| Reads the country code from an istream. Returns the istream. | |
| ssize_t | Read (int fd) |
| Reads the country code from a descriptor. More... | |
| size_t | Read (FILE *f) |
| Reads the country code from a FILE. More... | |
| std::ostream & | Write (std::ostream &os) const |
| Writes the country code to an ostream. Returns the ostream. | |
| ssize_t | Write (int fd) const |
| Writes the country code to a file descriptor. More... | |
| size_t | Write (FILE *f) const |
| Writes the country code to a FILE. More... | |
| uint32_t | StreamedLength () const |
| Returns the number of bytes that should be written if one of the Write() members is called. More... | |
| bool | operator== (const CountryCode &cc) const |
| operator == | |
Encapsulates country code information.
2-letter code, 3-letter code and full country name.
| const std::string& Dwm::CountryCode::Alpha2 | ( | const std::string & | alpha2 | ) |
Sets and returns the 2-letter country code.
Will assert() that alpha2 is 2 characters long.
| const std::string& Dwm::CountryCode::Alpha3 | ( | const std::string & | alpha3 | ) |
Sets and returns the 3-letter country code.
Will assert that alpha3 is 3 characters long.
| ssize_t Dwm::CountryCode::Read | ( | int | fd | ) |
Reads the country code from a descriptor.
Returns the number of bytes read on success, -1 on failure.
| size_t Dwm::CountryCode::Read | ( | FILE * | f | ) |
Reads the country code from a FILE.
Returns 1 on success, 0 on failure (fread() semantics).
| uint32_t Dwm::CountryCode::StreamedLength | ( | ) | const |
Returns the number of bytes that should be written if one of the Write() members is called.
| ssize_t Dwm::CountryCode::Write | ( | int | fd | ) | const |
Writes the country code to a file descriptor.
Returns the number of bytes written on success, -1 on failure.
| size_t Dwm::CountryCode::Write | ( | FILE * | f | ) | const |
Writes the country code to a FILE.
Returns 1 on success, 0 on failure (fwrite() semantics).