-
Notifications
You must be signed in to change notification settings - Fork 0
/
wxMsExtendedAddressh.h
86 lines (78 loc) · 2.38 KB
/
wxMsExtendedAddressh.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*-----------------------------------------------------------------
* Name: wxMsExtendedAddressh.h
* Purpose:
* Author: A. Wiegert
*
* Copyright:
* Licence: wxWidgets licence
*-------------------------------------------------------------- */
#ifndef _WX_MS_EXTENDED_ADDRESS_H
#define _WX_MS_EXTENDED_ADDRESS_H
#include <wx/wx.h>
#include <wx/filename.h>
#include <wx/wfstream.h>
// ------------------------------------------------------------------
/**
* Borrowed from Andre Brice, borrowd from Frank Buß
*/
// ------------------------------------------------------------------
/*!
* This class represents an e-mail address.
*
* It contains two fields :
* \li \c address The mail address (ex. [email protected]). This field is mandatory.
* \li \c name The name of the address proprietary (ex. John Doe). This field is optional
*/
class ExtendedAddress
{
public:
/*!
* Default constructor
*
* \param address The mail address
* \param name The name of the owner of the address
* \todo it should be nice to check address format...
*/
ExtendedAddress(const wxString& address = _T(""), const wxString& name = _T("")) : address(address), name(name) {}
/*!
* Retrieves the mail address
*
* \return The mail address
*/
const wxString& GetExtendedAddress() const {return address;}
/*!
* Retrieves the name of the owner of the address the address
*
* \return The name of the owner of the address, empty if not set
*/
const wxString& GetName() const {return name;}
/*!
* Allows determining if a name exists
*
* \return true if a name exists, false otherwise
*/
bool HasName() const {return !name.IsEmpty();}
/*!
* \internal
*
* Returns an encoded MIME mail address
* \return the MIME encoded mail address
* \todo We should add coding
*/
wxString GetMimeStr() const
{
if (HasName())
{
return name + _T(" <") + address + _T(">");
}
else
{
return _T("<") + address + _T(">");
}
}
private:
wxString address;
wxString name;
};
#endif // _WX_MS_EXTENDED_ADDRESS_H
// ------------------------------- eof ---------------------------