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


Constructor & Destructor Documentation

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

Definition at line 49 of file SmtpdSocket.h.

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


Member Function Documentation

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

Definition at line 86 of file SmtpdSocket.h.

00086 { return m_name; }

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

Definition at line 87 of file SmtpdSocket.h.

00087 { return m_domain; }

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

Definition at line 88 of file SmtpdSocket.h.

00088 { return m_top; }

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

Definition at line 89 of file SmtpdSocket.h.

00089 { return m_sub; }

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

Definition at line 91 of file SmtpdSocket.h.

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


Member Data Documentation

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

Definition at line 94 of file SmtpdSocket.h.

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

Definition at line 95 of file SmtpdSocket.h.

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

Definition at line 96 of file SmtpdSocket.h.

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

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