Main Page   Class Hierarchy   Alphabetical List   Compound List   Examples  
addresslist.h
1 /***************************************************************************
2  copyright : (C) 2002-2008 by Stefano Barbato
3  email : stefano@codesink.org
4 
5  $Id: addresslist.h,v 1.12 2008-10-07 11:06:26 tat Exp $
6  ***************************************************************************/
7 #ifndef _MIMETIC_RFC822_ADDRESSLIST_H_
8 #define _MIMETIC_RFC822_ADDRESSLIST_H_
9 #include <string>
10 #include <vector>
11 #include <mimetic/rfc822/address.h>
12 #include <mimetic/rfc822/fieldvalue.h>
13 namespace mimetic
14 {
15 
16 /// List of Address
17 /**
18  AddressList class is a container class that holds Address objects which,
19  in turn can be a Group or a Mailbox.
20 
21  \code
22  const char* str = "dest@domain.com, friends: one@friends.net, "
23  "two@friends.net;, last@users.com";
24  AddressList aList(str);
25  AddressList::const_iterator bit(aList.begin()), eit(aList.end());
26  for(; bit != eit; ++bit)
27  {
28  Address& adr = *bit;
29  if(adr.isGroup())
30  cout << *adr.group();
31  else
32  cout << *adr.mailbox();
33  }
34  \endcode
35 
36  \sa <a href="../RFC/rfc822.txt">RFC822</a>
37  */
38 struct AddressList: public FieldValue, public std::vector<Address>
39 {
40  AddressList();
41  AddressList(const char*);
42  AddressList(const std::string&);
43 
44  std::string str() const;
45  void set(const std::string&);
46 protected:
47  FieldValue* clone() const;
48 private:
49 };
50 
51 
52 }
53 
54 #endif
Value of an header field (base class)
Definition: fieldvalue.h:17
List of Address.
Definition: addresslist.h:38