Main Page   Class Hierarchy   Alphabetical List   Compound List   Examples  

addresslist.h

00001 /***************************************************************************
00002     copyright            : (C) 2002-2008 by Stefano Barbato
00003     email                : stefano@codesink.org
00004 
00005     $Id: addresslist.h,v 1.12 2008-10-07 11:06:26 tat Exp $
00006  ***************************************************************************/
00007 #ifndef _MIMETIC_RFC822_ADDRESSLIST_H_
00008 #define _MIMETIC_RFC822_ADDRESSLIST_H_
00009 #include <string>
00010 #include <vector>
00011 #include <mimetic/rfc822/address.h>
00012 #include <mimetic/rfc822/fieldvalue.h>
00013 namespace mimetic 
00014 {
00015 
00016 /// List of Address
00017 /**
00018     AddressList class is a container class that holds Address objects which,
00019       in turn can be a Group or a Mailbox.
00020 
00021     \code
00022     const char* str = "dest@domain.com, friends: one@friends.net, "
00023                 "two@friends.net;, last@users.com";
00024     AddressList aList(str);
00025     AddressList::const_iterator bit(aList.begin()), eit(aList.end());
00026     for(; bit != eit; ++bit)
00027     {
00028         Address& adr = *bit;
00029         if(adr.isGroup())
00030             cout << *adr.group();
00031         else
00032             cout << *adr.mailbox();
00033     }
00034     \endcode
00035 
00036     \sa <a href="../RFC/rfc822.txt">RFC822</a>
00037  */
00038 struct AddressList: public FieldValue, public std::vector<Address>
00039 {
00040     AddressList();
00041     AddressList(const char*);
00042     AddressList(const std::string&);
00043 
00044     std::string str() const;
00045     void set(const std::string&);
00046 protected:
00047     FieldValue* clone() const;
00048 private:
00049 };
00050 
00051 
00052 }
00053 
00054 #endif