|
Wt examples
3.3.0
|
An edit field for an email addressee. More...
#include <AddresseeEdit.h>

Public Member Functions | |
| AddresseeEdit (const WString &label, WContainerWidget *parent, WContainerWidget *labelParent) | |
| Create a new addressee edit with the given label. | |
| void | setAddressees (const std::vector< Contact > &contacts) |
| Set a list of addressees. | |
| std::vector< Contact > | addressees () const |
| Get a list of addressees. | |
| virtual void | setHidden (bool hidden, const WAnimation &animation) |
| Reimplement hide() and show() to also hide() and show() the label. | |
Private Member Functions | |
| bool | parse (std::vector< Contact > &contacts) const |
| Parse the addressees into a list of contacts. | |
Private Attributes | |
| Label * | label_ |
| The label associated with this edit. | |
An edit field for an email addressee.
This widget is part of the Wt composer example.
Definition at line 31 of file AddresseeEdit.h.
| AddresseeEdit::AddresseeEdit | ( | const WString & | label, |
| WContainerWidget * | parent, | ||
| WContainerWidget * | labelParent | ||
| ) |
Create a new addressee edit with the given label.
Constructs also a widget to hold the label in the labelParent. The label will be hidden and shown together with this field.
Definition at line 15 of file AddresseeEdit.C.
| std::vector< Contact > AddresseeEdit::addressees | ( | ) | const |
Get a list of addressees.
Definition at line 74 of file AddresseeEdit.C.
{
std::vector<Contact> result;
parse(result);
return result;
}
| bool AddresseeEdit::parse | ( | std::vector< Contact > & | contacts | ) | const [private] |
Parse the addressees into a list of contacts.
Definition at line 40 of file AddresseeEdit.C.
{
typedef boost::tokenizer<boost::escaped_list_separator<wchar_t>,
std::wstring::const_iterator, std::wstring>
CsvTokenizer;
std::wstring t = text();
CsvTokenizer tok(t);
for (CsvTokenizer::iterator i = tok.begin(); i != tok.end(); ++i) {
std::wstring addressee = *i;
boost::trim(addressee);
std::wstring::size_type pos = addressee.find_last_of(' ');
if (pos != std::string::npos) {
std::wstring email = addressee.substr(pos + 1);
std::wstring name = addressee.substr(0, pos);
boost::trim(email);
boost::trim(name);
if (email[0] == '<')
email = email.substr(1);
if (email[email.length() - 1] == '>')
email = email.substr(0, email.length() - 1);
if (!email.empty())
contacts.push_back(Contact(name, email));
} else
if (!addressee.empty())
contacts.push_back(Contact(L"", addressee));
}
return true;
}
| void AddresseeEdit::setAddressees | ( | const std::vector< Contact > & | contacts | ) |
Set a list of addressees.
Definition at line 27 of file AddresseeEdit.C.
| void AddresseeEdit::setHidden | ( | bool | hidden, |
| const WAnimation & | animation | ||
| ) | [virtual] |
Reimplement hide() and show() to also hide() and show() the label.
Reimplemented from Wt::WFormWidget.
Definition at line 82 of file AddresseeEdit.C.
{
WTextArea::setHidden(hidden, animation);
label_->setHidden(hidden, animation);
}
Label* AddresseeEdit::label_ [private] |
The label associated with this edit.
Definition at line 55 of file AddresseeEdit.h.
1.7.5.1