Main Page Class Hierarchy Alphabetical List Compound List Examples |
00001 /*************************************************************************** 00002 copyright : (C) 2002-2005 by Stefano Barbato 00003 email : [email protected] 00004 00005 $Id: address_8h-source.html,v 1.4 2006-03-12 12:28:31 tat Exp $ 00006 ***************************************************************************/ 00007 00008 /*************************************************************************** 00009 * * 00010 * This program is free software; you can redistribute it and/or modify * 00011 * it under the terms of the GNU General Public License as published by * 00012 * the Free Software Foundation; either version 2 of the License, or * 00013 * (at your option) any later version. * 00014 * * 00015 ***************************************************************************/ 00016 #ifndef _MIMETIC_RFC822_ADDRESS_H_ 00017 #define _MIMETIC_RFC822_ADDRESS_H_ 00018 #include <string> 00019 #include <mimetic/rfc822/mailbox.h> 00020 #include <mimetic/rfc822/group.h> 00021 #include <mimetic/rfc822/fieldvalue.h> 00022 00023 namespace mimetic 00024 { 00025 /// Address class as defined by RFC822 00026 /*! 00027 00028 Address class is a C++ representation of RFC822 \e address structure. 00029 Use this class to parse fields that contains email addresses or email group. 00030 00031 \code 00032 Rfc822::Address adr(msg.from()); 00033 if(adr.isGroup()) 00034 cout << *adr.group(); 00035 else 00036 cout << *adr.mailbox(); 00037 \endcode 00038 00039 \sa <a href="../RFC/rfc822.txt">RFC822</a> 00040 */ 00041 struct Address: public FieldValue 00042 { 00043 Address(); 00044 Address(const char*); 00045 Address(const std::string&); 00046 bool isGroup() const; 00047 Mailbox& mailbox(); 00048 const Mailbox& mailbox() const; 00049 Group& group(); 00050 const Group& group() const; 00051 void set(const std::string&); 00052 std::string str() const; 00053 bool operator==(const Address&) const; 00054 bool operator!=(const Address&) const; 00055 private: 00056 FieldValue* clone() const; 00057 Mailbox m_mbx; 00058 Group m_group; 00059 bool m_isGroup; 00060 }; 00061 00062 00063 } 00064 00065 #endif 00066