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