本文整理汇总了C++中Selection::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ Selection::GetSize方法的具体用法?C++ Selection::GetSize怎么用?C++ Selection::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Selection
的用法示例。
在下文中一共展示了Selection::GetSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Copy
bool SFtpReader::Copy( Selection& tSelection, // remote
const string& sTargetPath, // local
Selection* pSelection )
{
string sCurName, sTargetPathTmp, sTargetPathTmp2;
string sSourceName, sTargetName;
vector<File*> vFiles;
ullong uFileSize = tSelection.CalcSize();
uint uSize = tSelection.GetSize();
string sSize = toregular(uSize), sRestSize;
bool bSkipAll = false, bOverwriteAll = false;
ullong uLastSize = 0, uViewCount=1, uPsize=0, uCsize = 0;
struct stat src_stat, tar_stat;
int nBufSize = g_tCfg.GetValueNum("SSH", "DefBufSize", 8196);
char buf[nBufSize]; // reading byte
vFiles = tSelection.GetData();
if (sTargetPath.size() == 0)
sTargetPathTmp2 = _sCurPath;
else
sTargetPathTmp2 = sTargetPath;
CommonProgress tProgress( _("Copy"), (_("To ") + sTargetPathTmp2).c_str(), true);
if (pSelection != NULL)
{
pSelection->Clear();
pSelection->SetSelectPath(sTargetPathTmp2);
}
tProgress.Start();
string sSourcePath = tSelection.GetSelectPath();
LOG_WRITE("Copy sTargetPath [%s] [%s] [%s]", sTargetPath.c_str(), _sCurPath.c_str(), sTargetPathTmp2.c_str());
// 파일 복사
for (int n=0; n<(int)vFiles.size(); n++)
{
File* pFile = vFiles[n];
bool bOverwrite = false;
// 파일 이름이 없을경우 continue
if (!pFile) continue;
// 소스 이름과 타겟 이름 정하기
sSourceName = pFile->sFullName;
sTargetName = sTargetPathTmp2 +
ChgCurLocale( pFile->sFullName.substr(sSourcePath.size()) );
LIBSSH2_SFTP_ATTRIBUTES tAttr;
if (libssh2_sftp_stat((LIBSSH2_SFTP*)_pSessionSFtp, (char*)sSourceName.c_str(), &tAttr) == -1)
{
// 소스가 없다니.. 참
String sMsg; string sErrMsg = GetLastErrMsg();
sMsg.Append(_("File access error (%s), continue? !!! "), pFile->sName.c_str());
if (!sErrMsg.empty()) sMsg.Append("[%s]", sErrMsg.c_str());
tProgress.End();
if (YNBox(_("Error"), sMsg.c_str(), false) == false) break;
tProgress.Start();
continue;
}
LOG_WRITE("SFtpReader Copy sTargetName 1 [%s] [%s] [%s] [%d]",
sSourceName.c_str(), sTargetName.c_str(), _sCurPath.c_str(), tAttr.filesize);
String sCount, sCount2;
sCount.Printf("%s/%s", toregular(uViewCount).c_str(), sSize.c_str());
tProgress.setLeftStr(pFile->sName.c_str());
tProgress.setRightStr2(sCount.c_str());
if (stat(sTargetName.c_str(), &tar_stat)!=-1)
{
if (bSkipAll) continue;
else if (bOverwriteAll == false)
{// 파일이 있을 경우..
askagain_sftp_copy:
vector<string> q;
q.push_back(_("Overwrite"));
q.push_back(_("Skip"));
q.push_back(_("Rename"));
q.push_back(_("Overwrite All"));
q.push_back(_("Skip All"));
q.push_back(_("Cancel"));
int nSelect = 0;
tProgress.End();
nSelect = SelectBox((_("File exists : ") + pFile->sName).c_str(), q, 0);
tProgress.Start();
LOG_WRITE("Selection [%d]", nSelect);
//.........这里部分代码省略.........
示例2: if
bool SFtpReader::Paste(Selection& tSelection)
{
string sCurName, sTargetPathTmp, sTargetPathTmp2;
string sSourceName, sTargetName;
vector<File*> vFiles;
struct stat src_stat;
int nBufSize = g_tCfg.GetValueNum("SSH", "DefBufSize", 8196);
char buf[nBufSize];
ullong uFileSize = tSelection.CalcSize();
uint uSize = tSelection.GetSize();
string sSize = toregular(uSize), sRestSize;
bool bSkipAll = false, bOverwriteAll = false;
ullong uLastSize = 0, uViewCount=1, uPsize=0, uCsize = 0;
vFiles = tSelection.GetData();
sTargetPathTmp2 = _sCurPath;
CommonProgress tProgress( _("Copy"), (_("To ") + sTargetPathTmp2).c_str(), true);
string sSourcePath = tSelection.GetSelectPath();
LOG_WRITE("Copy sTargetPath [%s] [%s]", _sCurPath.c_str(), sTargetPathTmp2.c_str());
EncodeChk(vFiles, false);
tProgress.Start();
// 파일 디렉토리 먼저 생성 복사
for (int n=0; n<(int)vFiles.size(); n++)
{
File* pFile = vFiles[n];
// 파일 이름이 없을경우 continue
if (!pFile) continue;
// 소스 이름과 타겟 이름 정하기
sSourceName = pFile->sFullName;
sTargetName = sTargetPathTmp2 + pFile->sFullName.substr(sSourcePath.size());
sTargetName = KorCodeChg(sTargetName, _eEncode);
// 파일 리스트가 디렉토리 라면
if (pFile->bDir)
{
if ( libssh2_sftp_mkdir( (LIBSSH2_SFTP*)_pSessionSFtp, (char*)sTargetName.c_str(), 0755) == -1)
{
String sMsg; string sErrMsg = GetLastErrMsg();
sMsg.Append(_("SFtp Directory exists, continue !!! [%s]"), sTargetName.c_str());
if (!sErrMsg.empty()) sMsg.Append("[%s]", sErrMsg.c_str());
tProgress.End();
if (YNBox(_("Error"), sMsg.c_str(), false) == false) break;
tProgress.Start();
return false;
}
continue;
}
}
for (int n=0; n<(int)vFiles.size(); n++)
{
File* pFile = vFiles[n];
// 파일 이름이 없을경우 continue
if (!pFile) continue;
// 소스 이름과 타겟 이름 정하기
sSourceName = pFile->sFullName;
sTargetName = sTargetPathTmp2 + pFile->sFullName.substr(sSourcePath.size());
sTargetName = KorCodeChg(sTargetName, _eEncode);
LOG_WRITE("SFtpReader::Paste [%s] [%s]", sSourceName.c_str(), sTargetName.c_str());
if (stat(sSourceName.c_str(), &src_stat)==-1)
{
// 소스가 없다니.. 참
String sStr;
sStr.Append(_("Source is not found : %s"), sSourceName.c_str());
tProgress.End();
MsgBox(_("Error"), sStr);
tProgress.Start();
break;
}
LOG_WRITE("SFtpReader Paste sTargetName 1 [%s] [%s] [%s]", sSourceName.c_str(), sTargetName.c_str(), _sCurPath.c_str());
mode_t permission = src_stat.st_mode;
// 파일 리스트가 디렉토리 라면
if (pFile->bDir) continue;
String sCount, sCount2;
sCount.Printf("%s/%s", toregular(uViewCount).c_str(), sSize.c_str());
tProgress.setLeftStr(pFile->sName.c_str());
tProgress.setRightStr2(sCount.c_str());
LIBSSH2_SFTP_ATTRIBUTES tAttrs;
//.........这里部分代码省略.........