Main Page Class Hierarchy Alphabetical List Compound List Examples |
00001 /*************************************************************************** 00002 copyright : (C) 2002-2008 by Stefano Barbato 00003 email : stefano@codesink.org 00004 00005 $Id: group.h,v 1.12 2008-10-07 11:06:27 tat Exp $ 00006 ***************************************************************************/ 00007 #ifndef _MIMETIC_RFC822_GROUP_H_ 00008 #define _MIMETIC_RFC822_GROUP_H_ 00009 #include <string> 00010 #include <vector> 00011 #include <mimetic/rfc822/mailbox.h> 00012 00013 namespace mimetic 00014 { 00015 00016 00017 /// Represent the \e group type in the RFC822 00018 /** 00019 Groups class is a container class that stores Rfc822::Mailbox objects. 00020 Use this class when you need to create or parse rfc822 \e email \e groups 00021 00022 Parsing: 00023 \code 00024 Rfc822::Group grp("drivers: first@do.com, second@dom.com, last@dom.com;"); 00025 Rfc822::Group::const_iterator bit(grp.begin()), eit(grp.end()); 00026 cout << "Group " << grp.name() << endl; 00027 for(; bit != eit; ++bit) 00028 cout << " " << *bit << endl; 00029 \endcode 00030 00031 Building: 00032 \code 00033 Rfc822::Group grp; 00034 grp.push_back("first@dom.com"); 00035 grp.push_back(Rfc822::Mailbox("second@dom.com")); 00036 grp.push_back(string("last@dom.com")); 00037 \endcode 00038 00039 \sa <a href="../RFC/rfc822.txt">RFC822</a> 00040 */ 00041 struct Group: public FieldValue, public std::vector<Mailbox> 00042 { 00043 Group(); 00044 Group(const char*); 00045 Group(const std::string&); 00046 void name(const std::string&); 00047 std::string name(int bCanonical = 0) const; 00048 void set(const std::string&); 00049 std::string str() const; 00050 protected: 00051 FieldValue* clone() const; 00052 private: 00053 std::string m_text, m_name; 00054 }; 00055 00056 00057 } 00058 #endif