本文整理汇总了C++中CFileItem::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItem::GetSize方法的具体用法?C++ CFileItem::GetSize怎么用?C++ CFileItem::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItem
的用法示例。
在下文中一共展示了CFileItem::GetSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveLocalPath
bool CQueueStorage::Impl::SaveFile(wxLongLong server, const CFileItem& file)
{
if (file.m_edit != CEditHandler::none)
return true;
Bind(insertFileQuery_, file_table_column_names::source_file, file.GetSourceFile());
auto const& targetFile = file.GetTargetFile();
if (targetFile)
Bind(insertFileQuery_, file_table_column_names::target_file, *targetFile);
else
BindNull(insertFileQuery_, file_table_column_names::target_file);
int64_t localPathId = SaveLocalPath(file.GetLocalPath());
int64_t remotePathId = SaveRemotePath(file.GetRemotePath());
if (localPathId == -1 || remotePathId == -1)
return false;
Bind(insertFileQuery_, file_table_column_names::local_path, localPathId);
Bind(insertFileQuery_, file_table_column_names::remote_path, remotePathId);
Bind(insertFileQuery_, file_table_column_names::download, file.Download() ? 1 : 0);
if (file.GetSize() != -1)
Bind(insertFileQuery_, file_table_column_names::size, file.GetSize());
else
BindNull(insertFileQuery_, file_table_column_names::size);
if (file.m_errorCount)
Bind(insertFileQuery_, file_table_column_names::error_count, file.m_errorCount);
else
BindNull(insertFileQuery_, file_table_column_names::error_count);
Bind(insertFileQuery_, file_table_column_names::priority, static_cast<int>(file.GetPriority()));
Bind(insertFileQuery_, file_table_column_names::ascii_file, file.Ascii() ? 1 : 0);
if (file.m_defaultFileExistsAction != CFileExistsNotification::unknown)
Bind(insertFileQuery_, file_table_column_names::default_exists_action, file.m_defaultFileExistsAction);
else
BindNull(insertFileQuery_, file_table_column_names::default_exists_action);
int res;
do {
res = sqlite3_step(insertFileQuery_);
} while (res == SQLITE_BUSY);
sqlite3_reset(insertFileQuery_);
return res == SQLITE_DONE;
}
示例2: OnGetItemText
wxString CQueueViewBase::OnGetItemText(long item, long column) const
{
CQueueViewBase* pThis = const_cast<CQueueViewBase*>(this);
CQueueItem* pItem = pThis->GetQueueItem(item);
if (!pItem)
return _T("");
switch (pItem->GetType())
{
case QueueItemType_Server:
{
CServerItem* pServerItem = reinterpret_cast<CServerItem*>(pItem);
if (!column)
return pServerItem->GetName();
}
break;
case QueueItemType_File:
{
CFileItem* pFileItem = reinterpret_cast<CFileItem*>(pItem);
switch (column)
{
case 0:
return pFileItem->GetIndent() + pFileItem->GetLocalFile();
case 1:
if (pFileItem->Download())
if (pFileItem->Queued())
return _T("<--");
else
return _T("<<--");
else
if (pFileItem->Queued())
return _T("-->");
else
return _T("-->>");
break;
case 2:
return pFileItem->GetRemotePath().FormatFilename(pFileItem->GetRemoteFile());
case 3:
{
const wxLongLong& size = pFileItem->GetSize();
if (size >= 0)
return FormatSize(size);
else
return _T("?");
}
case 4:
switch (pFileItem->GetPriority())
{
case 0:
return _("Lowest");
case 1:
return _("Low");
default:
case 2:
return _("Normal");
case 3:
return _("High");
case 4:
return _("Highest");
}
break;
case 5:
return pFileItem->m_statusMessage;
default:
break;
}
}
break;
case QueueItemType_FolderScan:
{
CFolderScanItem* pFolderItem = reinterpret_cast<CFolderScanItem*>(pItem);
switch (column)
{
case 0:
return _T(" ") + pFolderItem->GetLocalPath();
case 1:
if (pFolderItem->Download())
if (pFolderItem->Queued())
return _T("<--");
else
return _T("<<--");
else
if (pFolderItem->Queued())
return _T("-->");
else
return _T("-->>");
break;
case 2:
return pFolderItem->GetRemotePath().GetPath();
case 5:
return pFolderItem->m_statusMessage;
default:
break;
}
}
break;
case QueueItemType_Folder:
{
CFileItem* pFolderItem = reinterpret_cast<CFolderItem*>(pItem);
//.........这里部分代码省略.........
示例3: OnGetItemText
wxString CQueueViewBase::OnGetItemText(CQueueItem* pItem, ColumnId column) const
{
switch (pItem->GetType())
{
case QueueItemType::Server:
{
CServerItem* pServerItem = reinterpret_cast<CServerItem*>(pItem);
if (!column)
return pServerItem->GetName();
}
break;
case QueueItemType::File:
{
CFileItem* pFileItem = reinterpret_cast<CFileItem*>(pItem);
switch (column)
{
case colLocalName:
return pFileItem->GetIndent() + pFileItem->GetLocalPath().GetPath() + pFileItem->GetLocalFile();
case colDirection:
if (pFileItem->Download())
if (pFileItem->queued())
return _T("<--");
else
return _T("<<--");
else
if (pFileItem->queued())
return _T("-->");
else
return _T("-->>");
break;
case colRemoteName:
return pFileItem->GetRemotePath().FormatFilename(pFileItem->GetRemoteFile());
case colSize:
{
const wxLongLong& size = pFileItem->GetSize();
if (size >= 0)
return CSizeFormat::Format(size);
else
return _T("?");
}
case colPriority:
switch (pFileItem->GetPriority())
{
case QueuePriority::lowest:
return _("Lowest");
case QueuePriority::low:
return _("Low");
default:
case QueuePriority::normal:
return _("Normal");
case QueuePriority::high:
return _("High");
case QueuePriority::highest:
return _("Highest");
}
break;
case colTransferStatus:
case colErrorReason:
return pFileItem->m_statusMessage;
case colTime:
return CTimeFormat::FormatDateTime(pItem->GetTime());
default:
break;
}
}
break;
case QueueItemType::FolderScan:
{
CFolderScanItem* pFolderItem = reinterpret_cast<CFolderScanItem*>(pItem);
switch (column)
{
case colLocalName:
return _T(" ") + pFolderItem->GetLocalPath().GetPath();
case colDirection:
if (pFolderItem->Download())
if (pFolderItem->queued())
return _T("<--");
else
return _T("<<--");
else
if (pFolderItem->queued())
return _T("-->");
else
return _T("-->>");
break;
case colRemoteName:
return pFolderItem->GetRemotePath().GetPath();
case colTransferStatus:
case colErrorReason:
return pFolderItem->m_statusMessage;
case colTime:
return CTimeFormat::FormatDateTime(pItem->GetTime());
default:
break;
}
}
break;
case QueueItemType::Folder:
{
CFileItem* pFolderItem = reinterpret_cast<CFolderItem*>(pItem);
//.........这里部分代码省略.........