本文整理汇总了C++中outStream函数的典型用法代码示例。如果您正苦于以下问题:C++ outStream函数的具体用法?C++ outStream怎么用?C++ outStream使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了outStream函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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();
}
}
示例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;
}
示例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();
}
示例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();
}
示例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;
}
示例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();
}
示例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;
}
示例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);
}
示例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;
}