Main Page   Class Hierarchy   Alphabetical List   Compound List   Examples  
address.h
1/***************************************************************************
2 copyright : (C) 2002-2008 by Stefano Barbato
3 email : stefano@codesink.org
4
5 $Id: address.h,v 1.14 2008-10-07 11:06:26 tat Exp $
6 ***************************************************************************/
7#ifndef _MIMETIC_RFC822_ADDRESS_H_
8#define _MIMETIC_RFC822_ADDRESS_H_
9#include <string>
10#include <mimetic/rfc822/mailbox.h>
11#include <mimetic/rfc822/group.h>
12#include <mimetic/rfc822/fieldvalue.h>
13
14namespace mimetic
15{
16/// Address class as defined by RFC822
17/*!
18
19 Address class is a C++ representation of RFC822 \e address structure.
20 Use this class to parse fields that contains email addresses or email group.
21
22 \code
23 Rfc822::Address adr(msg.from());
24 if(adr.isGroup())
25 cout << *adr.group();
26 else
27 cout << *adr.mailbox();
28 \endcode
29
30 \sa <a href="../RFC/rfc822.txt">RFC822</a>
31 */
32struct Address: public FieldValue
33{
34 Address();
35 Address(const char*);
36 Address(const std::string&);
37 bool isGroup() const;
38 Mailbox& mailbox();
39 const Mailbox& mailbox() const;
40 Group& group();
41 const Group& group() const;
42 void set(const std::string&);
43 std::string str() const;
44 bool operator==(const Address&) const;
45 bool operator!=(const Address&) const;
46private:
47 FieldValue* clone() const;
48 Mailbox m_mbx;
49 Group m_group;
50 bool m_isGroup;
51};
52
53
54}
55
56#endif
57
Definition body.h:18
Represent the group type in the RFC822.
Definition group.h:42
Represents a mailbox email address as defined in the RFC822.
Definition mailbox.h:47