本文整理汇总了C++中Folder类的典型用法代码示例。如果您正苦于以下问题:C++ Folder类的具体用法?C++ Folder怎么用?C++ Folder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Folder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: commentKey
void QuizFrame::setTerm( const Term& term ) {
Translation firstLangTranslation = term.getTranslation( controller->getQuizFirstLanguage() );
Translation testLangTranslation = term.getTranslation( controller->getQuizTestLanguage() );
const QString firstLangWord = firstLangTranslation.getWord();
const QString testLangAlt = testLangTranslation.getAlt();
const QString testLangWord = testLangTranslation.getWord();
QString comment;
BilingualKey commentKey( controller->getQuizFirstLanguage(), controller->getQuizTestLanguage() );
if( term.isCommentExists( commentKey ) )
comment = term.getComment( commentKey );
firstLangTermLineEdit->setText( firstLangWord );
firstLangTermLineEdit->setCursorPosition( 0 );
testLangTermAltLineEdit->setText( testLangAlt );
testLangTermAltLineEdit->setCursorPosition( 0 );
testLangTermLineEdit->setText( testLangWord );
testLangTermLineEdit->setCursorPosition( 0 );
commentMultiLineEdit->setText( comment );
Folder* vocabTree = controller->getVocabTree();
Vocabulary* vocab = vocabTree->getVocabulary( term.getVocabId() );
if( vocab ) {
QString absPath = controller->getResolvedImagePath( term.getImagePath(), *vocab );
setImage( absPath );
}
}
示例2: Folder
Folder* Folder::fromOPML(const QDomElement& e)
{
Folder* fg = new Folder(e.hasAttribute(QString::fromLatin1("text")) ? e.attribute(QString::fromLatin1("text")) : e.attribute(QString::fromLatin1("title")));
fg->setOpen( e.attribute(QString::fromLatin1("isOpen")) == QString::fromLatin1(("true")));
fg->setId( e.attribute(QString::fromLatin1("id")).toUInt() );
return fg;
}
示例3: virusTest
string virusTest()
{
vector<File*> fls;
Folder * f = new Folder("test");
File * file = new File();
Virus * v = new Virus();
v->type = Virus::CREATING;
v->nextHarm = 0;
file->setVirus(v);
f->addFile(file);
f->getAllFilesRecursively(fls);
if(fls.size() != 1) return "file count mismatch 1";
v->update(f);
fls.clear();
f->getAllFilesRecursively(fls);
if(fls.size() != 2) return "file count mismatch 2";
v->type = Virus::ERASING;
v->nextHarm = 0;
v->update(f);
fls.clear();
f->getAllFilesRecursively(fls);
if(fls.size() != 2) return "file count mismatch 3";
delete f;
return "";
}
示例4: sourceDirIt
QPtrList<File>* Engine::files(FilterNode* filterRootNode)
{
tracer->sinvoked(__func__) << "with filter:" << endl;
if (filterRootNode) {
filterRootNode->dump("");
}
// remove all files currently shown
m_fileList2display->clear();
// loop over all source directories
QIntDictIterator<Folder> sourceDirIt(*m_sourceDirDict);
for ( ; sourceDirIt.current(); ++sourceDirIt ) {
Folder* sourceDir = sourceDirIt.current();
// handle the files in this directory only if it is selected
if (sourceDir->include()) {
// loop over all files in the current sourcedirectory
QPtrList<File>* fileList = sourceDir->files();
for (File* file = fileList->first(); file; file = fileList->next()) {
// append the file if it matches the filter
if (filterRootNode->evaluate(file)) {
m_fileList2display->append(file);
}
}
}
}
return m_fileList2display;
}
示例5: LocalFolder
Folder* LocalFolder::newChildFolder(string Name) {
//If the name is invalid return 0
if (Name.empty())
return 0;
//If it already exists bottle out return 0
if (searchForChild(Name) != 0)
return 0;
Folder* returnFolder = 0;
//Generate the file path
string fullPath = m_localFolderPath + Name + "/";
if (mkdir(fullPath.c_str(), 0) == 0) {
returnFolder = new LocalFolder(Name, fullPath);
returnFolder->refresh();
m_entryList.push_back(returnFolder);
}
return returnFolder;
}
示例6: JulianDateTime2String
bool ImportOPJ::createProjectTree(const OPJFile &opj) {
const tree<projectNode> *projectTree = opj.project();
tree<projectNode>::iterator root = projectTree->begin(projectTree->begin());
if (!root.node)
return false;
FolderListItem *item =
static_cast<FolderListItem *>(mw->folders->firstChild());
item->setText(0, root->name.c_str());
item->folder()->setObjectName(root->name.c_str());
Folder *projectFolder = mw->projectFolder();
QHash<tree<projectNode>::iterator, Folder *> parent;
parent[root] = projectFolder;
for (tree<projectNode>::iterator sib = projectTree->begin(root);
sib != projectTree->end(root); ++sib) {
if (sib->type == 1) {
parent[sib] = mw->addFolder(sib->name.c_str(),
parent.value(projectTree->parent(sib)));
parent[sib]->setBirthDate(JulianDateTime2String(sib->creation_date));
parent[sib]->setModificationDate(
JulianDateTime2String(sib->modification_date));
} else {
MdiSubWindow *w = projectFolder->window(sib->name.c_str());
if (w) {
parent.value(projectTree->parent(sib))->addWindow(w);
projectFolder->removeWindow(w);
}
}
}
mw->changeFolder(projectFolder, true);
return true;
}
示例7: add_Folder
void add_Folder(Folder &F) {
F.set_Full_Folder_Name( folder_root + "/" + F.get_Folder_Name() );
cout << "Folder_name= " << F.get_Folder_Name() << endl; // DEBUG
cout << "fullFolder_name= " << F.get_Folder_Name() << endl; // DEBUG
folder_list.push_back( F );
return;
}
示例8: TEST
TEST(D_FileSystemTest, Folders_Create_1)
{
ASSERT_TRUE(DatabasePrepare());
FoldersNames_vt foldsNames;
const unsigned char foldsInPack = 3;
CreateFoldNames(foldsInPack, foldsNames);
ASSERT_FALSE(foldsNames.empty());
FolderGuard root = cont->GetRoot();
ElementGuard ce;
Folders_vt folds;
for (int i = 0; i < foldsInPack; ++i)
{
EXPECT_NO_THROW(root->CreateChild(foldsNames[i], ElementTypeFolder));
EXPECT_NO_THROW(ce = root->GetChild(foldsNames[i]));
EXPECT_EQ(foldsNames[i], ce->Name());
EXPECT_EQ(ElementTypeFolder, ce->Type());
Folder* cf = ce->AsFolder();
ASSERT_NE(cf, nullptr);
folds.push_back(cf->AsFolder()->Clone());
}
for (int i = 0; i < foldsInPack; ++i)
{
EXPECT_THROW(root->CreateChild(foldsNames[i], ElementTypeFolder), ContainerException);
EXPECT_THROW(root->CreateChild(foldsNames[i], ElementTypeFile), ContainerException);
EXPECT_TRUE(folds[i]->Exists());
}
}
示例9: editCurrentTerm
void QuizFrame::editCurrentTerm() {
if( controller->isQuizInProgress() ) {
Folder* vocabTree = controller->getVocabTree();
Term* term = controller->getCurrentTerm();
if( !term ) {
QMessageBox::warning( this, QObject::tr( "Information" ), tr( "DissociatedWord" ) );
return;
}
Vocabulary* vocab = vocabTree->getVocabulary( term->getVocabId() );
if( vocab == NULL || !vocab->isTermExists( term->getId() ) ) {
QMessageBox::warning( this, QObject::tr( "Information" ), tr( "DissociatedWord" ) );
return;
}
TermDialog dialog( *vocab, controller, this, *term );
int result = dialog.exec();
if( result ) {
QString firstLang( controller->getQuizFirstLanguage() );
QString testLang( controller->getQuizTestLanguage() );
Term newTerm = dialog.getTerm();
Translation firstLangTrans = newTerm.getTranslation( firstLang );
Translation testLangTrans = newTerm.getTranslation( testLang );
term->addTranslation( firstLangTrans );
term->addTranslation( testLangTrans );
BilingualKey commentKey( firstLang, testLang );
term->addComment( commentKey, newTerm.getComment( commentKey ) );
term->setImagePath( newTerm.getImagePath() );
vocab->setModificationDate( QDateTime::currentDateTime() );
vocab->setDirty( true );
setTerm( newTerm );
}
}
}
示例10: WARNING
void FolderItemPropertiesWidget::sl_ChooseIconButton_Clicked() {
if (!itemToEdit) {
WARNING("Null pointer recieved");
reject();
}
if (!customIconsWidget) {
customIconsWidget = new CustomIconsListWidget(this);
}
if (itemToEdit->GetItemType() == AbstractFolderItem::Type_Folder) {
Folder* f = dynamic_cast<Folder*>(itemToEdit);
customIconsWidget->SelectIcon(f->GetIconID());
} else if (itemToEdit->GetItemType() == AbstractFolderItem::Type_Note) {
Note* n = dynamic_cast<Note*>(itemToEdit);
customIconsWidget->SelectIcon(n->GetIconID());
}
if (customIconsWidget->exec() != QDialog::Accepted) {return;}
Document* doc = Application::I()->CurrentDocument();
if (doc == 0) {
WARNING("Current document is 0");
return;
}
selectedIconKey = customIconsWidget->SelectedIconKey;
iconLabel->setPixmap(doc->GetItemIcon(selectedIconKey));
}
示例11: swap
void swap(Folder &lhs, Folder &rhs) {
using std::swap;
lhs.remove_Message();
rhs.remove_Message();
swap(lhs.messages, rhs.messages);
lhs.add_Message(lhs);
rhs.add_Message(rhs);
}
示例12: main
int main( int argc, char * argv[] )
{
Process process;
Session session;
Folder * folder;
string name = "/cpp_folder_create";
string subname = "test";
try {
if ( argc > 1 ) {
process.Init( argv[1], argv[0] );
}
else {
process.Init( "10701", argv[0] );
}
}
catch( pso::Exception exc ) {
cerr << "Test failed in init phase, error = " << exc.Message() << endl;
cerr << "Is the server running?" << endl;
return 1;
}
try {
session.Init();
session.CreateFolder( name );
folder = new Folder( session, name );
}
catch( pso::Exception exc ) {
cerr << "Test failed in init phase, error = " << exc.Message() << endl;
cerr << "Is the server running?" << endl;
return 1;
}
// Invalid arguments to tested function.
try {
folder->CreateFolder( "" );
cerr << "Test failed - line " << __LINE__ << endl;
return 1;
}
catch( pso::Exception exc ) {
if ( exc.ErrorCode() != PSO_INVALID_LENGTH ) {
cerr << "Test failed - line " << __LINE__ << ", error = " << exc.Message() << endl;
return 1;
}
}
// End of invalid args. This call should succeed.
try {
folder->CreateFolder( subname );
}
catch( pso::Exception exc ) {
cerr << "Test failed - line " << __LINE__ << ", error = " << exc.Message() << endl;
return 1;
}
return 0;
}
示例13: emptyList
void LocalFolder::refresh() {
#warning May not be compatable with Windows 32
emptyList();
DIR* dir = opendir(m_localFolderPath.c_str());
struct dirent* nextEntry;
if (dir != 0) {
while (true) {
nextEntry = readdir(dir);
if (nextEntry != 0) {
//Check it isn't the current or parent indicators
if (strcmp(nextEntry->d_name, ".") == 0) {
//Do nothing for this dir
} else if (strcmp(nextEntry->d_name, "..") == 0) {
//Do nothing for the dir the level above
} else {
//if its not process it
if (nextEntry->d_type == DT_DIR) {
//Directory
string fullPath = m_localFolderPath + nextEntry->d_name
+ "/";
Folder* subFolder = new LocalFolder(nextEntry->d_name,
fullPath);
subFolder->refresh();
m_entryList.push_back(subFolder);
} else {
//File
string fullPath = m_localFolderPath + nextEntry->d_name;
m_entryList.push_back(new LocalFile(fullPath));
}
}
} else {
break;
}
}
closedir(dir);
dir = 0;
}
}
示例14: Syscall_CheckFolderExistence
extern "C" uint64_t Syscall_CheckFolderExistence(const char* path)
{
using namespace Kernel::HardwareAbstraction::Filesystems::VFS;
Folder* f = new Folder(path);
bool ret = f->Exists();
delete f;
return ret;
}
示例15: QDir
void OwncloudSetupWizard::startWizard()
{
FolderMan *folderMan = FolderMan::instance();
bool multiFolderSetup = folderMan->map().count() > 1;
// ###
Account *account = Account::restore();
if (!account) {
_ocWizard->setConfigExists(false);
account = new Account;
account->setCredentials(CredentialsFactory::create("dummy"));
} else {
_ocWizard->setConfigExists(true);
}
account->setSslErrorHandler(new SslDialogErrorHandler);
_ocWizard->setAccount(account);
_ocWizard->setOCUrl(account->url().toString());
_remoteFolder = Theme::instance()->defaultServerFolder();
// remoteFolder may be empty, which means /
QString localFolder = Theme::instance()->defaultClientFolder();
// if its a relative path, prepend with users home dir, otherwise use as absolute path
if( !QDir(localFolder).isAbsolute() ) {
localFolder = QDir::homePath() + QDir::separator() + localFolder;
}
if (!multiFolderSetup) {
QList<Folder*> folders = folderMan->map().values();
if (!folders.isEmpty()) {
Folder* folder = folders.first();
localFolder = QDir(folder->path()).absolutePath();
}
}
_ocWizard->setProperty("localFolder", localFolder);
// remember the local folder to compare later if it changed, but clean first
QString lf = QDir::fromNativeSeparators(localFolder);
if( !lf.endsWith(QLatin1Char('/'))) {
lf.append(QLatin1Char('/'));
}
_initLocalFolder = lf;
_ocWizard->setRemoteFolder(_remoteFolder);
_ocWizard->setStartId(WizardCommon::Page_ServerSetup);
_ocWizard->restart();
// settings re-initialized in initPage must be set here after restart
_ocWizard->setMultipleFoldersExist( multiFolderSetup );
_ocWizard->open();
_ocWizard->raise();
}