本文整理汇总了C++中BStringList::CountItems方法的典型用法代码示例。如果您正苦于以下问题:C++ BStringList::CountItems方法的具体用法?C++ BStringList::CountItems怎么用?C++ BStringList::CountItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BStringList
的用法示例。
在下文中一共展示了BStringList::CountItems方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: path
status_t
POP3Protocol::SyncMessages()
{
bool leaveOnServer;
if (fSettings.FindBool("leave_mail_on_server", &leaveOnServer) != B_OK)
leaveOnServer = true;
// create directory if not exist
create_directory(fDestinationDir, 0777);
printf("POP3Protocol::SyncMessages()\n");
_ReadManifest();
SetTotalItems(2);
ReportProgress(0, 1, "Connect to server...");
status_t error = Connect();
if (error < B_OK) {
ResetProgress();
return error;
}
ReportProgress(0, 1, MDR_DIALECT_CHOICE("Getting UniqueIDs...",
"固有のIDを取得中..."));
error = _UniqueIDs();
if (error < B_OK) {
ResetProgress();
return error;
}
BStringList toDownload;
fManifest.NotHere(fUniqueIDs, &toDownload);
int32 numMessages = toDownload.CountItems();
if (numMessages == 0) {
CheckForDeletedMessages();
ResetProgress();
return B_OK;
}
ResetProgress();
SetTotalItems(toDownload.CountItems());
printf("POP3: Messages to download: %i\n", (int)toDownload.CountItems());
for (int32 i = 0; i < toDownload.CountItems(); i++) {
const char* uid = toDownload.ItemAt(i);
int32 toRetrieve = fUniqueIDs.IndexOf(uid);
if (toRetrieve < 0) {
// should not happen!
error = B_NAME_NOT_FOUND;
printf("POP3: uid %s index %i not found in fUniqueIDs!\n", uid,
(int)toRetrieve);
continue;
}
BPath path(fDestinationDir);
BString fileName = "Downloading file... uid: ";
fileName += uid;
fileName.ReplaceAll("/", "_SLASH_");
path.Append(fileName);
BEntry entry(path.Path());
BFile file(&entry, B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
error = file.InitCheck();
if (error != B_OK) {
printf("POP3: Can't create file %s\n ", path.Path());
break;
}
BMailMessageIO mailIO(this, &file, toRetrieve);
entry_ref ref;
entry.GetRef(&ref);
// the ref becomes invalid after renaming the file thus we already
// write the status here
MarkMessageAsRead(ref, B_UNREAD);
int32 size = MessageSize(toRetrieve);
if (fFetchBodyLimit < 0 || size <= fFetchBodyLimit) {
error = mailIO.Seek(0, SEEK_END);
if (error < 0) {
printf("POP3: Failed to download body %s\n ", uid);
break;
}
NotifyHeaderFetched(ref, &file);
NotifyBodyFetched(ref, &file);
if (!leaveOnServer)
Delete(toRetrieve);
} else {
int32 dummy;
error = mailIO.ReadAt(0, &dummy, 1);
if (error < 0) {
printf("POP3: Failed to download header %s\n ", uid);
break;
}
NotifyHeaderFetched(ref, &file);
}
ReportProgress(0, 1);
if (file.WriteAttr("MAIL:unique_id", B_STRING_TYPE, 0, uid,
//.........这里部分代码省略.........