void TranslationUnits::updateTranslationUnit(const FileContainer &fileContainer) { const auto translationUnits = findAllTranslationUnitWithFilePath(fileContainer.filePath()); for (auto translationUnit : translationUnits) translationUnit.setDocumentRevision(fileContainer.documentRevision()); }
void ConfigurationChecker::body(Directory & parameter) { FileContainer * container; bool result = true; /* より優先度の高いエラーも対象に */ current_level = static_cast<enum tagCheckLevel>(static_cast<int>(current_level) * 2 - 1); container = FileContainer::getInstance(); container->attachInfo(parameter["/file/checkerscript"].toString()); container->attachModule(parameter["/file/loadmodule"].toString()); if(VerboseMessage::getVerbose()) { cout << Message(" Target architecture : "," ターゲットアーキテクチャ : ") << container->getArchitecture() << endl; } error_count = 0; result &= check_taskblock(parameter,container); result &= check_semaphoreblock(parameter,container); result &= check_eventflagblock(parameter,container); result &= check_dataqueueblock(parameter,container); result &= check_mailboxblock(parameter,container); result &= check_fixed_memorypoolblock(parameter,container); result &= check_cyclic_handlerblock(parameter,container); result &= check_interrupt_handlerblock(parameter,container); result &= check_exception_handlerblock(parameter,container); if(!result) ExceptionMessage("Total % errors found in current configuration.\n","全部で%個のエラーが検出されました\n") << error_count << throwException; VerboseMessage("No error found in current configuration\n","構成に異常はありませんでした\n"); }
std::vector<Document> Documents::updateDocument(const FileContainer &fileContainer) { const auto documents = findAllDocumentsWithFilePath(fileContainer.filePath()); for (auto document : documents) document.setDocumentRevision(fileContainer.documentRevision()); return documents; }
void TranslationUnits::createOrUpdateTranslationUnit(const FileContainer &fileContainer) { TranslationUnit::FileExistsCheck checkIfFileExists = fileContainer.hasUnsavedFileContent() ? TranslationUnit::DoNotCheckIfFileExists : TranslationUnit::CheckIfFileExists; auto findIterator = findTranslationUnit(fileContainer); if (findIterator == translationUnits_.end()) translationUnits_.push_back(TranslationUnit(fileContainer.filePath(), unsavedFiles, projects.project(fileContainer.projectPartId()), checkIfFileExists)); }
Document Documents::createDocument(const FileContainer &fileContainer) { Document::FileExistsCheck checkIfFileExists = fileContainer.hasUnsavedFileContent() ? Document::DoNotCheckIfFileExists : Document::CheckIfFileExists; documents_.emplace_back(fileContainer.filePath(), projectParts.project(fileContainer.projectPartId()), fileContainer.fileArguments(), *this, checkIfFileExists); documents_.back().setDocumentRevision(fileContainer.documentRevision()); return documents_.back(); }
void Documents::removeDocuments(const QVector<FileContainer> &fileContainers) { QVector<FileContainer> processedFileContainers = fileContainers; auto removeBeginIterator = std::remove_if(documents_.begin(), documents_.end(), [&processedFileContainers] (const Document &document) { return removeFromFileContainer(processedFileContainers, document); }); documents_.erase(removeBeginIterator, documents_.end()); if (!processedFileContainers.isEmpty()) { const FileContainer fileContainer = processedFileContainers.first(); throw DocumentDoesNotExistException(fileContainer.filePath(), fileContainer.projectPartId()); } }
void PrintTo(const FileContainer &container, ::std::ostream* os) { *os << "FileContainer(" << container.filePath().constData() << ", " << container.projectPartId().constData() << ", " << container.fileArguments().constData() << ", " << container.documentRevision(); if (container.hasUnsavedFileContent()) *os << ", " << container.unsavedFileContent().constData(); *os << ")"; }
QDebug operator<<(QDebug debug, const FileContainer &container) { debug.nospace() << "FileContainer(" << container.filePath() << ", " << container.projectPartId() << ", " << container.fileArguments() << ", " << container.documentRevision(); if (container.hasUnsavedFileContent()) { const Utf8String fileWithContent = debugWriteFileForInspection( container.unsavedFileContent(), debugId(container)); debug.nospace() << ", " << "<" << fileWithContent << ">"; } debug.nospace() << ")"; return debug; }
bool operator==(const FileContainer &fileContainer, const Document &document) { return fileContainer.filePath() == document.filePath() && fileContainer.projectPartId() == document.projectPartId(); }
bool operator==(const FileContainer &fileContainer, const TranslationUnit &translationUnit) { return fileContainer.filePath() == translationUnit.filePath() && fileContainer.projectPartId() == translationUnit.projectPartId(); }
void TextureCooker::process( Vector<VirtFS::VirtDesc>& files, TerminalCursor& cursor) { using FileElement = Pair<CString, ImageProcessor>; using FileContainer = Vector<FileElement>; FileContainer targets; for(auto& desc : files) { auto path = Path(desc.filename); for(auto ext : imageExtensions) /* Check if we recognize the extension */ if(libc::str::cmp<libc::str::comp_nocase>( path.extension().c_str(), ext.c_str())) { if(ext == "") continue; #if defined(HAVE_LIBTIFF) else if(ext == "TIFF" || ext == "TIF") targets.push_back({desc.filename, ImageProc_tiff}); #endif else targets.push_back({desc.filename, ImageProc_stb}); continue; } } /* Set default texture sizes, for the cases where nothing is specified. * There is also a program-defined default to fallback to. */ if(Env::ExistsVar(TEX_MAX_SIZE)) max_texture_size = cast_string<i32>(Env::GetVar(TEX_MAX_SIZE)); if(Env::ExistsVar(TEX_MIN_SIZE)) min_texture_size = cast_string<i32>(Env::GetVar(TEX_MIN_SIZE)); cursor.progress( TEXCOMPRESS_API "Compressable textures found: {0}", targets.size()); Map<ThreadId::Hash, Vector<VirtFS::VirtDesc>> threadFiles; /* Each thread works on a texture and its mipmaps. */ threads::Parallel::ForEach( targets, static_cast<Function<void(FileElement&)>>([&](FileElement& e) { CompressTextureSet(threadFiles[ThreadId().hash()], e, this, cursor); }), this->numWorkers); for(auto& thread : threadFiles) { files.reserve(files.size() + thread.second.size()); for(auto& file : thread.second) files.push_back(std::move(file)); } #if defined(HAVE_LIBTIFF) auto removePred = [&](VirtFS::VirtDesc const& desc) { for(auto const& e : targets) if(e.first == desc.filename) return true; return false; }; auto removeIt = std::remove_if(files.begin(), files.end(), removePred); for(auto it = removeIt; it != files.end(); it++) it->data = Bytes(); files.erase(removeIt, files.end()); #endif }