Logo
~Sockets~
~Examples~
~Contact~


SmtpdSocket::EmailAddress Class Reference

#include <SmtpdSocket.h>

List of all members.


Public Member Functions

 EmailAddress (const std::string &str_in)
const std::string & GetName () const
const std::string & GetDomain () const
const std::string & GetTopDomain () const
const std::string & GetSubDomain () const
std::string ToString () const

Private Attributes

std::string m_name
std::string m_domain
std::string m_top
std::string m_sub

Detailed Description

Definition at line 55 of file SmtpdSocket.h.


Constructor & Destructor Documentation

SmtpdSocket::EmailAddress::EmailAddress ( const std::string &  str_in  )  [inline]

Definition at line 57 of file SmtpdSocket.h.

00058                 {
00059                         std::string str = str_in;
00060                         size_t i = str.find("<");
00061                         if (i != std::string::npos)
00062                                 str = str.substr(i + 1);
00063                         i = str.find("@");
00064                         if (i != std::string::npos)
00065                         {
00066                                 m_name = str.substr(0, i);
00067                                 str = str.substr(i + 1);
00068                                 i = str.find(">");
00069                                 if (i != std::string::npos)
00070                                         str = str.substr(0, i);
00071                                 m_domain = str;
00072                         }
00073                         while (m_name.size() && m_name[m_name.size() - 1] == ' ')
00074                                 m_name.resize(m_name.size() - 1);
00075                         while (m_domain.size() && m_domain[m_domain.size() - 1] == ' ')
00076                                 m_domain.resize(m_domain.size() - 1);
00077                         while (m_name.size() && m_name[0] == ' ')
00078                                 m_name = m_name.substr(1);
00079                         while (m_domain.size() && m_domain[0] == ' ')
00080                                 m_domain = m_domain.substr(1);
00081                         m_top = m_domain;
00082                         {
00083                                 for (size_t i = 0; i < m_domain.size(); i++)
00084                                 {
00085                                         if (m_domain[i] == '.')
00086                                         {
00087                                                 m_sub = m_top;
00088                                                 m_top = m_domain.substr(i + 1);
00089                                         }
00090                                 }
00091                         }
00092                 }


Member Function Documentation

const std::string& SmtpdSocket::EmailAddress::GetName (  )  const [inline]

Definition at line 94 of file SmtpdSocket.h.

00094 { return m_name; }

const std::string& SmtpdSocket::EmailAddress::GetDomain (  )  const [inline]

Definition at line 95 of file SmtpdSocket.h.

00095 { return m_domain; }

const std::string& SmtpdSocket::EmailAddress::GetTopDomain (  )  const [inline]

Definition at line 96 of file SmtpdSocket.h.

00096 { return m_top; }

const std::string& SmtpdSocket::EmailAddress::GetSubDomain (  )  const [inline]

Definition at line 97 of file SmtpdSocket.h.

00097 { return m_sub; }

std::string SmtpdSocket::EmailAddress::ToString (  )  const [inline]

Definition at line 99 of file SmtpdSocket.h.

00099 { return m_name + "@" + m_domain; }


Member Data Documentation

std::string SmtpdSocket::EmailAddress::m_name [private]

Definition at line 102 of file SmtpdSocket.h.

std::string SmtpdSocket::EmailAddress::m_domain [private]

Definition at line 103 of file SmtpdSocket.h.

std::string SmtpdSocket::EmailAddress::m_top [private]

Definition at line 104 of file SmtpdSocket.h.

std::string SmtpdSocket::EmailAddress::m_sub [private]

Definition at line 105 of file SmtpdSocket.h.


The documentation for this class was generated from the following file:
Page, code, and content Copyright (C) 2007 by Anders Hedström
Generated for C++ Sockets by  doxygen 1.4.4