Wtx ~ Wt Extension Library
WtxLib
Contact.h
1 // This may look like C code, but it's really -*- C++ -*-
2 /*
3  * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
4  *
5  * See the LICENSE file for terms of use.
6  */
7 #ifndef CONTACT_H_
8 #define CONTACT_H_
9 
10 #include <string>
11 
16 struct Contact
17 {
20  std::string name;
21 
24  std::string email;
25 
28  Contact( const std::string name_, const std::string email_ )
29  : name(name_),
30  email(email_)
31  { }
32 
33  Contact(const std::u32string email_);
34 
37  std::string formatted() const
38  {
39  if( name != "" )
40  {
41  return "\"" + name + "\" <" + email + ">";
42  }
43  else
44  {
45  return email;
46  }
47 
48  }
49 };
50 
51 #endif // CONTACT_H_
52 
std::string name
The contact name.
Definition: Contact.h:20
std::string formatted() const
Get the typical single string form: "name" <email>
Definition: Contact.h:37
Contact(const std::string name_, const std::string email_)
Create a new contact.
Definition: Contact.h:28
An email contact.
Definition: Contact.h:16
std::string email
The contact email address.
Definition: Contact.h:24