libDwmRDAP-0.1.4
Dwm::CountryCodes Class Reference

Encapsulates a set of country codes. More...

#include <DwmCountryCodes.hh>

Inherits Readable, and Writable.

Public Member Functions

 CountryCodes ()=default
 Default constructor.
 
CountryCode FindByCode (const std::string &code) const
 Finds a country code by 2 or 3 letter code. More...
 
std::vector< CountryCodeFindByNameRegExp (const std::string &rgxp) const
 
bool ReadJson (const std::string &fileName)
 Reads the country codes from a JSON file. More...
 
bool WriteJson (const std::string &fileName) const
 Writes the country code to a file in JSON format. More...
 
std::istream & Read (std::istream &is)
 Reads the country codes from an istream. Returns the istream.
 
ssize_t Read (int fd)
 Reads the country codes from a descriptor. More...
 
size_t Read (FILE *f)
 Reads the country codes from a FILE. More...
 
std::ostream & Write (std::ostream &os) const
 Writes the country codes to an ostream. Returns the ostream.
 
ssize_t Write (int fd) const
 Writes the country codes to a file descriptor. More...
 
size_t Write (FILE *f) const
 Writes the country codes 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 CountryCodes &countryCodes) const
 operator ==
 

Detailed Description

Encapsulates a set of country codes.

Member Function Documentation

◆ FindByCode()

CountryCode Dwm::CountryCodes::FindByCode ( const std::string &  code) const

Finds a country code by 2 or 3 letter code.

Returns a filled CountryCode on success, an empty CountryCode on failure.

◆ Read() [1/2]

ssize_t Dwm::CountryCodes::Read ( int  fd)

Reads the country codes from a descriptor.

Returns the number of bytes read on success, -1 on failure.

◆ Read() [2/2]

size_t Dwm::CountryCodes::Read ( FILE *  f)

Reads the country codes from a FILE.

Returns 1 on success, 0 on failure (fread() semantics).

◆ ReadJson()

bool Dwm::CountryCodes::ReadJson ( const std::string &  fileName)

Reads the country codes from a JSON file.

Returns true on success, false on failure.

◆ StreamedLength()

uint32_t Dwm::CountryCodes::StreamedLength ( ) const

Returns the number of bytes that should be written if one of the Write() members is called.

◆ Write() [1/2]

ssize_t Dwm::CountryCodes::Write ( int  fd) const

Writes the country codes to a file descriptor.

Returns the number of bytes written on success, -1 on failure.

◆ Write() [2/2]

size_t Dwm::CountryCodes::Write ( FILE *  f) const

Writes the country codes to a FILE.

Returns 1 on success, 0 on failure (fwrite() semantics).

◆ WriteJson()

bool Dwm::CountryCodes::WriteJson ( const std::string &  fileName) const

Writes the country code to a file in JSON format.

Returns true on success, false on failure.


The documentation for this class was generated from the following file: