这篇教程C++ toFile函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中toFile函数的典型用法代码示例。如果您正苦于以下问题:C++ toFile函数的具体用法?C++ toFile怎么用?C++ toFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了toFile函数的21个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ASSERT// staticPassRefPtrWillBeRawPtr<Entry> DataTransferItemFileSystem::webkitGetAsEntry(ExecutionContext* executionContext, DataTransferItem& item){ if (!item.dataObjectItem()->isFilename()) return nullptr; // For dragged files getAsFile must be pretty lightweight. Blob* file = item.getAsFile().get(); // The clipboard may not be in a readable state. if (!file) return nullptr; ASSERT(file->isFile()); DraggedIsolatedFileSystem* filesystem = DraggedIsolatedFileSystem::from(item.clipboard()->dataObject().get()); DOMFileSystem* domFileSystem = filesystem ? filesystem->getDOMFileSystem(executionContext) : 0; if (!filesystem) { // IsolatedFileSystem may not be enabled. return nullptr; } ASSERT(domFileSystem); // The dropped entries are mapped as top-level entries in the isolated filesystem. String virtualPath = DOMFilePath::append("/", toFile(file)->name()); // FIXME: This involves synchronous file operation. Consider passing file type data when we dispatch drag event. FileMetadata metadata; if (!getFileMetadata(toFile(file)->path(), metadata)) return nullptr; if (metadata.type == FileMetadata::TypeDirectory) return DirectoryEntry::create(domFileSystem, virtualPath); return FileEntry::create(domFileSystem, virtualPath);}
开发者ID:jeremyroman,项目名称:blink,代码行数:34,
示例2: new_file_scope_envV new_file_scope_env(V file, V env){ V sc = create_scope(); Scope* scope = toScope(sc); scope->is_func_scope = true; scope->is_error_handler = false; scope->parent = add_ref(toFile(file)->global); scope->func = NULL; scope->file = add_ref(file); scope->callname = NULL; scope->pc = toFile(file)->code - 1; scope->env = env; return sc;}
开发者ID:gvx,项目名称:deja,代码行数:14,
示例3: ASSERTbool BeaconLoader::sendBeacon(LocalFrame* frame, int allowance, const KURL& beaconURL, PassRefPtrWillBeRawPtr<Blob>& data, int& payloadLength){ ASSERT(data); unsigned long long entitySize = data->size(); if (allowance > 0 && static_cast<unsigned long long>(allowance) < entitySize) return false; ResourceRequest request(beaconURL); prepareRequest(frame, request); RefPtr<FormData> entityBody = FormData::create(); if (data->hasBackingFile()) entityBody->appendFile(toFile(data.get())->path()); else entityBody->appendBlob(data->uuid(), data->blobDataHandle()); request.setHTTPBody(entityBody.release()); AtomicString contentType; const String& blobType = data->type(); if (!blobType.isEmpty() && isValidContentType(blobType)) request.setHTTPContentType(AtomicString(contentType)); issueRequest(frame, request); payloadLength = entitySize; return true;}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:27,
示例4: wrapv8::Handle<v8::Object> wrap(Blob* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate){ ASSERT(impl); if (impl->isFile()) return wrap(toFile(impl), creationContext, isolate); return V8Blob::createWrapper(impl, creationContext, isolate);}
开发者ID:fmalita,项目名称:webkit,代码行数:7,
示例5: WTF_LOGvoid XMLHttpRequest::send(Blob* body, ExceptionState& exceptionState){ WTF_LOG(Network, "XMLHttpRequest %p send() Blob '%s'", this, body->uuid().utf8().data()); if (!initSend(exceptionState)) return; if (areMethodAndURLValidForSend()) { if (getRequestHeader("Content-Type").isEmpty()) { const String& blobType = body->type(); if (!blobType.isEmpty() && isValidContentType(blobType)) setRequestHeaderInternal("Content-Type", AtomicString(blobType)); else { // From FileAPI spec, whenever media type cannot be determined, empty string must be returned. setRequestHeaderInternal("Content-Type", ""); } } // FIXME: add support for uploading bundles. m_requestEntityBody = FormData::create(); if (body->hasBackingFile()) m_requestEntityBody->appendFile(toFile(body)->path()); else m_requestEntityBody->appendBlob(body->uuid(), body->blobDataHandle()); } createRequest(exceptionState);}
开发者ID:Igalia,项目名称:blink,代码行数:28,
示例6: headerToFile/*! * /brief Callback for burst messages * * This method is called automatically when the node receives a burst message. * It creates and publishes a CAT from this burst. * * /param b the received message */void CatCreator::callback(const burst_calc::burst::ConstPtr& b){ if (is_init_) { // Write burst header to file if (save_to_file_) headerToFile(*b); // Create a new CAT burst_calc::cat cat; cat.header.stamp = b->header.stamp; cat.end = b->end; cat.channels = b->channels; for (unsigned int i = 0; i < b->dishes.size(); i++) { // Update offsets in case a new min voltage is encountered updateOffsets(b->dishes[i]); if (caExists(b->dishes[i])) { // A center of activity exists for this dish state: // Add CA to CAT, publish CA, and write CAT & burst to file burst_calc::ca ca = getCa(b->dishes[i]); cat.cas.push_back(ca); ca_pub_.publish(ca); if (save_to_file_) toFile(i, b->dishes[i], ca); } else { // No center of activity for this dish state: // Just write burst to file if (save_to_file_) toFile(i, b->dishes[i]); } } // Publish CAT cat_pub_.publish(cat); ROS_INFO("CAT of size %d created from burst of size %d", static_cast<int>(cat.cas.size()), static_cast<int>(b->dishes.size())); } else ROS_ERROR("Minimum voltages not initialized, skipping CAT creation");}
开发者ID:ab3nd,项目名称:NeuronRobotInterface,代码行数:54,
示例7: toFilevoid Statistics::write_fault_data_to_file(void){ std::ofstream toFile("fault_data.txt", std::ios::trunc); toFile << "Fault Fraction: " << fault_fraction << "/n"; toFile << "Steps Before Fault: " << steps_before_fault << "/n"; toFile << "On Fault Count: " << on_fault_count << "/n"; toFile << "Off Fault Count: " << off_fault_count << "/n";}
开发者ID:jqnorris,项目名称:geo_percolation,代码行数:9,
示例8: toV8v8::Handle<v8::Value> toV8(Blob* impl, v8::Isolate* isolate){ if (!impl) return v8::Null(); if (impl->isFile()) return toV8(toFile(impl), isolate); return V8Blob::wrap(impl, isolate);}
开发者ID:Spencerx,项目名称:webkit,代码行数:10,
示例9: Matrix_To_Filevoid Matrix_To_File(SparseMatrix<double> mat, const char* filename){ ofstream toFile(filename); toFile.precision(10); for (int k=0; k < mat.outerSize(); ++k) { for (SparseMatrix<double>::InnerIterator it(mat,k); it; ++it) { toFile << (it.row()+1) << "/t" << (it.col()+1) << "/t" << it.value() <<"/n"; } } toFile.close();}
开发者ID:bo-wu,项目名称:surgical,代码行数:12,
示例10: generateRandomPasswordbool ClientConfiguration::toFile(QString const& filename) const { QString backupString; QString backupPassword = generateRandomPassword(20); try { backupString = toBackup(backupPassword); } catch (InternalErrorException& iex) { LOGGER()->critical("Failed to create a Backup from Identity: {}", iex.what()); return false; } return toFile(filename, backupString, backupPassword);}
开发者ID:Blinket,项目名称:openMittsu,代码行数:12,
示例11: File__tostringWSLUA_METAMETHOD File__tostring(lua_State* L) { /* Generates a string of debug info for the File object */ File f = toFile(L,1); if (!f) { lua_pushstring(L,"File pointer is NULL!"); } else { lua_pushfstring(L,"File expired=%s, handle=%s, is %s", f->expired? "true":"false", f->file? "<ptr>":"<NULL>", f->wdh? "writer":"reader"); } WSLUA_RETURN(1); /* String of debug information. */}
开发者ID:CharaD7,项目名称:wireshark,代码行数:13,
示例12: srand/*!* /brief Constructeur de la classe Solution** Cette fonction appelle l'heuristique de construction, et recopie* la solution dans un fichier "res.txt".** /param instance : instance sur laquelle on travaille.*/Solution::Solution(Instance *instance){ _distParcourue = 0; _dateFin = 0; srand(time(0)); HeurisSaving(instance); computeDateDist(instance); toFile("../res.txt", instance);}
开发者ID:SamuelMorel,项目名称:RO,代码行数:21,
示例13: filevoid MainWindow::ssave() { if(fileName.isEmpty()) { fileName = QFileDialog::getSaveFileName(this,"Save file"); lFileName->setText("FileName: " + fileName.section('/',-1)); } QFile file(fileName); if (file.open(QIODevice::WriteOnly)) { QTextStream toFile(&file); toFile << QString::number(lastResult) << "/n" << textEdit->toPlainText(); lFileName->setText("File Name: " + fileName.section('/',-1)); file.close(); }}
开发者ID:bondarevts,项目名称:amse-qt,代码行数:14,
示例14: copyFileFromResourcesvoid copyFileFromResources(QString from, QString to){ // copy a file from resources to the config dir if it does not exist there QFileInfo toFile(to); if(!toFile.exists()) { QFile newToFile(toFile.absoluteFilePath()); QResource res(from); if (newToFile.open(QIODevice::WriteOnly)) { newToFile.write( reinterpret_cast<const char*>(res.data()) ); newToFile.close(); } else { qFatal("failed to copy default config from resources"); } }}
开发者ID:OlliV,项目名称:thumbterm,代码行数:15,
示例15: PassRefPtrWillBeRawPtr<FileList> Clipboard::files() const{ RefPtrWillBeRawPtr<FileList> files = FileList::create(); if (!canReadData()) return files.release(); for (size_t i = 0; i < m_dataObject->length(); ++i) { if (m_dataObject->item(i)->kind() == DataObjectItem::FileKind) { RefPtrWillBeRawPtr<Blob> blob = m_dataObject->item(i)->getAsFile(); if (blob && blob->isFile()) files->append(toFile(blob.get())); } } return files.release();}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:16,
示例16: mainint main(int argc, char **argv) { if(argc==2) { srand(time(NULL)); room maze[COLS][ROWS]; room (*ptr)[ROWS] = maze; init(ptr); dw(ptr, 0,0); toFile(ptr, argv[1]); return 0; } else { puts("NEED FILE PATH"); return 1; }}
开发者ID:dukelv,项目名称:csci033,代码行数:17,
示例17: sendvoid XMLHttpRequest::send(Blob* body, ExceptionCode& ec){ if (!initSend(ec)) return; if (m_method != "GET" && m_method != "HEAD" && m_url.protocolIsInHTTPFamily()) { // FIXME: Should we set a Content-Type if one is not set. // FIXME: add support for uploading bundles. m_requestEntityBody = FormData::create(); if (body->isFile()) m_requestEntityBody->appendFile(toFile(body)->path());#if ENABLE(BLOB) else m_requestEntityBody->appendBlob(body->url());#endif } createRequest(ec);}
开发者ID:yang-bo,项目名称:webkit,代码行数:19,
示例18: newIconbool LaunchPoint::updateIconPath(std::string newIconPath){ // strip off local file url if (newIconPath.compare(0, 7, localFileURI) == 0) { newIconPath.erase(0, 7); } QImage newIcon(qFromUtf8Stl(newIconPath)); if (newIcon.isNull()) { return false; } m_iconPath = newIconPath; // attempt to persist change toFile(); return true;}
开发者ID:ctbrowser,项目名称:luna-sysmgr,代码行数:19,
示例19: implJSValue* JSXMLHttpRequest::send(ExecState* exec, const ArgList& args){ ExceptionCode ec = 0; if (args.isEmpty()) impl()->send(ec); else { JSValue* val = args.at(exec, 0); if (val->isUndefinedOrNull()) impl()->send(ec); else if (val->isObject(&JSDocument::s_info)) impl()->send(toDocument(val), ec); else if (val->isObject(&JSFile::s_info)) impl()->send(toFile(val), ec); else impl()->send(val->toString(exec), ec); } setDOMException(exec, ec); return jsUndefined();}
开发者ID:Czerrr,项目名称:ISeeBrowser,代码行数:20,
示例20: ASSERTFile* FormData::Entry::file() const{ ASSERT(blob()); // The spec uses the passed filename when inserting entries into the list. // Here, we apply the filename (if present) as an override when extracting // entries. // FIXME: Consider applying the name during insertion. if (blob()->isFile()) { File* file = toFile(blob()); if (filename().isNull()) return file; return file->clone(filename()); } String filename = m_filename; if (filename.isNull()) filename = "blob"; return File::create(filename, currentTimeMS(), blob()->blobDataHandle());}
开发者ID:azureplus,项目名称:chromium,代码行数:20,
示例21: voidbool Queue::save(const ssi_char_t *filepath, FILE *fp, void(*toFile) (const ssi_char_t *filepath, FILE *fp, void *x)) { fwrite(&_n, sizeof(int), 1, fp); fwrite(&_first, sizeof(int), 1, fp); fwrite(&_last, sizeof(int), 1, fp); fwrite(&_count, sizeof(int), 1, fp); STATE::List empty = STATE::EMPTY; STATE::List filled = STATE::FILLED; for (int i = 0; i < _n; i++) { if (_q[i]) { fwrite(&filled, sizeof(STATE::List), 1, fp); toFile(filepath, fp, _q[i]); } else { fwrite(&empty, sizeof(STATE::List), 1, fp); } } return true;}
开发者ID:hihiy,项目名称:IntelliVoice,代码行数:20,
注:本文中的toFile函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ toFloat函数代码示例 C++ toElement函数代码示例 |