本文整理汇总了C++中Address::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ Address::GetName方法的具体用法?C++ Address::GetName怎么用?C++ Address::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Address
的用法示例。
在下文中一共展示了Address::GetName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AutoCollectAddresses
void AutoCollectAddresses(const Message *message,
MAction autocollectFlag,
bool senderOnly,
bool collectNamed,
const String& bookName,
const String& groupName,
wxFrame *frame)
{
static const MessageAddressType addressTypesToCollect[] =
{
// In this array, the values corresponding to 'Sender' headers
// (e.g. From and ReplyTo) must appear before the others. And if
// some other 'sender' headers must be taken into account, the ending
// index in the for loop below (named stopAt) must be changed.
MAT_REPLYTO,
MAT_FROM,
MAT_TO,
MAT_CC,
};
// the email addresses we have already seen
wxArrayString addressesSeen;
const size_t stopAt = senderOnly ? 2 : WXSIZEOF(addressTypesToCollect);
for ( size_t n = 0; n < stopAt; n++ )
{
AddressList *addrList = message->GetAddressList(addressTypesToCollect[n]);
if ( !addrList )
continue;
for ( Address *addr = addrList->GetFirst();
addr;
addr = addrList->GetNext(addr) )
{
const String email = addr->GetEMail();
if ( addressesSeen.Index(email) == wxNOT_FOUND )
{
addressesSeen.Add(email);
AutoCollectAddress(email,
addr->GetName(),
autocollectFlag,
collectNamed,
bookName,
groupName,
frame);
}
}
addrList->DecRef();
}
}
示例2: InteractivelyCollectAddresses
int InteractivelyCollectAddresses(const wxArrayString& addresses,
const String& bookNameOrig,
const String& groupNameOrig,
wxFrame *parent)
{
// by default, select all addresses
wxArrayInt selections;
size_t count = addresses.GetCount();
for ( size_t n = 0; n < count; n++ )
{
selections.Add(n);
}
if ( count > 1 )
{
// now ask the user which ones does he really want
count = MDialog_GetSelections
(
_("Please select the addresses to save"),
_("Save addresses"),
addresses,
&selections,
parent,
_T("AddrExtract")
);
}
//else: don't ask the user to choose when there is one address only
if ( count > 0 )
{
// ask the user for the book and group names to use
//
// TODO propose something better - ADB tree dialog for example
wxString bookName(bookNameOrig),
groupName(groupNameOrig);
if ( MDialog_GetText2FromUser
(
_("Please select the location in the address\n"
"book to save the selected entries to:"),
_("Save addresses"),
_("Address book name:"), &bookName,
_("Group name:"), &groupName,
parent
) )
{
AdbManager_obj manager;
CHECK( manager, -1, _T("can't get AdbManager") );
AdbBook_obj autocollectbook(manager->CreateBook(bookName));
if ( !autocollectbook )
{
wxLogError(_("Failed to create the address book '%s' "
"for autocollected e-mail addresses."),
bookName.c_str());
// TODO ask the user for another book name
return -1;
}
AdbEntryGroup_obj group(autocollectbook->CreateGroup(groupName));
if ( !group )
{
wxLogError(_("Failed to create group '%s' in the address "
"book '%s'."),
groupName.c_str(), bookName.c_str());
return -1;
}
// create all entries in this group
size_t saved = 0;
for ( size_t n = 0; n < count; n++ )
{
AddressList_obj addrList(addresses[selections[n]]);
for ( Address *addr = addrList->GetFirst();
addr;
addr = addrList->GetNext(addr) )
{
String name = addr->GetName(),
email = addr->GetEMail();
if ( name.empty() || name == email )
{
name = addr->GetMailbox();
}
AdbEntry_obj entry(group->CreateEntry(name));
entry->SetField(AdbField_NickName, name);
entry->SetField(AdbField_FullName, name);
entry->SetField(AdbField_EMail, email);
saved++;
}
}
wxLogStatus(parent, _("Saved %u addresses."), saved);
}
//else: cancelled
//.........这里部分代码省略.........