• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ outStream函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中outStream函数的典型用法代码示例。如果您正苦于以下问题:C++ outStream函数的具体用法?C++ outStream怎么用?C++ outStream使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了outStream函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: outStream

void TestDocumentFileSynchronizerFactoryTest::writeToFile( const QString &filePath, const QByteArray &data, const QByteArray &header  )
{
    QFile file;
    file.setFileName( filePath );
    file.open( QIODevice::WriteOnly );

    QDataStream outStream( &file );
    outStream.writeRawData( header.data(), header.size() );
    outStream.writeRawData( data.data(), data.size() );

    file.close();
}
开发者ID:KDE,项目名称:okteta,代码行数:12,代码来源:testdocumentfilesynchronizerfactorytest.cpp


示例2: outStream

bool cc2DViewportLabel::toFile_MeOnly(QFile& out) const
{
	if (!cc2DViewportObject::toFile_MeOnly(out))
		return false;

	//ROI (dataVersion>=21)
	QDataStream outStream(&out);
	for (int i=0;i<4;++i)
		outStream << m_roi[i];

	return true;
}
开发者ID:whatnick,项目名称:CloudCompare,代码行数:12,代码来源:cc2DViewportLabel.cpp


示例3: outStream

bool ccPlane::toFile_MeOnly(QFile& out) const
{
    if (!ccGenericPrimitive::toFile_MeOnly(out))
        return false;

    //parameters (dataVersion>=21)
    QDataStream outStream(&out);
    outStream << m_xWidth;
    outStream << m_yWidth;

    return true;
}
开发者ID:vellano,项目名称:CloudCompare,代码行数:12,代码来源:ccPlane.cpp


示例4: outStream

Song TagHelperIface::read(const QString &fileName)
{
    DBUG << fileName;
    Song resp;
    QByteArray message;
    QDataStream outStream(&message, QIODevice::WriteOnly);
    outStream << QString(__FUNCTION__) << fileName;
    Reply reply=sendMessage(message);
    if (reply.status) {
        QDataStream inStream(reply.data);
        inStream >> resp;
    }
开发者ID:padertux,项目名称:cantata,代码行数:12,代码来源:taghelperiface.cpp


示例5: outputFile

bool QgsRasterFileWriter::writeVRT( const QString& file )
{
  QFile outputFile( file );
  if ( ! outputFile.open( QIODevice::WriteOnly | QIODevice::Truncate ) )
  {
    return false;
  }

  QTextStream outStream( &outputFile );
  mVRTDocument.save( outStream, 2 );
  return true;
}
开发者ID:ACorradini,项目名称:QGIS,代码行数:12,代码来源:qgsrasterfilewriter.cpp


示例6: CPPUNIT_ASSERT

// test a wxFile and wxFileInput/OutputStreams of a known type
//
void FileKindTestCase::TestFd(wxFile& file, bool expected)
{
    CPPUNIT_ASSERT(file.IsOpened());
    CPPUNIT_ASSERT((wxGetFileKind(file.fd()) == wxFILE_KIND_DISK) == expected);
    CPPUNIT_ASSERT((file.GetKind() == wxFILE_KIND_DISK) == expected);

    wxFileInputStream inStream(file);
    CPPUNIT_ASSERT(inStream.IsSeekable() == expected);

    wxFileOutputStream outStream(file);
    CPPUNIT_ASSERT(outStream.IsSeekable() == expected);
}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:14,代码来源:filekind.cpp


示例7: CopyToVideoFile

void CopyToVideoFile()
{
	std::string targetFileName = "../../Samples/SmokeSim/SmokeVideo.raw";

	ofstream outStream(targetFileName, std::ios::out|std::ios::binary|std::ios::ate);

	if (outStream.is_open())
	{
		outStream.write (pixelBuffer, SCREEN_WIDTH * SCREEN_HEIGHT * 4);
		outStream.close();
	}
}
开发者ID:luosz,项目名称:artivvis-development-repository,代码行数:12,代码来源:main.cpp


示例8: WriteError

bool ccMaterialSet::toFile_MeOnly(QFile& out) const
{
	if (!ccHObject::toFile_MeOnly(out))
		return false;

	//Materials count (dataVersion>=20)
	uint32_t count = (uint32_t)size();
	if (out.write((const char*)&count,4) < 0)
		return WriteError();

	//texture filenames
	std::set<QString> texFilenames;

	QDataStream outStream(&out);

	//Write each material
	for (ccMaterialSet::const_iterator it = begin(); it!=end(); ++it)
	{
		//material name (dataVersion>=20)
		outStream << it->name;
		//texture (dataVersion>=20)
		outStream << it->textureFilename;
		texFilenames.insert(it->textureFilename);
		//material colors (dataVersion>=20)
		//we don't use QByteArray here as it has its own versions!
		if (out.write((const char*)it->diffuseFront,sizeof(float)*4) < 0) 
			return WriteError();
		if (out.write((const char*)it->diffuseBack,sizeof(float)*4) < 0) 
			return WriteError();
		if (out.write((const char*)it->ambient,sizeof(float)*4) < 0) 
			return WriteError();
		if (out.write((const char*)it->specular,sizeof(float)*4) < 0) 
			return WriteError();
		if (out.write((const char*)it->emission,sizeof(float)*4) < 0) 
			return WriteError();
		//material shininess (dataVersion>=20)
		outStream << it->shininessFront;
		outStream << it->shininessBack;
	}

	//now save the number of textures (dataVersion>=37)
	outStream << static_cast<uint32_t>(texFilenames.size());
	//and save the textures (dataVersion>=37)
	{
		for (std::set<QString>::const_iterator it=texFilenames.begin(); it!=texFilenames.end(); ++it)
		{
			outStream << *it; //name
			outStream << ccMaterial::GetTexture(*it); //then image
		}
	}

	return true;
}
开发者ID:RobH616,项目名称:trunk,代码行数:53,代码来源:ccMaterialSet.cpp


示例9: userCfg

void AssetManager::saveUserCfg(QStringList cfg)
{
    QFile userCfg(LIBS_FILEPATH+TMP_USER_CFG_FILEPATH);
    userCfg.open(QIODevice::WriteOnly | QIODevice::Text);
    if (!userCfg.isOpen()) {
            qDebug() << "Failed to open user cfg.";
    }
    QTextStream outStream(&userCfg);
    for(int i = 0; i < cfg.length(); i++)
        outStream << cfg[i] << "\n";
    userCfg.close();
}
开发者ID:JacobPlaster,项目名称:Able,代码行数:12,代码来源:assetmanager.cpp


示例10: generatePtx

std::string generatePtx(llvm::Module *module, int devMajor, int devMinor) {
  std::string mcpu;
  if ((devMajor == 3 && devMinor >= 5) ||
      devMajor > 3) {
    mcpu = "sm_35";
  }
  else if (devMajor >= 3 && devMinor >= 0) {
    mcpu = "sm_30";
  }
  else {
    mcpu = "sm_20";
  }

  // Select target given the module's triple
  llvm::Triple triple(module->getTargetTriple());
  std::string errStr;
  const llvm::Target* target = nullptr;
  target = llvm::TargetRegistry::lookupTarget(triple.str(), errStr);
  iassert(target) << errStr;

  llvm::TargetOptions targetOptions;

  std::string features = "+ptx40";

  std::unique_ptr<llvm::TargetMachine> targetMachine(
      target->createTargetMachine(triple.str(), mcpu, features, targetOptions,
                                  // llvm::Reloc::PIC_,
                                  llvm::Reloc::Default,
                                  llvm::CodeModel::Default,
                                  llvm::CodeGenOpt::Default));

  // Make a passmanager and add emission to string
  llvm::legacy::PassManager pm;
  pm.add(new llvm::TargetLibraryInfoWrapperPass(triple));

  // Set up constant NVVM reflect mapping
  llvm::StringMap<int> reflectMapping;
  reflectMapping["__CUDA_FTZ"] = 1; // Flush denormals to zero
  pm.add(llvm::createNVVMReflectPass(reflectMapping));
  pm.add(llvm::createAlwaysInlinerPass());
  targetMachine->Options.MCOptions.AsmVerbose = true;
  llvm::SmallString<8> ptxStr;
  llvm::raw_svector_ostream outStream(ptxStr);
  outStream.SetUnbuffered();
  bool failed = targetMachine->addPassesToEmitFile(
      pm, outStream, targetMachine->CGFT_AssemblyFile, false);
  iassert(!failed);

  pm.run(*module);
  outStream.flush();
  return ptxStr.str();
}
开发者ID:stephenchouca,项目名称:simit,代码行数:52,代码来源:gpu_codegen.cpp


示例11: QFile

void Boonas::writeFile(QString filename)
{
	float x, y, z, w;
	bool again = true;
	filename.append(".poly");
	QFile* theDestination;
	theDestination = new QFile(filename);
	theDestination -> remove();
	theDestination -> open(QIODevice::ReadWrite | QIODevice::Text);
	QTextStream outStream( theDestination );
	
	do // do this loop while ther is more in orig
	{
		
		cursor = orig -> getCurrent(); // cursor is current
		cursor -> reset();
		
		if(!(orig -> isNotLast()))
		{
			again = false;
		}
		
		outStream << "newObject" << endl;
		
		do
		{
			x = cursor -> getX(); // get point
			y = cursor -> getY();
			z = cursor -> getZ();
			w = cursor -> getW();
			outStream << x << " " << y << " " << z << " " << w << endl;
			
			cursor -> advance();
		}
		while(cursor -> hasNext()); // run through the points!
		
		x = cursor -> getX(); // get point
		y = cursor -> getY();
		z = cursor -> getZ();
		w = cursor -> getW();
		outStream << x << " " << y << " " << z << " " << w << endl;
		
		
		cursor -> reset();
		
		orig -> advance(); // advance what were working with
	}
	while(again);
	
	theDestination -> close();
	delete theDestination;
}
开发者ID:fuag15,项目名称:boonas_modeler,代码行数:52,代码来源:Boonas.cpp


示例12: outputFile

void TaskSetWriter::writeJSON()
{

    QJsonArray taskArray;
    QJsonArray vmArray;

    map<QString, PeriodicTaskData *> tasksData = TASKS_DATA;
    map<QString, PeriodicTaskData *>::iterator taskIter;
    PeriodicTaskData *tempPTask;
    QJsonObject task;
    for (taskIter=tasksData.begin(); taskIter != tasksData.end(); taskIter++){
        tempPTask = taskIter->second;
        task["task_name"] = tempPTask->name();
        task["phase"] = (int)tempPTask->phase();
        task["period"] = (int)tempPTask->ti();
        task["deadline"] = (int)tempPTask->di();
        task["computation_time"] = (int)tempPTask->ci();
        task["kernel"] = tempPTask->kernel();
        taskArray.append(task);
    }

    map<QString, VMData *> vmData = VMS_DATA;
    map<QString, VMData *>::iterator vmIter;

    VMData *tempVM;
    QJsonObject vm;

    for (vmIter=vmData.begin(); vmIter != vmData.end(); vmIter++){
        tempVM = vmIter->second;
        vm["VM_name"] = tempVM->name();
        vm["budget"] = (int)tempVM->budget();
        vm["period"] = (int)tempVM->period();
        vmArray.append(vm);
    }

    QJsonObject obj;

    obj["tasks"] = taskArray;
    obj["VMs"] = vmArray;

    QFile outputFile(_filename);
    outputFile.open(QIODevice::WriteOnly);

    /* Point a QTextStream object at the file */
    QTextStream outStream(&outputFile);

    /* Write the line to the file */
    outStream << QJsonDocument(obj).toJson(QJsonDocument::Compact);

    /* Close the file */
    outputFile.close();
}
开发者ID:CDanielC,项目名称:rtlib_gui,代码行数:52,代码来源:tasksetwriter.cpp


示例13: WriteError

bool ccPolyline::toFile_MeOnly(QFile& out) const
{
	if (!ccHObject::toFile_MeOnly(out))
		return false;

	//we can't save the associated cloud here (as it may be shared by multiple polylines)
	//so instead we save it's unique ID (dataVersion>=28)
	//WARNING: the cloud must be saved in the same BIN file! (responsibility of the caller)
	ccPointCloud* vertices = dynamic_cast<ccPointCloud*>(m_theAssociatedCloud);
	if (!vertices)
	{
		ccLog::Warning("[ccPolyline::toFile_MeOnly] Polyline vertices is not a ccPointCloud structure?!");
		return false;
	}
	uint32_t vertUniqueID = (m_theAssociatedCloud ? (uint32_t)vertices->getUniqueID() : 0);
	if (out.write((const char*)&vertUniqueID,4) < 0)
		return WriteError();

	//number of points (references to) (dataVersion>=28)
	uint32_t pointCount = size();
	if (out.write((const char*)&pointCount,4) < 0)
		return WriteError();

	//points (references to) (dataVersion>=28)
	for (uint32_t i=0; i<pointCount; ++i)
	{
		uint32_t pointIndex = getPointGlobalIndex(i);
		if (out.write((const char*)&pointIndex,4) < 0)
			return WriteError();
	}

	QDataStream outStream(&out);

	//Closing state (dataVersion>=28)
	outStream << m_isClosed;

	//RGB Color (dataVersion>=28)
	outStream << m_rgbColor[0];
	outStream << m_rgbColor[1];
	outStream << m_rgbColor[2];

	//2D mode (dataVersion>=28)
	outStream << m_mode2D;

	//Foreground mode (dataVersion>=28)
	outStream << m_foreground;

	//The width of the line (dataVersion>=31)
	outStream << m_width;

	return true;
}
开发者ID:gadomski,项目名称:cloudcompare-trunk,代码行数:52,代码来源:ccPolyline.cpp


示例14: outStream

        void IncomingClientBase::send(Kiaro::Network::PacketBase *packet, const bool &reliable)
        {
            Kiaro::Common::U32 packet_flag = ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT;
            if (reliable)
                packet_flag = ENET_PACKET_FLAG_RELIABLE;

                // TODO: Packet Size Query
                Kiaro::Support::BitStream outStream(NULL, 0, 0);
                packet->packData(outStream);

                ENetPacket *enetPacket = enet_packet_create(outStream.raw(), outStream.length(), packet_flag);
                enet_peer_send(mInternalClient, 0, enetPacket);
        }
开发者ID:Ragora,项目名称:KGE,代码行数:13,代码来源:IncomingClientBase.cpp


示例15: _

wxString Instance::ReadVersionFile()
{
	if (!GetVersionFile().FileExists())
		return _("");
	
	// Open the file for reading
	wxFSFile *vFile = wxFileSystem().OpenFile(GetVersionFile().GetFullPath(), wxFS_READ);
	wxString retVal;
	wxStringOutputStream outStream(&retVal);
	outStream.Write(*vFile->GetStream());
	wxDELETE(vFile);
	return retVal;
}
开发者ID:bartbes,项目名称:MultiMC4,代码行数:13,代码来源:instance.cpp


示例16: outStream

void ClientGUI::sendToHost()
{
	QByteArray block;
	QDataStream outStream(&block, QIODevice::WriteOnly);
	outStream.setVersion(QDataStream::Qt_4_0);
	outStream << (quint16)0; // reserve room for total data block size being sent
	outStream << (quint8)STRING; // set the command
	outStream << lineEditCommand->text(); // get the text from the command line
	outStream.device()->seek(0);
	outStream << (quint16)(block.size() - sizeof(quint16)); // calculate the size of the data
	textConsole->append(QString("%1 bytes out").arg(block.size() - sizeof(quint16)));
	m_tcpSocket->write(block);
}
开发者ID:mjroman,项目名称:roverClient,代码行数:13,代码来源:clientGUI.cpp


示例17: inStream

// Memory streams should be seekable
//
void FileKindTestCase::MemoryStream()
{
    char buf[20];
    wxMemoryInputStream inStream(buf, sizeof(buf));
    CPPUNIT_ASSERT(inStream.IsSeekable());
    wxMemoryOutputStream outStream(buf, sizeof(buf));
    CPPUNIT_ASSERT(outStream.IsSeekable());

    wxBufferedInputStream seekableBufferedInput(inStream);
    CPPUNIT_ASSERT(seekableBufferedInput.IsSeekable());
    wxBufferedOutputStream seekableBufferedOutput(outStream);
    CPPUNIT_ASSERT(seekableBufferedOutput.IsSeekable());
}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:15,代码来源:filekind.cpp


示例18: outStream

bool ccBox::toFile_MeOnly(QFile& out) const
{
	if (!ccGenericPrimitive::toFile_MeOnly(out))
		return false;

	//parameters (dataVersion>=21)
	QDataStream outStream(&out);
	outStream << m_dims.x;
    outStream << m_dims.y;
    outStream << m_dims.z;

	return true;
}
开发者ID:eile,项目名称:trunk,代码行数:13,代码来源:ccBox.cpp


示例19: main

int main(int argc, char** argv) {
    
    
    // declare filestreams
    std::ifstream inStream1(inputFile1);
    std::ifstream inStream2(inputFile2);
    std::ofstream outStream(outFile);
    
    // call to merge() function per instrucitons
    merge(inStream1, inStream2, outStream);

    return 0;
}
开发者ID:vschmidt94,项目名称:CS161-Code,代码行数:13,代码来源:merge_int_files.cpp


示例20: outStream

bool ccDish::toFile_MeOnly(QFile& out) const
{
	if (!ccGenericPrimitive::toFile_MeOnly(out))
		return false;

	//parameters (dataVersion>=21)
	QDataStream outStream(&out);
	outStream << m_baseRadius;
	outStream << m_secondRadius;
	outStream << m_height;

	return true;
}
开发者ID:3660628,项目名称:trunk,代码行数:13,代码来源:ccDish.cpp



注:本文中的outStream函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ outString函数代码示例发布时间:2022-05-30
下一篇:
C++ outDB函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap