libDwmRDAP-0.1.4
Dwm::Ipv4CountryDbValue Class Reference

Encapsulates a value stored in a Ipv4CountryDb. More...

#include <DwmIpv4CountryDb.hh>

Inherits Readable, Writable, GZReadable, GZWritable, BZ2Readable, and BZ2Writable.

Public Member Functions

 Ipv4CountryDbValue ()
 Default constructor.
 
 Ipv4CountryDbValue (const std::string &code, const TimeValue64 &lastChanged, const TimeValue64 &lastUpdated=TimeValue64(true))
 Construct from a 2-letter country code and a last updated timestamp.
 
 Ipv4CountryDbValue (const Json::Value &rdapResponse)
 Construct from an ip RDAP response.
 
const std::string & Code () const
 Returns the country code.
 
const std::string & Code (const std::string code)
 Sets and returns the country code.
 
const TimeValue64 & LastUpdated () const
 Returns the last-updated timestamp.
 
const TimeValue64 & LastUpdated (const TimeValue64 &lastUpdated)
 Sets and returns the last-updated timestamp.
 
const TimeValue64 & LastChanged () const
 Returns the last-changed timestamp. More...
 
const TimeValue64 & LastChanged (const TimeValue64 &lastUpdated)
 Sets and returns the last-updated timestamp. More...
 
std::istream & Read (std::istream &is)
 Reads the value from an istream. Returns the istream.
 
ssize_t Read (int fd)
 Reads the value from a descriptor. More...
 
size_t Read (FILE *f)
 Reads the value from a FILE. More...
 
int Read (gzFile gzf)
 Reads the value from a gzFile. More...
 
int BZRead (BZFILE *bzf)
 Reads the value from a BZFILE. More...
 
std::ostream & Write (std::ostream &os) const
 Writes the value to an ostream. Returns the ostream.
 
ssize_t Write (int fd) const
 Writes the value to a descriptor. More...
 
size_t Write (FILE *f) const
 Writes the value to a FILE. More...
 
int Write (gzFile gzf) const
 Writes the value to a gzFile. More...
 
int BZWrite (BZFILE *bzf) const
 Writes the value to a BZFILE. More...
 
uint32_t StreamedLength () const
 Returns the number of bytes that would be written if one of the Write() members were called. More...
 
bool operator== (const Ipv4CountryDbValue &val) const
 operator ==
 
Json::Value Json () const
 

Detailed Description

Encapsulates a value stored in a Ipv4CountryDb.

Just a country code and a timestamp.

Member Function Documentation

◆ BZRead()

int Dwm::Ipv4CountryDbValue::BZRead ( BZFILE *  bzf)

Reads the value from a BZFILE.

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

◆ BZWrite()

int Dwm::Ipv4CountryDbValue::BZWrite ( BZFILE *  bzf) const

Writes the value to a BZFILE.

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

◆ LastChanged() [1/2]

const TimeValue64& Dwm::Ipv4CountryDbValue::LastChanged ( ) const

Returns the last-changed timestamp.

This comes from the registry (ARIN, APNIC, RIPE, LACNIC, AFRINIC, et. al.).

◆ LastChanged() [2/2]

const TimeValue64& Dwm::Ipv4CountryDbValue::LastChanged ( const TimeValue64 &  lastUpdated)

Sets and returns the last-updated timestamp.

This should be the "last changed" event from the registry (ARIN, APNIC, RIPE, LACNIC, AFRINIC, et. al.).

◆ Read() [1/3]

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

Reads the value from a descriptor.

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

◆ Read() [2/3]

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

Reads the value from a FILE.

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

◆ Read() [3/3]

int Dwm::Ipv4CountryDbValue::Read ( gzFile  gzf)

Reads the value from a gzFile.

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

◆ StreamedLength()

uint32_t Dwm::Ipv4CountryDbValue::StreamedLength ( ) const

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

◆ Write() [1/3]

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

Writes the value to a descriptor.

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

◆ Write() [2/3]

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

Writes the value to a FILE.

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

◆ Write() [3/3]

int Dwm::Ipv4CountryDbValue::Write ( gzFile  gzf) const

Writes the value to a gzFile.

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


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