~ubuntu-branches/ubuntu/natty/mimetic/natty

« back to all changes in this revision

Viewing changes to mimetic/rfc822/group.h

  • Committer: Bazaar Package Importer
  • Author(s): gregor herrmann
  • Date: 2006-06-16 13:16:07 UTC
  • Revision ID: james.westby@ubuntu.com-20060616131607-245mqjypkjuahq6b
Tags: upstream-0.9.1
ImportĀ upstreamĀ versionĀ 0.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
    copyright            : (C) 2002-2005 by Stefano Barbato
 
3
    email                : stefano@codesink.org
 
4
 
 
5
    $Id: group.h,v 1.11 2005/02/23 10:26:15 tat Exp $
 
6
 ***************************************************************************/
 
7
 
 
8
/***************************************************************************
 
9
 *                                                                         *
 
10
 *   This program is free software; you can redistribute it and/or modify  *
 
11
 *   it under the terms of the GNU General Public License as published by  *
 
12
 *   the Free Software Foundation; either version 2 of the License, or     *
 
13
 *   (at your option) any later version.                                   *
 
14
 *                                                                         *
 
15
 ***************************************************************************/
 
16
#ifndef _MIMETIC_RFC822_GROUP_H_
 
17
#define _MIMETIC_RFC822_GROUP_H_
 
18
#include <string>
 
19
#include <vector>
 
20
#include <mimetic/rfc822/mailbox.h>
 
21
 
 
22
namespace mimetic
 
23
{
 
24
 
 
25
 
 
26
/// Represent the \e group type in the RFC822
 
27
/**
 
28
    Groups class is a container class that stores Rfc822::Mailbox objects.
 
29
    Use this class when you need to create or parse rfc822 \e email \e groups
 
30
 
 
31
    Parsing:
 
32
    \code
 
33
    Rfc822::Group grp("drivers: first@do.com, second@dom.com, last@dom.com;");
 
34
    Rfc822::Group::const_iterator bit(grp.begin()), eit(grp.end());
 
35
    cout << "Group " << grp.name() << endl;
 
36
    for(; bit != eit; ++bit)
 
37
        cout << "    " << *bit << endl;
 
38
    \endcode
 
39
 
 
40
    Building:
 
41
    \code
 
42
    Rfc822::Group grp;
 
43
    grp.push_back("first@dom.com");
 
44
    grp.push_back(Rfc822::Mailbox("second@dom.com"));
 
45
    grp.push_back(string("last@dom.com"));
 
46
    \endcode
 
47
 
 
48
    \sa <a href="../RFC/rfc822.txt">RFC822</a>
 
49
 */
 
50
struct Group: public FieldValue, public std::vector<Mailbox>
 
51
{
 
52
    Group();
 
53
    Group(const char*);
 
54
    Group(const std::string&);
 
55
    void name(const std::string&);
 
56
    std::string name(int bCanonical = 0) const;
 
57
    void set(const std::string&);
 
58
    std::string str() const;
 
59
protected:
 
60
    FieldValue* clone() const;
 
61
private:
 
62
    std::string m_text, m_name;
 
63
};
 
64
 
 
65
 
 
66
}
 
67
#endif