Main Page   Class Hierarchy   Alphabetical List   Compound List   Examples  
group.h
1 /***************************************************************************
2  copyright : (C) 2002-2008 by Stefano Barbato
3  email : stefano@codesink.org
4 
5  $Id: group.h,v 1.12 2008-10-07 11:06:27 tat Exp $
6  ***************************************************************************/
7 #ifndef _MIMETIC_RFC822_GROUP_H_
8 #define _MIMETIC_RFC822_GROUP_H_
9 #include <string>
10 #include <vector>
11 #include <mimetic/rfc822/mailbox.h>
12 
13 namespace mimetic
14 {
15 
16 
17 /// Represent the \e group type in the RFC822
18 /**
19  Groups class is a container class that stores Rfc822::Mailbox objects.
20  Use this class when you need to create or parse rfc822 \e email \e groups
21 
22  Parsing:
23  \code
24  Rfc822::Group grp("drivers: first@do.com, second@dom.com, last@dom.com;");
25  Rfc822::Group::const_iterator bit(grp.begin()), eit(grp.end());
26  cout << "Group " << grp.name() << endl;
27  for(; bit != eit; ++bit)
28  cout << " " << *bit << endl;
29  \endcode
30 
31  Building:
32  \code
33  Rfc822::Group grp;
34  grp.push_back("first@dom.com");
35  grp.push_back(Rfc822::Mailbox("second@dom.com"));
36  grp.push_back(string("last@dom.com"));
37  \endcode
38 
39  \sa <a href="../RFC/rfc822.txt">RFC822</a>
40  */
41 struct Group: public FieldValue, public std::vector<Mailbox>
42 {
43  Group();
44  Group(const char*);
45  Group(const std::string&);
46  void name(const std::string&);
47  std::string name(int bCanonical = 0) const;
48  void set(const std::string&);
49  std::string str() const;
50 protected:
51  FieldValue* clone() const;
52 private:
53  std::string m_text, m_name;
54 };
55 
56 
57 }
58 #endif
Represent the group type in the RFC822.
Definition: group.h:41
Value of an header field (base class)
Definition: fieldvalue.h:17