本文整理汇总了C++中FileID::getSize方法的典型用法代码示例。如果您正苦于以下问题:C++ FileID::getSize方法的具体用法?C++ FileID::getSize怎么用?C++ FileID::getSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileID
的用法示例。
在下文中一共展示了FileID::getSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void D_bjmak::run(){
if (!verifyAccess())
return;
server->sendReplyCode(DTP_OK);
server->connectionPtr->recvMsg();
BackupJob job;
QString str = server->connectionPtr->dataToQString();
job.fromQString(str);
bsize_ = job.numberOfDailyBackups();
bool isFullBackup = (job.numberOfMonthlyBackups() == 0);
bool isCalculateHashes_ = (job.numberOfWeeklyBackups() == 1);
int fd = createFileList(job);
if (fd == -1)
return;
if (!isFullBackup){
sendFileList(fd);
}
lseek(fd, 0, SEEK_SET);
const int dataBufferCapacity = D_TRASFER_BUFFER_SIZE;
const int maxNumberFilesInBuffer = 2500;
QString line;
int idCount = 0;
qint64 sizeOfFilesInBuffer = 0;
qint64 totalFilesizeBackuped = 0;
qint64 totalFileCountBackuped = 0;
QVector<FileID> ids;
bool notEof = true;
while (notEof){
FileID id;
QString fileName;
if (!readLine(fd, fileName))
notEof = false;
if (!id.readID(fileName.toStdString().c_str())){
continue;
}
ids.push_back(id);
//cout << "added " << id.getFullPath().toStdString() << endl;
++idCount;
sizeOfFilesInBuffer += id.getSize();
if ( (sizeOfFilesInBuffer >= dataBufferCapacity) ||
( idCount >= maxNumberFilesInBuffer) ){
sendBuffer(ids, dataBufferCapacity);
ids.clear();
totalFilesizeBackuped += sizeOfFilesInBuffer;
totalFileCountBackuped += idCount;
idCount = 0;
sizeOfFilesInBuffer = 0;
}
}
if ( !ids.isEmpty()){
sendBuffer(ids, dataBufferCapacity);
ids.clear();
totalFilesizeBackuped += sizeOfFilesInBuffer;
totalFileCountBackuped += idCount;
idCount = 0;
sizeOfFilesInBuffer = 0;
}
server->connectionPtr->sendMsg("END");
QString shortSizeStr;
double shortSize;
if ( totalFilesizeBackuped > 1099511627776 ){
shortSize = totalFilesizeBackuped / 1099511627776.0;
shortSizeStr = QString::number(shortSize, 'f', 3);
shortSizeStr += " TB";
}else if ( totalFilesizeBackuped > 1073741824 ){
shortSize = totalFilesizeBackuped / 1073741824.0;
shortSizeStr = QString::number(shortSize, 'f', 3);
shortSizeStr += " GB";
}else if( totalFilesizeBackuped > 1048576 ){
shortSize = totalFilesizeBackuped / 1048576.0;
shortSizeStr = QString::number(shortSize, 'f', 3);
shortSizeStr += " MB";
}else if( totalFilesizeBackuped > 1024 ){
shortSize = totalFilesizeBackuped / 1024.0;
shortSizeStr = QString::number(shortSize, 'f', 3);
shortSizeStr += " KB";
}
writeLog.info() << "Backup have finished. Save " << shortSizeStr
<< " in " << totalFileCountBackuped << " files."
<< DebusLogger::endl;
//.........这里部分代码省略.........