本文整理汇总了C++中TFilePathSet::end方法的典型用法代码示例。如果您正苦于以下问题:C++ TFilePathSet::end方法的具体用法?C++ TFilePathSet::end怎么用?C++ TFilePathSet::end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFilePathSet
的用法示例。
在下文中一共展示了TFilePathSet::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readDirectory
/*! to retrieve the both lists with groupFrames option = on and off.
*/
void TSystem::readDirectory(TFilePathSet &groupFpSet, TFilePathSet &allFpSet,
const TFilePath &path) {
if (!TFileStatus(path).isDirectory())
throw TSystemException(path, " is not a directory");
std::set<TFilePath, CaselessFilepathLess> fileSet_group;
std::set<TFilePath, CaselessFilepathLess> fileSet_all;
QStringList fil =
QDir(toQString(path))
.entryList(QDir::Files | QDir::NoDotAndDotDot | QDir::Readable);
if (fil.size() == 0) return;
for (int i = 0; i < fil.size(); i++) {
QString fi = fil.at(i);
TFilePath son = path + TFilePath(fi.toStdWString());
// store all file paths
fileSet_all.insert(son);
// in case of the sequencial files
if (son.getDots() == "..") son = son.withFrame();
// store the group. insersion avoids duplication of the item
fileSet_group.insert(son);
}
groupFpSet.insert(groupFpSet.end(), fileSet_group.begin(),
fileSet_group.end());
allFpSet.insert(allFpSet.end(), fileSet_all.begin(), fileSet_all.end());
}
示例2: doesExistFileOrLevel
bool TSystem::doesExistFileOrLevel(const TFilePath &fp) {
if (TFileStatus(fp).doesExist()) return true;
if (fp.isLevelName()) {
const TFilePath &parentDir = fp.getParentDir();
if (!TFileStatus(parentDir).doesExist()) return false;
TFilePathSet files;
try {
files = TSystem::readDirectory(parentDir, false, true, true);
} catch (...) {
}
TFilePathSet::iterator it, end = files.end();
for (it = files.begin(); it != end; ++it) {
if (it->getLevelNameW() == fp.getLevelNameW()) return true;
}
} else if (fp.getType() == "psd") {
QString name(QString::fromStdWString(fp.getWideName()));
name.append(QString::fromStdString(fp.getDottedType()));
int sepPos = name.indexOf("#");
int dotPos = name.indexOf(".", sepPos);
int removeChars = dotPos - sepPos;
int doubleUnderscorePos = name.indexOf("__", sepPos);
if (doubleUnderscorePos > 0) removeChars = doubleUnderscorePos - sepPos;
name.remove(sepPos, removeChars);
TFilePath psdpath(fp.getParentDir() + TFilePath(name.toStdWString()));
if (TFileStatus(psdpath).doesExist()) return true;
}
return false;
}
示例3: loadMacro
void InsertFxPopup::loadMacro()
{
TFilePath fp = m_presetFolder + TFilePath("macroFx");
try {
if (TFileStatus(fp).isDirectory()) {
TFilePathSet macros = TSystem::readDirectory(fp);
if (macros.empty())
return;
QTreeWidgetItem *macroFolder = new QTreeWidgetItem((QTreeWidget *)0, QStringList(tr("Macro")));
macroFolder->setData(0, Qt::UserRole, QVariant(toQString(fp)));
macroFolder->setIcon(0, m_folderIcon);
m_fxTree->addTopLevelItem(macroFolder);
for (TFilePathSet::iterator it = macros.begin(); it != macros.end(); ++it) {
TFilePath macroPath = *it;
QString name(macroPath.getName().c_str());
QTreeWidgetItem *macroItem = new QTreeWidgetItem((QTreeWidget *)0, QStringList(name));
macroItem->setData(0, Qt::UserRole, QVariant(toQString(macroPath)));
macroItem->setIcon(0, m_fxIcon);
macroFolder->addChild(macroItem);
}
}
} catch (...) {
}
}
示例4: updateChooseProjectCombo
void ProjectPopup::updateChooseProjectCombo() {
m_projectPaths.clear();
m_chooseProjectCombo->clear();
TFilePath sandboxFp = TProjectManager::instance()->getSandboxProjectFolder() +
"sandbox_otprj.xml";
m_projectPaths.push_back(sandboxFp);
m_chooseProjectCombo->addItem("sandbox");
std::vector<TFilePath> prjRoots;
TProjectManager::instance()->getProjectRoots(prjRoots);
for (int i = 0; i < prjRoots.size(); i++) {
TFilePathSet fps;
TSystem::readDirectory_Dir_ReadExe(fps, prjRoots[i]);
TFilePathSet::iterator it;
for (it = fps.begin(); it != fps.end(); ++it) {
TFilePath fp(*it);
if (TProjectManager::instance()->isProject(fp)) {
m_projectPaths.push_back(
TProjectManager::instance()->projectFolderToProjectPath(fp));
m_chooseProjectCombo->addItem(QString::fromStdString(fp.getName()));
}
}
}
for (int i = 0; i < m_projectPaths.size(); i++) {
if (TProjectManager::instance()->getCurrentProjectPath() ==
m_projectPaths[i]) {
m_chooseProjectCombo->setCurrentIndex(i);
break;
}
}
}
示例5: loadPreset
bool InsertFxPopup::loadPreset(QTreeWidgetItem *item)
{
QString str = item->data(0, Qt::UserRole).toString();
TFilePath presetsFilepath(m_presetFolder + str.toStdWString());
int i;
for (i = item->childCount() - 1; i >= 0; i--)
item->removeChild(item->child(i));
if (TFileStatus(presetsFilepath).isDirectory()) {
TFilePathSet presets = TSystem::readDirectory(presetsFilepath);
if (!presets.empty()) {
for (TFilePathSet::iterator it2 = presets.begin(); it2 != presets.end(); ++it2) {
TFilePath presetPath = *it2;
QString name(presetPath.getName().c_str());
QTreeWidgetItem *presetItem = new QTreeWidgetItem((QTreeWidget *)0, QStringList(name));
presetItem->setData(0, Qt::UserRole, QVariant(toQString(presetPath)));
item->addChild(presetItem);
presetItem->setIcon(0, m_fxIcon);
}
} else
return false;
} else
return false;
return true;
}
示例6: renameFileOrLevel_throw
void TSystem::renameFileOrLevel_throw(const TFilePath &dst,
const TFilePath &src,
bool renamePalette) {
if (renamePalette && ((src.getType() == "tlv") || (src.getType() == "tzp") ||
(src.getType() == "tzu"))) {
// Special case: since renames cannot be 'grouped' in the UI, palettes are
// automatically
// renamed here if required
const char *type = (src.getType() == "tlv") ? "tpl" : "plt";
TFilePath srcpltname(src.withNoFrame().withType(type));
TFilePath dstpltname(dst.withNoFrame().withType(type));
if (TSystem::doesExistFileOrLevel(src) &&
TSystem::doesExistFileOrLevel(srcpltname))
TSystem::renameFile(dstpltname, srcpltname, false);
}
if (src.isLevelName()) {
TFilePathSet files;
files = TSystem::readDirectory(src.getParentDir(), false);
for (TFilePathSet::iterator it = files.begin(); it != files.end(); it++) {
if (it->getLevelName() == src.getLevelName()) {
TFilePath src1 = *it;
TFilePath dst1 = dst.withFrame(it->getFrame());
TSystem::renameFile(dst1, src1);
}
}
} else
TSystem::renameFile(dst, src);
}
示例7: hideFileOrLevel_throw
void TSystem::hideFileOrLevel_throw(const TFilePath &fp) {
if (fp.isLevelName()) {
TFilePathSet files;
files = TSystem::readDirectory(fp.getParentDir(), false);
TFilePathSet::iterator it, end = files.end();
for (it = files.begin(); it != end; ++it) {
if (it->getLevelNameW() == fp.getLevelNameW()) TSystem::hideFile(*it);
}
} else
TSystem::hideFile(fp);
}
示例8: packLevelNames
TFilePathSet TSystem::packLevelNames(const TFilePathSet &fps) {
std::set<TFilePath> tmpSet;
TFilePathSet::const_iterator cit;
for (cit = fps.begin(); cit != fps.end(); ++cit)
tmpSet.insert(cit->getParentDir() + cit->getLevelName());
TFilePathSet fps2;
for (std::set<TFilePath>::const_iterator c_sit = tmpSet.begin();
c_sit != tmpSet.end(); ++c_sit) {
fps2.push_back(*c_sit);
}
return fps2;
}
示例9: loadInfo
TLevelP TLevelReader::loadInfo()
{
TFilePath parentDir = m_path.getParentDir();
TFilePath levelName(m_path.getLevelName());
// cout << "Parent dir = '" << parentDir << "'" << endl;
// cout << "Level name = '" << levelName << "'" << endl;
TFilePathSet files;
try {
files = TSystem::readDirectory(parentDir, false, true, true);
} catch (...) {
throw TImageException(m_path, "unable to read directory content");
}
TLevelP level;
vector<TFilePath> data;
for (TFilePathSet::iterator it = files.begin(); it != files.end(); it++) {
TFilePath ln(it->getLevelName());
// cout << "try " << *it << " " << it->getLevelName() << endl;
if (levelName == TFilePath(it->getLevelName())) {
try {
level->setFrame(it->getFrame(), TImageP());
data.push_back(*it);
} catch (string msg) {
throw msg;
}
}
}
if (!data.empty()) {
std::vector<TFilePath>::iterator it = std::min_element(data.begin(), data.end(), myLess);
TFilePath fr = (*it).withoutParentDir().withName("").withType("");
wstring ws = fr.getWideString();
if (ws.length() == 5) {
if (ws.rfind(L'_') == (int)wstring::npos)
m_frameFormat = TFrameId::FOUR_ZEROS;
else
m_frameFormat = TFrameId::UNDERSCORE_FOUR_ZEROS;
} else {
if (ws.rfind(L'_') == (int)wstring::npos)
m_frameFormat = TFrameId::NO_PAD;
else
m_frameFormat = TFrameId::UNDERSCORE_NO_PAD;
}
} else
m_frameFormat = TFrameId::FOUR_ZEROS;
return level;
}
示例10: copyFileOrLevel_throw
void TSystem::copyFileOrLevel_throw(const TFilePath &dst,
const TFilePath &src) {
if (src.isLevelName()) {
TFilePathSet files;
files = TSystem::readDirectory(src.getParentDir(), false);
TFilePathSet::iterator it, end = files.end();
for (it = files.begin(); it != end; ++it) {
if (it->getLevelNameW() == src.getLevelNameW()) {
TFilePath src1 = *it;
TFilePath dst1 = dst.withFrame(it->getFrame());
TSystem::copyFile(dst1, src1);
}
}
} else
TSystem::copyFile(dst, src);
}
示例11: readPaperFormats
void TPaperFormatManager::readPaperFormats() {
TFilePathSet fps;
TFilePath papDir = TEnv::getConfigDir() + "pap";
if (!TFileStatus(papDir).isDirectory()) {
// TMessage::error("E_CanNotReadDirectory_%1", papDir);
return;
}
try {
fps = TSystem::readDirectory(papDir);
} catch (TException &) {
// TMessage::error("E_CanNotReadDirectory_%1", papDir);
return;
}
TFilePathSet::const_iterator it = fps.begin();
for (; it != fps.end(); ++it) readPaperFormat(*it);
}
示例12: loadMacro
void AddFxContextMenu::loadMacro() {
TFilePath macroDir = m_presetPath + TFilePath("macroFx");
try {
if (TFileStatus(macroDir).isDirectory()) {
TFilePathSet macros = TSystem::readDirectory(macroDir);
if (macros.empty()) return;
QMenu *insertMacroMenu = new QMenu("Macro", m_insertMenu);
QMenu *addMacroMenu = new QMenu("Macro", m_addMenu);
QMenu *replaceMacroMenu = new QMenu("Macro", m_replaceMenu);
m_insertMenu->addMenu(insertMacroMenu);
m_addMenu->addMenu(addMacroMenu);
m_replaceMenu->addMenu(replaceMacroMenu);
for (TFilePathSet::iterator it = macros.begin(); it != macros.end();
++it) {
TFilePath macroPath = *it;
QString name = QString::fromStdWString(macroPath.getWideName());
QAction *insertAction = new QAction(name, insertMacroMenu);
QAction *addAction = new QAction(name, addMacroMenu);
QAction *replaceAction = new QAction(name, replaceMacroMenu);
insertAction->setData(
QVariant(QString::fromStdWString(macroPath.getWideString())));
addAction->setData(
QVariant(QString::fromStdWString(macroPath.getWideString())));
replaceAction->setData(
QVariant(QString::fromStdWString(macroPath.getWideString())));
insertMacroMenu->addAction(insertAction);
addMacroMenu->addAction(addAction);
replaceMacroMenu->addAction(replaceAction);
m_insertActionGroup->addAction(insertAction);
m_addActionGroup->addAction(addAction);
m_replaceActionGroup->addAction(replaceAction);
}
}
} catch (...) {
}
}
示例13: decodePath
TFilePath TMyPaintBrushStyle::decodePath(const TFilePath &path) const {
if (path.isAbsolute())
return path;
if (m_currentScene) {
TFilePath p = m_currentScene->decodeFilePath(path);
TFileStatus fs(p);
if (fs.doesExist() && !fs.isDirectory())
return p;
}
TFilePathSet paths = getBrushesDirs();
for(TFilePathSet::iterator i = paths.begin(); i != paths.end(); ++i) {
TFilePath p = *i + path;
TFileStatus fs(p);
if (fs.doesExist() && !fs.isDirectory())
return p;
}
return path;
}
示例14: readDirectory_Dir_ReadExe
/*! return the file list which is readable and executable
*/
void TSystem::readDirectory_Dir_ReadExe(TFilePathSet &dst,
const TFilePath &path) {
if (!TFileStatus(path).isDirectory())
throw TSystemException(path, " is not a directory");
std::set<TFilePath, CaselessFilepathLess> fileSet;
QStringList fil =
QDir(toQString(path))
.entryList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::Readable);
int i;
for (i = 0; i < fil.size(); i++) {
QString fi = fil.at(i);
TFilePath son = path + TFilePath(fi.toStdWString());
fileSet.insert(son);
}
dst.insert(dst.end(), fileSet.begin(), fileSet.end());
}
示例15: loadPreset
bool AddFxContextMenu::loadPreset(const string &name,
QMenu *insertFxGroup, QMenu *addFxGroup, QMenu *replaceFxGroup)
{
TFilePath presetsFilepath(m_presetPath + name);
if (TFileStatus(presetsFilepath).isDirectory()) {
TFilePathSet presets = TSystem::readDirectory(presetsFilepath, false);
if (!presets.empty()) {
QMenu *inserMenu = new QMenu(QString::fromStdWString(TStringTable::translate(name)), insertFxGroup);
insertFxGroup->addMenu(inserMenu);
QMenu *addMenu = new QMenu(QString::fromStdWString(TStringTable::translate(name)), addFxGroup);
addFxGroup->addMenu(addMenu);
QMenu *replaceMenu = new QMenu(QString::fromStdWString(TStringTable::translate(name)), replaceFxGroup);
replaceFxGroup->addMenu(replaceMenu);
//This is a workaround to set the bold style to the first element of this menu
//Setting a font directly to a QAction is not enought; style sheet definitions
//preval over QAction font settings.
inserMenu->setObjectName("fxMenu");
addMenu->setObjectName("fxMenu");
replaceMenu->setObjectName("fxMenu");
QAction *insertAction = new QAction(QString::fromStdWString(TStringTable::translate(name)), inserMenu);
QAction *addAction = new QAction(QString::fromStdWString(TStringTable::translate(name)), addMenu);
QAction *replaceAction = new QAction(QString::fromStdWString(TStringTable::translate(name)), replaceMenu);
insertAction->setCheckable(true);
addAction->setCheckable(true);
replaceAction->setCheckable(true);
insertAction->setData(QVariant(QString::fromStdString(name)));
addAction->setData(QVariant(QString::fromStdString(name)));
replaceAction->setData(QVariant(QString::fromStdString(name)));
inserMenu->addAction(insertAction);
addMenu->addAction(addAction);
replaceMenu->addAction(replaceAction);
m_insertActionGroup->addAction(insertAction);
m_addActionGroup->addAction(addAction);
m_replaceActionGroup->addAction(replaceAction);
for (TFilePathSet::iterator it2 = presets.begin(); it2 != presets.end(); ++it2) {
TFilePath presetName = *it2;
QString qPresetName = QString::fromStdWString(presetName.getWideName());
insertAction = new QAction(qPresetName, inserMenu);
addAction = new QAction(qPresetName, addMenu);
replaceAction = new QAction(qPresetName, replaceMenu);
insertAction->setData(QVariant(QString::fromStdWString(presetName.getWideString())));
addAction->setData(QVariant(QString::fromStdWString(presetName.getWideString())));
replaceAction->setData(QVariant(QString::fromStdWString(presetName.getWideString())));
inserMenu->addAction(insertAction);
addMenu->addAction(addAction);
replaceMenu->addAction(replaceAction);
m_insertActionGroup->addAction(insertAction);
m_addActionGroup->addAction(addAction);
m_replaceActionGroup->addAction(replaceAction);
}
return true;
} else
return false;
} else
return false;
}