这篇教程C++ sourceFile函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中sourceFile函数的典型用法代码示例。如果您正苦于以下问题:C++ sourceFile函数的具体用法?C++ sourceFile怎么用?C++ sourceFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了sourceFile函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: formWindowvoid SourceEditor::checkTimeStamp(){ if ( formWindow() ) formWindow()->formFile()->checkTimeStamp(); else if ( sourceFile() ) sourceFile()->checkTimeStamp();}
开发者ID:app,项目名称:ananas-labs,代码行数:7,
示例2: sourceFilebool Dictionary::InsertWordsIntoDict(const string& filename){ // Purpose: insert the words found in the file specified into the dictionary fstream sourceFile(filename.c_str(), ios::in); if (!sourceFile) { cerr << "Error: file /"" << filename << "/" does not exist, and thus file-insertion could not be performed." << endl; return failure; } string currentWord; while (sourceFile >> currentWord) { if (totalWordsInDict >= maxWordsInDict) // If we're over the limit, don't keep calling the add a word function, it's a waste of time. { cerr << "Error: max words in dictionary (" << maxWordsInDict << ") has been reached. Complete insertion failed." << endl; return failure; // As usual boolean values fail to suffice in certain contexs. We may have inserted SOME, so it's not a true absolute failure. } this->AddAWord(currentWord); // Add the word, this handles incrementation for us. } sourceFile.close(); return success;}
开发者ID:BigEndian,项目名称:cs211-labs,代码行数:25,
示例3: perform string perform(const shared_ptr< const Config >& /* config */, const download::Uri& uri, const string& targetPath, const std::function< void (const vector< string >&) >& callback) { auto sourcePath = uri.getOpaque(); auto protocol = uri.getProtocol(); // preparing source string openError; File sourceFile(sourcePath, "r", openError); if (!openError.empty()) { return format2("unable to open the file '%s' for reading: %s", sourcePath, openError); } if (protocol == "copy") { return copyFile(sourcePath, sourceFile, targetPath, callback); // full copying } else if (protocol == "file") { // symlinking unlink(targetPath.c_str()); // yep, no error handling; if (symlink(sourcePath.c_str(), targetPath.c_str()) == -1) { return format2e("unable to create symbolic link '%s' -> '%s'", targetPath, sourcePath); } return string(); } else { fatal2i("a wrong scheme '%s' for the 'file' download method", protocol); return string(); // unreachable } }
开发者ID:cvalka4,项目名称:cupt,代码行数:34,
示例4: sourceint source (char const *comm) /* 002 */{ Tstr filename = makeScript(comm, TRUE); // 003 int rtn = sourceFile ((char const*)filename, (char const*)Tenv::appGet("SIRE"), "-env"); unlink((char const*)filename); return(rtn);}
开发者ID:LaMaisonOrchard,项目名称:Sire,代码行数:7,
示例5: mainint main(int argc, char *argv[]){ if( argc == 2 && strcmp(argv[1], "--help") == 0 ) { QCoreApplication a(argc, argv); // this doesn't work printf("Command line usage:/n/nReplacementWorkspace my-replacements.xml input.txt output.txt/n"); return a.exec(); } else if( argc == 4 ) { // this does nothing and it hangs QCoreApplication a(argc, argv); QString transformationFile( argv[1] ); QString sourceFile( argv[2] ); QString destFile( argv[3] ); ReplacementEngine re; re.readFromFile(transformationFile); re.processFile(sourceFile, destFile); return a.exec(); } else { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); }}
开发者ID:adamb924,项目名称:ReplacementWorkspace,代码行数:31,
示例6: sourceFilestatic bool copyIfNotPresent ( const QString &sourcePath , const QString &destinationPath ){ QFile sourceFile(sourcePath); QFile destinationFile(destinationPath); if (destinationFile.exists()) return true; if (sourceFile.open(QIODevice::ReadOnly | QIODevice::Text) == false) { fprintf(stderr, "Failed to read template./n"); return false; } QFileInfo destinationInfo(destinationFile); QDir(destinationInfo.absolutePath()).mkpath("."); if (destinationFile.open(QIODevice::WriteOnly | QIODevice::Text) == false) { fprintf(stderr, "Failed to open user configuration file for writing./n"); return false; } QTextStream in(&sourceFile); QTextStream out(&destinationFile); out << in.readAll(); return true;}
开发者ID:SylvanHuang,项目名称:uca-devices,代码行数:29,
示例7: Q_UNUSEDCore::GeneratedFiles ClassWizard::generateFiles(const QWizard *w, QString *errorMessage) const{ Q_UNUSED(errorMessage); const ClassWizardDialog *wizard = qobject_cast<const ClassWizardDialog *>(w); const ClassWizardParameters params = wizard->parameters(); const QString fileName = Core::BaseFileWizard::buildFileName( params.path, params.fileName, QLatin1String(Constants::C_PY_EXTENSION)); Core::GeneratedFile sourceFile(fileName); SourceGenerator generator; generator.setPythonQtBinding(SourceGenerator::PySide); Kit *kit = kitForWizard(wizard); if (kit) { QtSupport::BaseQtVersion *baseVersion = QtSupport::QtKitInformation::qtVersion(kit); if (baseVersion && baseVersion->qtVersion().majorVersion == 5) generator.setPythonQtVersion(SourceGenerator::Qt5); else generator.setPythonQtVersion(SourceGenerator::Qt4); } QString sourceContent = generator.generateClass( params.className, params.baseClass, params.classType ); sourceFile.setContents(sourceContent); sourceFile.setAttributes(Core::GeneratedFile::OpenEditorAttribute); return Core::GeneratedFiles() << sourceFile;}
开发者ID:ZerpHmm,项目名称:qt-creator,代码行数:31,
示例8: sourceFilevoid PHPOutlineTree::BuildTree(const wxFileName& filename){ m_filename = filename; PHPSourceFile sourceFile(filename, NULL); sourceFile.SetParseFunctionBody(false); sourceFile.Parse(); wxWindowUpdateLocker locker(this); DeleteAllItems(); wxTreeItemId root = AddRoot(wxT("Root")); wxImageList* images = new wxImageList(clGetScaledSize(16), clGetScaledSize(16), true); images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/globals"))); // 0 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/function_private"))); // 1 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/function_protected"))); // 2 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/function_public"))); // 3 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/member_private"))); // 4 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/member_protected"))); // 5 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/member_public"))); // 6 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/namespace"))); // 7 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/class"))); // 8 images->Add(m_manager->GetStdIcons()->LoadBitmap(wxT("cc/16/enumerator"))); // 9 AssignImageList(images); // Build the tree view BuildTree(root, sourceFile.Namespace()); if(HasChildren(GetRootItem())) { ExpandAll(); }}
开发者ID:lpc1996,项目名称:codelite,代码行数:31,
示例9: convertPathL//================================================================================//convertPathL//================================================================================void convertPathL(TDesC& aPath, TDesC& aPathName, RFs& aFs, TDesC& aTargetFile) { aFs.MkDirAll(aPathName); CDir* entryList = NULL; TInt error = aFs.GetDir(aPath,KEntryAttMatchMask,ESortByName,entryList); User::LeaveIfError(error); TInt numberOfFiles = entryList->Count(); for (TInt i=0; i<numberOfFiles; i++) { //get the source file HBufC* temp=HBufC::NewLC(((*entryList)[i].iName).Length()); TPtr sourceFileName(temp->Des()); sourceFileName.Copy((*entryList)[i].iName); HBufC* temp2=HBufC::NewLC(((*entryList)[i].iName).Length()+aPathName.Length()); TPtr sourceFile(temp2->Des()); sourceFile = aPathName; sourceFile.Append(sourceFileName); //do the conversion synchronousL(sourceFile, aTargetFile); //output result _LIT(KString,"%S"); test.Printf(KString,&(sourceFileName)); test.Printf(_L("/n")); CleanupStack::PopAndDestroy(2);//temp, temp2 } delete entryList; test.Printf(_L("/n%d files converted/n"),numberOfFiles); }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:35,
示例10: copyTemplateFilestatic void copyTemplateFile(const QString &fileName, const QString &targetDirectory, const Profile &profile, const QtEnvironment &qtEnv, QStringList *allFiles, const QtModuleInfo *module = 0){ if (!QDir::root().mkpath(targetDirectory)) { throw ErrorInfo(Internal::Tr::tr("Setting up Qt profile '%1' failed: " "Cannot create directory '%2'.") .arg(profile.name(), targetDirectory)); } QFile sourceFile(QLatin1String(":/templates/") + fileName); if (!sourceFile.open(QIODevice::ReadOnly)) { throw ErrorInfo(Internal::Tr::tr("Setting up Qt profile '%1' failed: " "Cannot open '%1' (%2).").arg(sourceFile.fileName(), sourceFile.errorString())); } QByteArray newContent = sourceFile.readAll(); if (module) replaceSpecialValues(&newContent, profile, *module, qtEnv); sourceFile.close(); const QString targetPath = targetDirectory + QLatin1Char('/') + fileName; allFiles->append(QFileInfo(targetPath).absoluteFilePath()); QFile targetFile(targetPath); if (targetFile.open(QIODevice::ReadOnly)) { if (newContent == targetFile.readAll()) // No need to overwrite anything in this case. return; targetFile.close(); } if (!targetFile.open(QIODevice::WriteOnly)) { throw ErrorInfo(Internal::Tr::tr("Setting up Qt profile '%1' failed: " "Cannot open '%1' (%2).").arg(targetFile.fileName(), targetFile.errorString())); } targetFile.resize(0); targetFile.write(newContent);}
开发者ID:AtlantisCD9,项目名称:Qt,代码行数:33,
示例11: getFileText bool getFileText( const std::string& filePath, std::string& outText ) { // Open the file // std::ifstream sourceFile( filePath.c_str() ); if(sourceFile.good() ) { // Read the full contents of the file into a string. (may throw.) // sourceFile.seekg( 0, std::ios::end ); outText.reserve( static_cast< size_t > ( sourceFile.tellg() )); sourceFile.seekg( 0, std::ios::beg ); outText.assign(( std::istreambuf_iterator<char>(sourceFile )), std::istreambuf_iterator<char>() ); sourceFile.close(); return true; } return false; }
开发者ID:willwood137,项目名称:WoodEngine,代码行数:25,
示例12: saveBreakPointsSourceEditor::~SourceEditor(){ saveBreakPoints(); editor = 0; if ( formWindow() ) { formWindow()->formFile()->setCodeEdited( FALSE ); formWindow()->formFile()->setEditor( 0 ); } else if ( sourceFile() ) { sourceFile()->setEditor( 0 ); if ( MainWindow::self->objectHierarchy()->sourceEditor() == this ) MainWindow::self->objectHierarchy()->setFormWindow( 0, 0 ); } iFace->release(); lIface->release(); MainWindow::self->editorClosed( this );}
开发者ID:app,项目名称:ananas-labs,代码行数:16,
示例13: copyResourceFilestatic bool copyResourceFile(const QString &sourceFileName, const QString &targetFileName, QString *errorMessage){ QFile sourceFile(sourceFileName); if (!sourceFile.exists()) { *errorMessage = QDir::toNativeSeparators(sourceFileName) + QLatin1String(" does not exist."); return false; } if (!sourceFile.copy(targetFileName)) { *errorMessage = QLatin1String("Cannot copy ") + QDir::toNativeSeparators(sourceFileName) + QLatin1String(" to ") + QDir::toNativeSeparators(targetFileName) + QLatin1String(": ") + sourceFile.errorString(); return false; } // QFile::copy() sets the permissions of the source file which are read-only for // resource files. Set write permission to enable deletion of the temporary directory. QFile targetFile(targetFileName); if (!targetFile.setPermissions(targetFile.permissions() | QFileDevice::WriteUser)) { *errorMessage = QLatin1String("Cannot set write permission on ") + QDir::toNativeSeparators(targetFileName) + QLatin1String(": ") + targetFile.errorString(); return false; } return true;}
开发者ID:OniLink,项目名称:Qt5-Rehost,代码行数:27,
示例14: sourceFileGLuint OpenGLRenderer::LoadFragShader(const std::string& vertexFile){ //Open file GLuint shaderID = 0; std::string shaderString; std::ifstream sourceFile(vertexFile.c_str()); //Source file loaded if (sourceFile) { //Get shader source shaderString.assign((std::istreambuf_iterator< char >(sourceFile)), std::istreambuf_iterator< char >()); //Create shader ID shaderID = glCreateShader(GL_FRAGMENT_SHADER); //Set shader source const GLchar* shaderSource = shaderString.c_str(); glShaderSource(shaderID, 1, (const GLchar**)&shaderSource, NULL); //Compile shader source glCompileShader(shaderID); //Check shader for errors GLint shaderCompiled = GL_FALSE; glGetShaderiv(shaderID, GL_COMPILE_STATUS, &shaderCompiled); if (shaderCompiled != GL_TRUE) { printf("Unable to compile shader %d!/n/nSource:/n%s/n", shaderID, shaderSource); glDeleteShader(shaderID); shaderID = 0; } } return shaderID;}
开发者ID:KumaKing,项目名称:Sem5GameEngine,代码行数:34,
示例15: sourceFilebool UpdateClient::copyFile(const QString &srcDir, const QString &destDir, const QString &srcFileName, const QString &destFileName){ QFileInfo sourceFile(QDir::cleanPath(srcDir + QDir::separator() + srcFileName)); QFileInfo destFile(QDir::cleanPath(destDir + QDir::separator() + destFileName)); //if source file doesn't exists if (!QFile::exists(sourceFile.filePath())) { return false; } // check if dest directory not exists if (!QDir(QDir::cleanPath(destFile.absolutePath())).exists()) { // try to create dest dir if (!QDir(QDir::rootPath()).mkpath(destFile.absolutePath())) return false; } // if dest file exists if (QFile::exists(destFile.filePath())) { // remove it (analog rewrite functionality) QFile::remove(destFile.filePath()); } return QFile::copy(sourceFile.filePath(), destFile.filePath());}
开发者ID:GlPortal,项目名称:Updater,代码行数:28,
示例16: sourceFilevoid PHPCodeCompletion::GetMembers(IEditor* editor, PHPEntityBase::List_t& members, wxString& scope){ members.clear(); scope.clear(); if(!editor) { return; } // Parse until the current position to get the current scope name { wxString text = editor->GetTextRange(0, editor->GetCurrentPosition()); PHPSourceFile sourceFile(text); sourceFile.SetParseFunctionBody(true); sourceFile.SetFilename(editor->GetFileName()); sourceFile.Parse(); const PHPEntityClass* scopeAtPoint = sourceFile.Class()->Cast<PHPEntityClass>(); if(!scopeAtPoint) { return; } scope = scopeAtPoint->GetFullName(); } // Second parse: parse the entire buffer so we are not limited by the caret position wxString text = editor->GetTextRange(0, editor->GetLength()); PHPSourceFile sourceFile(text); sourceFile.SetParseFunctionBody(true); sourceFile.SetFilename(editor->GetFileName()); sourceFile.Parse(); // Locate the scope PHPEntityBase::Ptr_t parentClass = sourceFile.Namespace()->FindChild(scope); if(!parentClass) return; // filter out const PHPEntityBase::List_t& children = parentClass->GetChildren(); PHPEntityBase::List_t::const_iterator iter = children.begin(); for(; iter != children.end(); ++iter) { PHPEntityBase::Ptr_t child = *iter; if(child->Is(kEntityTypeVariable) && child->Cast<PHPEntityVariable>()->IsMember() && !child->Cast<PHPEntityVariable>()->IsConst() && !child->Cast<PHPEntityVariable>()->IsStatic()) { // a member of a class members.push_back(child); } }}
开发者ID:anatooly,项目名称:codelite,代码行数:47,
示例17: sourceFilebool CWizZiwReader::encryptDataToTempFile(const QString& sourceFileName, / const QString& destFileName, / const QString& strZiwCipher){ QFile sourceFile(sourceFileName); if (!sourceFile.open(QIODevice::ReadOnly)) { TOLOG("Can't open source file while encrypt to temp file"); return false; } // encrypt data QByteArray inBytes(sourceFile.readAll()); QByteArray outBytes; if (!WizAESEncryptToString((const unsigned char *)(strZiwCipher.toUtf8().constData()), inBytes, outBytes)) { return false; } // encrypt ziw cipher QByteArray encryptedZiwCipher; if (!encryptZiwCipher(strZiwCipher.toUtf8(), encryptedZiwCipher)) { return false; } // compose file // FIXME: hard coded here. WIZZIWHEADER header; memset(&header, 0, sizeof(header)); header.szSign[0] = 'Z'; header.szSign[1] = 'I'; header.szSign[2] = 'W'; header.szSign[3] = 'R'; header.nVersion = 1; header.nKeyLength = WIZZIWFILE_KEY_LENGTH; memcpy(header.szEncryptedKey, encryptedZiwCipher.constData(), sizeof(header.szEncryptedKey)); QFile destFile(destFileName); if (!destFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) { TOLOG("Can't open dest file while encrypt to temp file"); return false; } QDataStream out(&destFile); if (sizeof(header) != out.writeRawData((const char *)&header, sizeof(header))) { TOLOG("Write data failed while encrypt to temp file"); destFile.remove(); return false; } if (outBytes.length() != out.writeRawData(outBytes.constData(), outBytes.length())) { TOLOG("Write data failed while encrypt to temp file"); destFile.remove(); return false; } destFile.close(); sourceFile.close(); return true;}
开发者ID:qqshow,项目名称:WizQTClient,代码行数:59,
示例18: generateCodeQString generateCode(const QString &fileName, int indentation, bool closeEnum){ QFile sourceFile(fileName); if (!sourceFile.open(QIODevice::ReadWrite)) { return QString(); } QTextStream input(&sourceFile); QString result; QString indentationStr(indentation, QChar(' ')); int currentLine = 0; while (!input.atEnd()) { QString line = input.readLine(); ++currentLine; if (line.simplified().isEmpty() || (line.startsWith(QLatin1String("---")) && line.endsWith(QLatin1String("---")))) { continue; } int hashIndex = line.indexOf(QChar('#')); if ((hashIndex < 1) || (hashIndex + 1 > line.length())) { printf("Bad string: %s (%s:%d)/n", line.toLocal8Bit().constData(), fileName.toLocal8Bit().constData(), currentLine); return QString(); } QString name = line.left(hashIndex); name[0] = name.at(0).toUpper(); int separatorIndex = 0; while ((separatorIndex = indexOfSeparator(name, separatorIndex)) > 0) { if ((name.length() < separatorIndex + 1) || (!name.at(separatorIndex + 1).isLetter())) { printf("Bad name: %s (%s:%d)/n", name.toLocal8Bit().constData(), fileName.toLocal8Bit().constData(), currentLine); return QString(); } name[separatorIndex + 1] = name.at(separatorIndex + 1).toUpper(); name.remove(separatorIndex, 1); } QString value = line.mid(hashIndex + 1, hashMaxLength); int endOfValue = value.indexOf(QChar(' ')); if (endOfValue > 0) { value.truncate(endOfValue); } result.append(indentationStr); if (!closeEnum || !input.atEnd()) { result.append(QString("%1 = 0x%2,/n").arg(name).arg(value)); } else { result.append(QString("%1 = 0x%2/n").arg(name).arg(value)); } } return result;}
开发者ID:biddyweb,项目名称:telegram-qt,代码行数:59,
示例19: QStringLiteralvoid QgsHtmlAnnotation::writeXml( QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context ) const{ QDomElement formAnnotationElem = doc.createElement( QStringLiteral( "HtmlAnnotationItem" ) ); formAnnotationElem.setAttribute( QStringLiteral( "htmlfile" ), sourceFile() ); _writeXml( formAnnotationElem, doc, context ); elem.appendChild( formAnnotationElem );}
开发者ID:AlisterH,项目名称:Quantum-GIS,代码行数:8,
示例20: sourceFileParser::Parser(string fileName){ ifstream sourceFile(fileName); source.assign(std::istreambuf_iterator<char>(sourceFile), std::istreambuf_iterator<char>() ); //get source}
开发者ID:NeuroProc,项目名称:work-qt,代码行数:8,
示例21: foreachvoid CustomDirManager::import(QStringList &files, bool local){ QString targetDir = (local ? dirCustom : dirEpisode); targetDir = (!targetDir.endsWith("/") ? targetDir.append('/') : targetDir); foreach (QString targetFile, files) { QFile sourceFile(targetFile); sourceFile.copy(targetDir + targetFile.section("/", -1)); }
开发者ID:hacheipe399,项目名称:PlatGEnWohl,代码行数:8,
示例22: process_filevoid process_file(std::string const & filename){ static std::map<std::string, bool> filenameLoaded; if (filename.empty()) return; if (filenameLoaded[filename]) return; filenameLoaded[filename] = true; std::ifstream sourceFile(filename.c_str()); if (!sourceFile) { for (size_t index = 0; index < option_include.size(); ++index) { sourceFile.close(); sourceFile.clear(); sourceFile.open((option_include[index] + filename).c_str()); if (sourceFile) break; } if (!sourceFile) { std::cerr << "file not found:" << filename << '/n'; return; } } std::string idstring; std::getline(sourceFile, idstring); sourceFile.seekg(0); if (idstring == "//DDL") { SourceStream ss(sourceFile); process_stream<SourceTokenDDL>(ss, filename); } else if (idstring == "//DHLX") { SourceStream ss(sourceFile, SourceStream::ST_DHLX); process_stream<SourceTokenDHLX>(ss, filename); } else { SourceStream ss(sourceFile); process_stream<SourceTokenDDL>(ss, filename); } sourceFile.close();}
开发者ID:DavidPH,项目名称:DH-dlc,代码行数:58,
示例23: cpstatic int cp(const char *sourceFileName, const char *targetFileName){ QFile sourceFile(QString::fromLocal8Bit(sourceFileName)); if (!sourceFile.copy(QString::fromLocal8Bit(targetFileName))) { qWarning().nospace() << sourceFile.errorString(); return -1; } return 0;}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:9,
示例24: sourceFilePHPSetterGetterEntry::Vec_t PHPRefactoring::GetGetters(IEditor* editor) const{ PHPSetterGetterEntry::Vec_t getters, candidates; if(!editor) { return getters; } // Parse until the current position wxString text = editor->GetTextRange(0, editor->GetCurrentPosition()); PHPSourceFile sourceFile(text); sourceFile.SetParseFunctionBody(true); sourceFile.SetFilename(editor->GetFileName()); sourceFile.Parse(); const PHPEntityClass* scopeAtPoint = sourceFile.Class()->Cast<PHPEntityClass>(); if(!scopeAtPoint) { return getters; } // filter out const PHPEntityBase::List_t& children = scopeAtPoint->GetChildren(); PHPEntityBase::List_t::const_iterator iter = children.begin(); PHPEntityBase::List_t members, functions; for(; iter != children.end(); ++iter) { PHPEntityBase::Ptr_t child = *iter; if(child->Is(kEntityTypeFunction)) { functions.push_back(child); } else if(child->Is(kEntityTypeVariable) && child->Cast<PHPEntityVariable>()->IsMember() && !child->Cast<PHPEntityVariable>()->IsConst() && !child->Cast<PHPEntityVariable>()->IsStatic()) { // a member of a class members.push_back(child); } } if(members.empty()) { return getters; } // Prepare list of candidates PHPEntityBase::List_t::iterator membersIter = members.begin(); for(; membersIter != members.end(); ++membersIter) { PHPSetterGetterEntry candidate(*membersIter); // make sure we don't add setters that already exist if(FindByName(functions, candidate.GetGetter(kSG_NameOnly))) { continue; } candidates.push_back(candidate); } getters.swap(candidates); return getters;}
开发者ID:LoviPanda,项目名称:codelite,代码行数:54,
示例25: sourceInfoQString SyncProcess::updateEntry(const QString & path, const QDir & source, const QDir & destination){ QFileInfo sourceInfo(path); QString relativePath = source.relativeFilePath(path); QString destinationPath = destination.absoluteFilePath(relativePath); QFileInfo destinationInfo(destinationPath); if (sourceInfo.isDir()) { if (!destinationInfo.exists()) { progress->addText(tr("Create directory %1/n").arg(destinationPath)); if (!destination.mkdir(relativePath)) { return QObject::tr("Create '%1' failed").arg(destinationPath); } } } else { if (!destinationInfo.exists()) { // qDebug() << "Copy" << path << "to" << destinationPath; progress->addText(tr("Copy %1 to %2").arg(path).arg(destinationPath) + "/n"); if (!QFile::copy(path, destinationPath)) { return QObject::tr("Copy '%1' to '%2' failed").arg(path).arg(destinationPath); } } else if (sourceInfo.lastModified() > destinationInfo.lastModified()) { // retrieve source contents QFile sourceFile(path); if (!sourceFile.open(QFile::ReadOnly)) { return QObject::tr("Open '%1' failed").arg(path); } QByteArray sourceContents = sourceFile.readAll(); sourceFile.close(); // retrieve destination contents QFile destinationFile(destinationPath); if (!destinationFile.open(QFile::ReadOnly)) { return QObject::tr("Open '%1' failed").arg(destinationPath); } QByteArray destinationContents = destinationFile.readAll(); destinationFile.close(); if (contentsDifferent(sourceContents, destinationContents)) { // copy contents if (!destinationFile.open(QFile::WriteOnly | QIODevice::Truncate)) { return QObject::tr("Write '%1' failed").arg(destinationPath); } progress->addText(tr("Write %1").arg(destinationPath) + "/n"); // qDebug() << "Write" << destinationPath; destinationFile.write(sourceContents); destinationFile.close(); } } } return QString();}
开发者ID:BenZoFly,项目名称:opentx,代码行数:53,
示例26: shouldTargetFileBeUpdatedbool shouldTargetFileBeUpdated(const std::string & sourceFileName, const std::string & targetFileName){ Poco::File targetFile(targetFileName); if(! targetFile.exists()) { return true; } Poco::File sourceFile(sourceFileName); return sourceFile.getLastModified() >= targetFile.getLastModified();}
开发者ID:Remscar,项目名称:cpgf,代码行数:12,
注:本文中的sourceFile函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ sourceModel函数代码示例 C++ sourceChanged函数代码示例 |