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 57 of file SmtpdSocket.h.


Constructor & Destructor Documentation

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

Definition at line 59 of file SmtpdSocket.h.

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


Member Function Documentation

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

Definition at line 96 of file SmtpdSocket.h.

00096 { return m_name; }

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

Definition at line 97 of file SmtpdSocket.h.

00097 { return m_domain; }

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

Definition at line 98 of file SmtpdSocket.h.

00098 { return m_top; }

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

Definition at line 99 of file SmtpdSocket.h.

00099 { return m_sub; }

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

Definition at line 101 of file SmtpdSocket.h.

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


Member Data Documentation

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

Definition at line 104 of file SmtpdSocket.h.

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

Definition at line 105 of file SmtpdSocket.h.

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

Definition at line 106 of file SmtpdSocket.h.

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

Definition at line 107 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