7 #include <boost/tokenizer.hpp> 8 #include <boost/algorithm/string.hpp> 10 #include <Wt/WContainerWidget.h> 11 #include <Wt/WStringUtil.h> 19 label_ = labelParent->
addWidget(cpp14::make_unique<Label>(label, labelParent));
31 for (
unsigned i = 0; i < contacts.size(); ++i) {
34 text += contacts[i].formatted();
42 typedef boost::tokenizer<boost::escaped_list_separator<char32_t>,
43 std::wstring::const_iterator, std::wstring>
46 std::wstring t =
text();
49 for (CsvTokenizer::iterator i = tok.begin(); i != tok.end(); ++i) {
50 std::wstring addressee = *i;
52 boost::trim(addressee);
53 std::wstring::size_type pos = addressee.find_last_of(
' ');
54 if (pos != std::string::npos) {
55 std::wstring email = addressee.substr(pos + 1);
56 std::wstring name = addressee.substr(0, pos);
61 email = email.substr(1);
62 if (email[email.length() - 1] ==
'>')
63 email = email.substr(0, email.length() - 1);
68 if (!addressee.empty())
76 std::vector<Contact> result;
84 WTextArea::setHidden(hidden, animation);
Label * label_
The label associated with this edit.
bool parse(std::vector< Contact > &contacts) const
Parse the addressees into a list of contacts.
virtual void setHidden(bool hidden, const WAnimation &animation)
Reimplement hide() and show() to also hide() and show() the label.
void setAddressees(const std::vector< Contact > &contacts)
Set a list of addressees.
void setColumns(int cols)
virtual void setText(const WString &text)
const WString & text() const
AddresseeEdit(const WString &label, WContainerWidget *labelParent)
Create a new addressee edit with the given label.
std::u32string toUTF32(const std::u16string &s)
std::vector< Contact > addressees() const
Get a list of addressees.