libUTL++
utl::InetHostname Class Reference

Internet host name. More...

#include <InetHostname.h>

Inheritance diagram for utl::InetHostname:

Public Member Functions

 InetHostname (const String &hostName)
 Constructor. More...
 
 InetHostname (const char *hostName)
 Constructor. More...
 
 InetHostname (const InetHostAddress &hostAddr)
 Constructor. More...
 
InetHostAddress address () const
 Return the first/primary address this hostname resolves to. More...
 
InetHostAddress getAddress () const
 Return the first/primary address this hostname resolves to. More...
 
void addresses (Collection *collection) const
 Return all addresses this hostname resolves to. More...
 
void getAddresses (Collection *collection) const
 Get all addresses this hostname resolves to. More...
 
void aliases (Collection *collection) const
 Return all aliases for this hostname. More...
 
void getAliases (Collection *collection) const
 Get all aliases for this hostname. More...
 
void set (const InetHostAddress &hostAddr)
 Set = the name for the given host address. More...
 
- Public Member Functions inherited from utl::String
 String (const char *s, bool owner=true, bool duplicate=true, bool caseSensitive=true)
 Constructor. More...
 
 String (size_t size)
 Constructor. More...
 
 String (char c)
 Constructor. More...
 
virtual int compare (const Object &rhs) const
 Compare with another object. More...
 
virtual void copy (const Object &rhs)
 Copy another instance. More...
 
virtual void steal (Object &rhs)
 "Steal" the internal representation from another instance. More...
 
virtual size_t hash (size_t size) const
 Get the hash code for the object. More...
 
virtual void serialize (Stream &stream, uint_t io, uint_t mode=ser_default)
 Serialize to or from a stream. More...
 
virtual size_t innerAllocatedSize () const
 Get the "inner" allocated size. More...
 
virtual String toString () const
 Return a string representation of self. More...
 
bool isOwner () const
 Get the ownership flag. More...
 
void setOwner (bool owner)
 Set the ownership flag (without doing anything else). More...
 
bool isCaseSensitive () const
 Get the case-sensitive flag. More...
 
void setCaseSensitive (bool caseSensitive)
 Set the case-sensitive flag. More...
 
bool isMarked () const
 Get the marked flag. More...
 
void setMarked (bool marked=true)
 Set the marked flag. More...
 
int compareSubstring (size_t begin, const String &rhs, size_t n)
 Compare the given string against a substring of self. More...
 
int compareSubstring (size_t begin, const char *rhs, size_t len)
 Compare the given string against a substring of self. More...
 
int comparePrefix (const String &rhs) const
 Compare the given string against the beginning of self. More...
 
int comparePrefix (const char *rhs) const
 Compare the given string against the beginning of self. More...
 
int compareSuffix (const String &rhs) const
 Compare the given string against the end of self. More...
 
int compareSuffix (const char *rhs) const
 Compare the given string against the end of self. More...
 
int strcmp (const char *lhs, const char *rhs) const
 Compare two strings (case sensitive comparison iff isCaseSensitive()). More...
 
std::function< int(const char *, const char *)> strcmp () const
 Get the string comparison function (strcmp or strcasecmp). More...
 
int strncmp (const char *lhs, const char *rhs, size_t n) const
 Compare (up to) the first n bytes of two strings (case sensitive iff isCaseSensitive()). More...
 
std::function< int(const char *, const char *, size_t)> strncmp () const
 Get the length-limited string comparison function (strncmp or strncasecmp). More...
 
String backslashEscaped (const char *specials) const
 Backslash-escape a string. More...
 
String backslashEscaped (const String &specials) const
 Backslash-escape a string. More...
 
String backslashUnescaped () const
 Backslash-unescape a string. More...
 
bool empty () const
 Is the string empty?
 
size_t find (const String &str, size_t begin=0) const
 Find the first instance of the given string in self. More...
 
size_t find (const char *str, size_t begin=0) const
 Find the first instance of the given string in self. More...
 
size_t find (char c, size_t begin=0) const
 Find the first instance of the given character in self. More...
 
size_t findBM (const String &str, size_t begin=0) const
 Use Boyer-Moore algorithm to find the first instance of the given string. More...
 
size_t findBM (const char *str, size_t begin=0) const
 Use Boyer-Moore algorithm to find the first instance of the given string. More...
 
char firstChar () const
 Get the first character in the string (nul if empty). More...
 
char lastChar () const
 Get the last character in the string (nul if empty). More...
 
const char * get () const
 Get const char*. More...
 
size_t length () const
 Get the length of the string. More...
 
void lengthInvalidate () const
 Invalidate the cached length of the string. More...
 
String prefix (size_t n) const
 Get the first n characters of the string. More...
 
size_t size () const
 Get the size of the allocated character array. More...
 
String subString (size_t begin, size_t len=size_t_max) const
 Get a substring. More...
 
String suffix (size_t n) const
 Get the last n characters of the string. More...
 
String reversed () const
 Get a copy of self with the characters in reverse order. More...
 
String nextToken (size_t &idx, char delim=' ', bool processQuotes=false) const
 Return the next token in a delimited string. More...
 
Stringclear ()
 Reset to empty string. More...
 
Stringexcise ()
 Like clear(), but de-allocate the array instead of writing a nul character at position 0.
 
char * get ()
 Get char*. More...
 
char get (size_t i) const
 Get the specified character. More...
 
StringassertOwner ()
 Make sure self has its own copy of the string. More...
 
void assertOwner (size_t size, size_t increment=8)
 Make sure self has its own copy of the string. More...
 
void economize ()
 Make sure no extra space is allocated. More...
 
void reserve (size_t size, size_t increment=8)
 Grow to the specified size. More...
 
Stringappend (char c)
 Append the given character. More...
 
Stringappend (const String &s)
 Append the given string. More...
 
Stringappend (const char *s)
 Append the given string. More...
 
Stringappend (const char *s, size_t len)
 Append the given string. More...
 
String chop (size_t begin, size_t len=size_t_max)
 Chop out and return a sub-string. More...
 
