void on_piece_pass(int) { // if we became a seed, copy the metadata from // the torrent before it is deallocated if (m_torrent.is_seed()) metadata(); }
AsyncResultsMerger::AsyncResultsMerger(executor::TaskExecutor* executor, ClusterClientCursorParams&& params) : _executor(executor), _params(std::move(params)), _mergeQueue(MergingComparator(_remotes, _params.sort)) { for (const auto& remote : _params.remotes) { if (remote.shardId) { invariant(remote.cmdObj); invariant(!remote.cursorId); invariant(!remote.hostAndPort); _remotes.emplace_back(*remote.shardId, *remote.cmdObj); } else { invariant(!remote.cmdObj); invariant(remote.cursorId); invariant(remote.hostAndPort); _remotes.emplace_back(*remote.hostAndPort, *remote.cursorId); } } // Initialize command metadata to handle the read preference. if (_params.readPreference) { BSONObjBuilder metadataBuilder; rpc::ServerSelectionMetadata metadata( _params.readPreference->pref != ReadPreference::PrimaryOnly, boost::none); uassertStatusOK(metadata.writeToMetadata(&metadataBuilder)); _metadataObj = metadataBuilder.obj(); } }
QString Kicad2Svg::makeMetadata(const QString & filename, const QString & type, const QString & name) { QFileInfo fileInfo(filename); QDateTime now = QDateTime::currentDateTime(); QString dt = now.toString("dd/MM/yyyy hh:mm:ss"); m_title = QString("<title>%1</title>\n").arg(fileInfo.fileName()); m_description = QString("<desc>Kicad %3 '%2' from file '%1' converted by Fritzing</desc>\n") .arg(TextUtils::stripNonValidXMLCharacters(TextUtils::escapeAnd(fileInfo.fileName()))) .arg(TextUtils::stripNonValidXMLCharacters(TextUtils::escapeAnd(name))) .arg(type); QString metadata("<metadata xmlns:fz='http://fritzing.org/kicadmetadata/1.0/' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>\n"); metadata += "<rdf:RDF>"; metadata += "<rdf:Description rdf:about=''>\n"; metadata += m_attribute.arg("kicad filename").arg(fileInfo.fileName()); metadata += m_attribute.arg(QString("kicad %1").arg(type)) .arg(TextUtils::stripNonValidXMLCharacters(TextUtils::escapeAnd(name))); metadata += m_attribute.arg("fritzing version").arg(Version::versionString()); metadata += m_attribute.arg("conversion date").arg(dt); metadata += m_attribute.arg("dist-license").arg("GPL"); metadata += m_attribute.arg("use-license").arg("unlimited"); metadata += m_attribute.arg("author").arg("KICAD project"); metadata += m_attribute.arg("license-url").arg("http://www.gnu.org/licenses/gpl.html"); return metadata; }
static int ptfs_init( const char * path ) { DIR * rdiffdir; struct dirent * ent; mounttime = time(0); root_atime = mounttime; sprintf( rdiffpath, "%s/rdiff-backup-data/", path ); /* strlen("katalog=") == 8 */ if ( ( rdiffdir = opendir( rdiffpath ) ) == NULL ) { fprintf( stderr, "BLAD: Brak dostepu do %s!\n", rdiffpath ); return 1; } while ( ( ent = readdir( rdiffdir ) ) != NULL ) if ( !strncmp( ent->d_name, "mirror_metadata.", 16 ) ) if ( metadata( ent->d_name ) ) return 1; /* To sortowanie jest tylko na wszelki wypadek, gdyby sie okazalo, ze sesje zostaly wczytane w nieodpowiedniej kolejnosci */ ssort( sessions, sessCounter ); if ( sessCounter == 0 ) { fprintf( stderr, "BLAD: katalog rdiff-backup-data nie ma zapisnej zadnej sesji!\n" ); return 1; } strncpy( link_current + strlen(link_current), sessions[sessCounter-1].nm + 1, BUFLEN - strlen(link_current) ); link_curr_atime = sessions[sessCounter-1].st.time; if ( sessCounter > 1 ) { strncpy( link_previous + strlen(link_previous), sessions[sessCounter-2].nm + 1, BUFLEN - strlen(link_previous) ); link_prev_atime = sessions[sessCounter-2].st.time; } return 0; }
void LookAlikeMainPrivate::saveMetadataRegionList(QString &fileName, QuillMetadataRegionList ®ionList) { QuillMetadata metadata(fileName, QuillMetadata::XmpFormat); QVariant variant; variant.setValue(regionList); metadata.setEntry(QuillMetadata::Tag_Regions, variant); metadata.write(fileName, QuillMetadata::XmpFormat); }
void ArtworkMetadataTests::clearKeywordsMarksAsModifiedTest() { Mocks::ArtworkMetadataMock metadata("file.jpg"); metadata.appendKeywords(QStringList() << "keyword1" << "keyword2"); metadata.resetModified(); metadata.clearKeywords(); QVERIFY(metadata.isModified()); }
ProcessModel::ProcessModel( const TimeValue& duration, const Id<Process::ProcessModel>& id, QObject* parent): Process::ProcessModel{duration, id, Metadata<ObjectKey_k, ProcessModel>::get(), parent} { metadata().setInstanceName(*this); }
PDU::metadata EAPOL::extract_metadata(const uint8_t *buffer, uint32_t total_sz) { if (TINS_UNLIKELY(total_sz < sizeof(eapol_header))) { throw malformed_packet(); } const eapol_header* header = (const eapol_header*)buffer; uint32_t advertised_size = Endian::be_to_host<uint16_t>(header->length) + 4; return metadata(min(total_sz, advertised_size), pdu_flag, PDU::UNKNOWN); }
int LoadFilter::readOrientation() const { if (priv->ignoreExifOrientation) return 0; QuillMetadata metadata(priv->fileName, QuillMetadata::ExifFormat, QuillMetadata::Tag_Orientation); return metadata.entry(QuillMetadata::Tag_Orientation).toInt(); }
IDBDatabaseMetadata IDBDatabaseBackendImpl::metadata() const { // FIXME: Figure out a way to keep m_metadata.objectStores.get(N).indexes up to date rather than regenerating this every time. IDBDatabaseMetadata metadata(m_metadata); for (ObjectStoreMap::const_iterator it = m_objectStores.begin(); it != m_objectStores.end(); ++it) metadata.objectStores.set(it->value->id(), it->value->metadata()); return metadata; }
void TextReader::sendMessage(const QByteArray &data) { QVariantMap m; m[BaseSlots::TEXT_SLOT().getId()] = QString(data); m[BaseSlots::URL_SLOT().getId()] = url; m[BaseSlots::DATASET_SLOT().getId()] = urls->getLastDatasetName(); MessageMetadata metadata(url, urls->getLastDatasetName()); context->getMetadataStorage().put(metadata); ch->put(Message(mtype, m, metadata.getId())); }
void FileFS::create_subfolders(const std::string &loc) { bfs::path data("data"); bfs::path metadata("metadata"); bfs::path p; p = bfs::canonical(loc); data_dir = Directory(p / data, mode); metadata_dir = Directory(p / metadata, mode); }
PassRefPtr<IDBIndex> IDBObjectStore::createIndex(ScriptExecutionContext* context, const String& name, const IDBKeyPath& keyPath, bool unique, bool multiEntry, ExceptionCode& ec) { IDB_TRACE("IDBObjectStore::createIndex"); if (!m_transaction->isVersionChange() || isDeleted()) { ec = IDBDatabaseException::InvalidStateError; return 0; } if (!m_transaction->isActive()) { ec = IDBDatabaseException::TransactionInactiveError; return 0; } if (!keyPath.isValid()) { ec = IDBDatabaseException::SyntaxError; return 0; } if (name.isNull()) { ec = TypeError; return 0; } if (containsIndex(name)) { ec = IDBDatabaseException::ConstraintError; return 0; } if (keyPath.type() == IDBKeyPath::ArrayType && multiEntry) { ec = IDBDatabaseException::InvalidAccessError; return 0; } int64_t indexId = m_metadata.maxIndexId + 1; backendDB()->createIndex(m_transaction->id(), id(), indexId, name, keyPath, unique, multiEntry); ++m_metadata.maxIndexId; IDBIndexMetadata metadata(name, indexId, keyPath, unique, multiEntry); RefPtr<IDBIndex> index = IDBIndex::create(metadata, this, m_transaction.get()); m_indexMap.set(name, index); m_metadata.indexes.set(indexId, metadata); m_transaction->db()->indexCreated(id(), metadata); ASSERT(!ec); if (ec) return 0; RefPtr<IDBRequest> indexRequest = openCursor(context, static_cast<IDBKeyRange*>(0), IDBCursor::directionNext(), IDBDatabaseBackendInterface::PreemptiveTask, ec); ASSERT(!ec); if (ec) return 0; indexRequest->preventPropagation(); // This is kept alive by being the success handler of the request, which is in turn kept alive by the owning transaction. RefPtr<IndexPopulator> indexPopulator = IndexPopulator::create(backendDB(), m_transaction->id(), id(), metadata); indexRequest->setOnsuccess(indexPopulator); return index.release(); }
FindEntryResult RamFileSystem::find_entry(uint32_t folder_id, const std::string &name) { Entry *entry = nullptr; if (folder_id == ROOT_ID) { if (name.empty()) { return FindEntryResult(ROOT_ID, SUCCESS, this, _root->metadata()); } auto status = _root->find_entry(name, &entry); if (status != SUCCESS) { return FindEntryResult(NULL_ID, status, this); } } else { auto find = _entry_index.find(folder_id); if (find == _entry_index.end()) { return FindEntryResult(NULL_ID, ENTRY_NOT_FOUND, this); } auto parent_folder = dynamic_cast<Folder *>(find->second.get()); if (parent_folder == nullptr) { return FindEntryResult(NULL_ID, INTERNAL_ERROR, this); } auto status = parent_folder->find_entry(name, &entry); if (status != SUCCESS) { return FindEntryResult(NULL_ID, status, this); } } if (entry->metadata().type() == MOUNT_POINT_ENTRY) { auto mount_point = dynamic_cast<MountPoint *>(entry); if (mount_point != nullptr) { // Mount points always mount the root folder. return FindEntryResult(ROOT_ID, SUCCESS, mount_point->fs(), mount_point->metadata()); } } if (entry->metadata().type() == SYMLINK_ENTRY) { auto link = dynamic_cast<Symlink *>(entry); if (link != nullptr) { return FindEntryResult(entry->id(), SUCCESS, this, entry->metadata()); } } return FindEntryResult(entry->id(), SUCCESS, this, entry->metadata()); }
ProcessModel::ProcessModel( const TimeValue& duration, const Id<Process::ProcessModel>& id, QObject* parent): Process::ProcessModel{duration, id, Metadata<ObjectKey_k, ProcessModel>::get(), parent} { // TODO connect the removing() signal of the process to here. init(); metadata().setInstanceName(*this); }
tws::wcs::capabilities_t tws::wcs::wcs_manager::capabilities() { capabilities_t capabilities; capabilities.identification = identification(); capabilities.provider = provider(); capabilities.metadata = metadata(); return capabilities; }
void ArtworkMetadataTests::modifiedIsNotMarkedModifiedAgainTest() { Mocks::ArtworkMetadataMock metadata("file.jpg"); metadata.markModified(); QSignalSpy modifiedSpy(&metadata, SIGNAL(modifiedChanged(bool))); metadata.markModified(); QCOMPARE(modifiedSpy.count(), 0); }
PassRefPtr<IDBObjectStore> IDBDatabase::createObjectStore(const String& name, const Dictionary& options, ExceptionCode& ec) { if (!m_versionChangeTransaction) { ec = IDBDatabaseException::IDB_INVALID_STATE_ERR; return 0; } if (!m_versionChangeTransaction->isActive()) { ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; return 0; } IDBKeyPath keyPath; if (!options.isUndefinedOrNull()) { String keyPathString; Vector<String> keyPathArray; if (options.get("keyPath", keyPathArray)) keyPath = IDBKeyPath(keyPathArray); else if (options.getWithUndefinedOrNullCheck("keyPath", keyPathString)) keyPath = IDBKeyPath(keyPathString); } if (containsObjectStore(name)) { ec = IDBDatabaseException::CONSTRAINT_ERR; return 0; } if (!keyPath.isNull() && !keyPath.isValid()) { ec = IDBDatabaseException::IDB_SYNTAX_ERR; return 0; } bool autoIncrement = false; if (!options.isUndefinedOrNull()) options.get("autoIncrement", autoIncrement); if (autoIncrement && ((keyPath.type() == IDBKeyPath::StringType && keyPath.string().isEmpty()) || keyPath.type() == IDBKeyPath::ArrayType)) { ec = IDBDatabaseException::IDB_INVALID_ACCESS_ERR; return 0; } int64_t objectStoreId = m_metadata.maxObjectStoreId + 1; RefPtr<IDBObjectStoreBackendInterface> objectStoreBackend = m_backend->createObjectStore(objectStoreId, name, keyPath, autoIncrement, m_versionChangeTransaction->backend(), ec); if (!objectStoreBackend) { ASSERT(ec); return 0; } IDBObjectStoreMetadata metadata(name, objectStoreId, keyPath, autoIncrement, IDBObjectStoreBackendInterface::MinimumIndexId); RefPtr<IDBObjectStore> objectStore = IDBObjectStore::create(metadata, objectStoreBackend.release(), m_versionChangeTransaction.get()); m_metadata.objectStores.set(metadata.id, metadata); ++m_metadata.maxObjectStoreId; m_versionChangeTransaction->objectStoreCreated(name, objectStore); return objectStore.release(); }
void ArtworkMetadataTests::removeLastKeywordFromEmptyTest() { Mocks::ArtworkMetadataMock metadata("file.jpg"); QSignalSpy modifiedSpy(&metadata, SIGNAL(modifiedChanged(bool))); QSignalSpy removedSpy(metadata.getKeywordsModel(), SIGNAL(rowsRemoved(QModelIndex,int,int))); bool removed = metadata.removeLastKeyword(); QCOMPARE(removed, false); QCOMPARE(modifiedSpy.count(), 0); QCOMPARE(removedSpy.count(), 0); }
mydsp_wrap() { // Creates paths buildUserInterface(this); // Creates JSON JSONUI builder(getNumInputs(), getNumOutputs()); metadata(&builder); buildUserInterface(&builder); fJSON = builder.JSON(); }
SFB::Audio::Metadata::unique_ptr SFB::Audio::Metadata::CreateMetadataForURL(CFURLRef url, CFErrorRef *error) { if(nullptr == url) return nullptr; // If this is a file URL, use the extension-based resolvers SFB::CFString scheme = CFURLCopyScheme(url); // If there is no scheme the URL is invalid if(!scheme) { if(error) *error = CFErrorCreate(kCFAllocatorDefault, kCFErrorDomainPOSIX, EINVAL, nullptr); return nullptr; } if(kCFCompareEqualTo == CFStringCompare(CFSTR("file"), scheme, kCFCompareCaseInsensitive)) { // Verify the file exists SInt32 errorCode = noErr; SFB::CFBoolean fileExists = (CFBooleanRef)CFURLCreatePropertyFromResource(kCFAllocatorDefault, url, kCFURLFileExists, &errorCode); if(fileExists) { if(CFBooleanGetValue(fileExists)) { SFB::CFString pathExtension = CFURLCopyPathExtension(url); if(pathExtension) { // Some extensions (.oga for example) support multiple audio codecs (Vorbis, FLAC, Speex) for(auto subclassInfo : sRegisteredSubclasses) { if(subclassInfo.mHandlesFilesWithExtension(pathExtension)) { unique_ptr metadata(subclassInfo.mCreateMetadata(url)); if(metadata->ReadMetadata(error)) return metadata; } } } } else { LOGGER_WARNING("org.sbooth.AudioEngine.Metadata", "The requested URL doesn't exist"); if(error) { SFB::CFString description = CFCopyLocalizedString(CFSTR("The file “%@” does not exist."), ""); SFB::CFString failureReason = CFCopyLocalizedString(CFSTR("File not found"), ""); SFB::CFString recoverySuggestion = CFCopyLocalizedString(CFSTR("The file may exist on removable media or may have been deleted."), ""); *error = CreateErrorForURL(Metadata::ErrorDomain, Metadata::InputOutputError, description, url, failureReason, recoverySuggestion); } } } else LOGGER_WARNING("org.sbooth.AudioEngine.Metadata", "CFURLCreatePropertyFromResource failed: " << errorCode); } return nullptr; }
pplx::task<void> cloud_queue::upload_metadata_async(const queue_request_options& options, operation_context context) { queue_request_options modified_options = get_modified_options(options); storage_uri uri = protocol::generate_queue_uri(service_client(), *this); std::shared_ptr<core::storage_command<void>> command = std::make_shared<core::storage_command<void>>(uri); command->set_build_request(std::bind(protocol::upload_queue_metadata, metadata(), std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); command->set_authentication_handler(service_client().authentication_handler()); command->set_preprocess_response(std::bind(protocol::preprocess_response_void, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); return core::executor<void>::execute_async(command, modified_options, context); }
void blob_service_test_base_with_objects_to_delete::create_containers(const utility::string_t& prefix, std::size_t num) { for (std::size_t i = 0; i < num; ++i) { auto index = utility::conversions::print_string(i); auto container = m_client.get_container_reference(prefix + index); m_containers_to_delete.push_back(container); container.metadata()[U("index")] = index; container.create(azure::storage::blob_container_public_access_type::off, azure::storage::blob_request_options(), m_context); } }
void ArtworkMetadataTests::markModifiedShouldEmitSignalTest() { Mocks::ArtworkMetadataMock metadata("file.jpg"); QSignalSpy modifiedSpy(&metadata, SIGNAL(modifiedChanged(bool))); metadata.markModified(); QCOMPARE(modifiedSpy.count(), 1); QList<QVariant> modifyArguments = modifiedSpy.takeFirst(); QCOMPARE(modifyArguments.at(0).toBool(), true); }
void ArtworkMetadataTests::misEditOfKeywordDoesNothingTest() { Mocks::ArtworkMetadataMock metadata("file.jpg"); metadata.appendKeywords(QStringList() << "keyword1" << "keyword2"); QSignalSpy modifiedSpy(&metadata, SIGNAL(modifiedChanged(bool))); bool editResult = metadata.editKeyword(2, "keyword2"); QCOMPARE(editResult, false); QCOMPARE(modifiedSpy.count(), 0); }
void ArtworkMetadataTests::setTitleEmitsModifiedTest() { Mocks::ArtworkMetadataMock metadata("file.jpg"); QSignalSpy modifiedSpy(&metadata, SIGNAL(modifiedChanged(bool))); metadata.setTitle("Not empty value"); QCOMPARE(modifiedSpy.count(), 1); QList<QVariant> modifyArguments = modifiedSpy.takeFirst(); QCOMPARE(modifyArguments.at(0).toBool(), true); }
Status LogicalTimeMetadataHook::writeRequestMetadata(OperationContext* opCtx, BSONObjBuilder* metadataBob) { auto validator = LogicalTimeValidator::get(_service); if (!validator || !LogicalClock::get(_service)->isEnabled()) { return Status::OK(); } auto newTime = LogicalClock::get(_service)->getClusterTime(); LogicalTimeMetadata metadata(validator->trySignLogicalTime(newTime)); metadata.writeToMetadata(metadataBob); return Status::OK(); }
void ArtworkMetadataTests::freshObjectTest() { QString filepath = "/path/to/my/file.jpg"; Mocks::ArtworkMetadataMock metadata(filepath); QCOMPARE(metadata.getFilepath(), filepath); QCOMPARE(metadata.isInitialized(), false); QCOMPARE(metadata.isDescriptionEmpty(), true); QCOMPARE(metadata.isTitleEmpty(), true); QCOMPARE(metadata.isModified(), false); QCOMPARE(metadata.isEmpty(), true); QCOMPARE(metadata.isSelected(), false); }
void Database::recycleGroup(Group* group) { Q_ASSERT(!m_data.isReadOnly); if (m_metadata->recycleBinEnabled()) { if (!m_metadata->recycleBin()) { createRecycleBin(); } group->setParent(metadata()->recycleBin()); } else { delete group; } }
void Database::recycleEntry(Entry* entry) { Q_ASSERT(!m_data.isReadOnly); if (m_metadata->recycleBinEnabled()) { if (!m_metadata->recycleBin()) { createRecycleBin(); } entry->setGroup(metadata()->recycleBin()); } else { delete entry; } }