void remove (size_t begin, size_t len=size_t_max)
 Remove a sub-string (like chop(), but doesn't return the removed sub-string). More...
 
Stringreplace (const String &lhs, const String &rhs)
 Replace all instances of lhs with rhs. More...
 
Stringreplace (const char *lhs, const char *rhs)
 Replace all instances of lhs with rhs. More...
 
Stringreplace (const char *lhs, const String &rhs)
 Replace all instances of lhs with rhs. More...
 
Stringreplace (const String &lhs, const char *rhs)
 Replace all instances of lhs with rhs. More...
 
Stringreplace (size_t begin, size_t len, const String &str)
 Replace a substring with a given string. More...
 
Stringreverse ()
 Reverse the ordering of the characters. More...
 
void set (const char *s, bool owner=true, bool duplicate=true, size_t length=size_t_max)
 Set a new string. More...
 
StringtoLower (size_t begin=0, size_t len=size_t_max)
 Convert characters to lowercase. More...
 
StringtoUpper (size_t begin=0, size_t len=size_t_max)
 Convert characters to uppercase. More...
 
StringpadBegin (size_t len, char c=' ')
 Pad with spaces (or another character) at the beginning. More...
 
StringpadEnd (size_t len, char c=' ')
 Pad with spaces (or another character) at the end. More...
 
Stringtrim ()
 Trim whitespace from the beginning and end. More...
 
StringtrimBegin ()
 Trim whitespace from the beginning. More...
 
StringtrimEnd ()
 Trim whitespace from the end. More...
 
String operator+ (char c) const
 Get a copy of self with the given character appended. More...
 
String operator+ (const char *str) const
 Get a copy of self with the given string appended. More...
 
String operator+ (const String &rhs) const
 Get a copy of self with the given string appended. More...
 
Stringoperator+= (char c)
 Append the given character to self. More...
 
Stringoperator+= (const char *rhs)
 Append the given string to self. More...
 
Stringoperator+= (const String &rhs)
 Append the given string to self. More...
 
Stringoperator= (const char *str)
 Make self equal to a copy of the given character array. More...
 
Stringoperator= (char c)
 Make self equal to the given character. More...
 
char & operator[] (size_t i)
 Array access operator. More...
 
const char & operator[] (size_t i) const
 Array access operator. More...
 
 operator char * ()
 Conversion to char*. More...
 
 operator const char * ()
 Conversion to const char*. More...
 
 operator const char * () const
 Conversion to const char*. More...
 
 operator void * ()
 Conversion to void*. More...
 
 operator const void * ()
 Conversion to const void*. More...
 
 operator const void * () const
 Conversion to const void*. More...
 
bool operator< (const Object &rhs) const
 
bool operator<= (const Object &rhs) const
 
bool operator> (const Object &rhs) const
 
bool operator>= (const Object &rhs) const
 
bool operator== (const Object &rhs) const
 
bool operator!= (const Object &rhs) const
 
bool operator< (const String &rhs) const
 
bool operator<= (const String &rhs) const
 
bool operator> (const String &rhs) const
 
bool operator>= (const String &rhs) const
 
bool operator== (const String &rhs) const
 
bool operator!= (const String &rhs) const
 
- Public Member Functions inherited from utl::Object
void clear ()
 Revert to initial state. More...
 
virtual void vclone (const Object &rhs)
 Make an exact copy of another instance. More...
 
virtual void dump (Stream &os, uint_t level=uint_t_max) const
 Dump a human-readable representation of self to the given output stream. More...
 
void dumpWithClassName (Stream &os, uint_t indent=4, uint_t level=uint_t_max) const
 Front-end for dump() that prints the object's class name. More...
 
virtual const ObjectgetKey () const
 Get the key for this object. More...
 
bool hasKey () const
 Determine whether or not the object has a key. More...
 
virtual const ObjectgetProxiedObject () const
 Get the proxied object (= self if none). More...
 
virtual ObjectgetProxiedObject ()
 Get the proxied object (= self if none). More...
 
bool _isA (const RunTimeClass *runTimeClass) const
 Determine whether self's class is a descendent of the given class. More...
 
 operator String () const
 Conversion to String. More...
 
size_t allocatedSize () const
 Get the total allocated size of this object. More...
 
virtual void addOwnedIt (const class FwdIt *it) const
 Notify self that it owns the given iterator. More...
 
virtual void removeOwnedIt (const class FwdIt *it) const
 Notify self that the given owned iterator has been destroyed. More...
 
bool operator< (const Object &rhs) const
 Less-than operator. More...
 
bool operator<= (const Object &rhs) const
 Less-than-or-equal-to operator. More...
 
bool operator> (const Object &rhs) const
 Greater-than operator. More...
 
bool operator>= (const Object &rhs) const
 Greater-than-or-equal-to operator. More...
 
bool operator== (const Object &rhs) const
 Equal-to operator. More...
 
bool operator!= (const Object &rhs) const
 Unequal-to operator. More...
 
void serializeIn (Stream &is, uint_t mode=ser_default)
 Serialize from an input stream. More...
 
void serializeOut (Stream &os, uint_t mode=ser_default) const
 Serialize to an output stream. More...
 
void serializeOutBoxed (Stream &os, uint_t mode=ser_default) const
 Serialize a boxed object to an output stream. More...
 
- Public Member Functions inherited from utl::FlagsMI
 FlagsMI ()
 Constructor. More...
 
virtual ~FlagsMI ()
 Destructor. More...
 
void copyFlags (const FlagsMI &rhs)
 Copy the given flags. More...
 
void copyFlags (const FlagsMI &rhs, uint_t lsb, uint_t msb)
 Copy (some of) the given flags. More...
 
void copyFlags (uint64_t flags, uint_t lsb, uint_t msb)
 Copy (some of) the given flags. More...
 
bool getFlag (uint_t flagNum) const
 Get a user-defined flag. More...
 
void setFlag (uint_t flagNum, bool val)
 Set a user-defined flag. More...
 
uint64_t getFlagsNumber (uint64_t mask, uint64_t shift=0)
 Get a multi-bit value in the flags data (which is stored as one 64-bit integer). More...
 
void setFlagsNumber (uint64_t mask, uint64_t shift, uint64_t num)
 Set a multi-bit value in the flags data (which is stored as one 64-bit integer). More...
 
uint64_t getFlags () const
 Get the flags. More...
 
void setFlags (uint64_t flags)
 Set the flags. More...
 

Static Public Member Functions

static InetHostname localInetHostname ()
 Return the name of the local host. More...
 
static InetHostname localFQDN ()
 Return the FQDN of the local host. More...
 
static String localDomainName ()
 Return the domain name of the local host. More...
 
- Static Public Member Functions inherited from utl::String
static String repeat (char c, size_t num)
 Return a string consisting of a repeated character. More...
 
static String spaces (size_t num)
 Return a string consisting of the given number of spaces. More...
 
- Static Public Member Functions inherited from utl::Object
static ObjectserializeInNullable (Stream &is, uint_t mode=ser_default)
 Serialize a nullptr-able object from an input stream. More...
 
static void serializeOutNullable (const Object *object, Stream &os, uint_t mode=ser_default)
 Serialize a nullptr-able object to an output stream. More...
 
static void serializeNullable (Object *&object, Stream &stream, uint_t io, uint_t mode=ser_default)
 Serialize a nullptr-able object to or from a stream. More...
 
static ObjectserializeInBoxed (Stream &is, uint_t mode=ser_default)
 Serialize a boxed object from an input stream. More...
 
static void serializeBoxed (Object *&object, Stream &stream, uint_t io, uint_t mode=ser_default)
 Serialize a boxed object to or from a stream. More...
 

Detailed Description

Internet host name.

Author
Adam McKee

Definition at line 27 of file InetHostname.h.

Constructor & Destructor Documentation

◆ InetHostname() [1/3]

utl::InetHostname::InetHostname ( const String hostName)
inline

Constructor.

Parameters
hostNamehostname

Definition at line 37 of file InetHostname.h.

◆ InetHostname() [2/3]

utl::InetHostname::InetHostname ( const char *  hostName)
inline

Constructor.

Parameters
hostNamehostname

Definition at line 46 of file InetHostname.h.

◆ InetHostname() [3/3]

utl::InetHostname::InetHostname ( const InetHostAddress hostAddr)

Constructor.

Parameters
hostAddrhost address (get its hostname)

Member Function Documentation

◆ address()

InetHostAddress utl::InetHostname::address ( ) const

Return the first/primary address this hostname resolves to.

◆ getAddress()

InetHostAddress utl::InetHostname::getAddress ( ) const
inline

Return the first/primary address this hostname resolves to.

Definition at line 62 of file InetHostname.h.

◆ addresses()

void utl::InetHostname::addresses ( Collection collection) const

Return all addresses this hostname resolves to.

Parameters
collectionstores result InetHostAddress objects

◆ getAddresses()

void utl::InetHostname::getAddresses ( Collection collection) const
inline

Get all addresses this hostname resolves to.

Parameters
collectionstores result InetHostAddress objects

Definition at line 78 of file InetHostname.h.

◆ aliases()

void utl::InetHostname::aliases ( Collection collection) const

Return all aliases for this hostname.

Parameters
collectionstores result InetHostname objects

◆ getAliases()

void utl::InetHostname::getAliases ( Collection collection) const
inline

Get all aliases for this hostname.

Parameters
collectionstores result InetHostname objects

Definition at line 94 of file InetHostname.h.

◆ localInetHostname()

static InetHostname utl::InetHostname::localInetHostname ( )
static

Return the name of the local host.

◆ localFQDN()

static InetHostname utl::InetHostname::localFQDN ( )
static

Return the FQDN of the local host.

◆ localDomainName()

static String utl::InetHostname::localDomainName ( )
static

Return the domain name of the local host.

◆ set()

void utl::InetHostname::set ( const InetHostAddress hostAddr)

Set = the name for the given host address.


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