当前位置: 首页>>代码示例>>C++>>正文


C++ writeStream函数代码示例

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


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

示例1: TestPageStream

void TestPageStream()
{
	CommonLib::simple_alloc_t alloc;
	embDB::CStorage storage(&alloc, 1000);
	storage.AddRef();
	storage.open(L"d:\\db\\pagestorage.data", false, false, true, false);
	embDB::FilePagePtr pPage = storage.getNewPage(PAGE_SIZE_8K);
	storage.initStorage(pPage->getAddr());
 	storage.saveStorageInfo();
	bool bCheckCRC = false;
	short nType1 = 1;
	short nType2 = 2;
	int64 nAddr = storage.getNewPageAddr(PAGE_SIZE_8K);
	{
		embDB::TWriteStreamPage<embDB::IDBStorage> writeStream(&storage, PAGE_SIZE_8K, bCheckCRC, nType1, nType2);
	

		writeStream.open(nAddr, 0);


		for (int64 i = 0; i < 10000; ++i)
		{
			writeStream.write(i);
		}
		writeStream.Save();
	}
		
	{

		embDB::TWriteStreamPage<embDB::IDBStorage> writeStream(&storage, PAGE_SIZE_8K, bCheckCRC, nType1, nType2);

		writeStream.open(nAddr, 0, true);
		for (int64 i = 0; i <100000; ++i)
		{
			writeStream.write(i);
		}
		writeStream.Save();

	}


	{
		embDB::TReadStreamPage<embDB::IDBStorage> readStream(&storage, PAGE_SIZE_8K, bCheckCRC, nType1, nType2);
		readStream.open(nAddr, 0);
		for (int64 i = 0; i < 20000; ++i)
		{
			int64 d = readStream.readInt64();
			if (d != i)
			{
				d++;
				assert(false);
			}
		}

	}

}
开发者ID:ViacheslavN,项目名称:GIS,代码行数:57,代码来源:TestPageStream.cpp

示例2: assert

void SettingsSerializer::writePackedVariant(QDataStream& stream, const QVariant& v)
{
    assert(v.canConvert(QVariant::String));
    QString str = v.toString();
    if (str == "true")
        writeStream(stream, QString("1"));
    else if (str == "false")
        writeStream(stream, QString("0"));
    else
        writeStream(stream, str.toUtf8());
}
开发者ID:CuiZhicheng,项目名称:qTox,代码行数:11,代码来源:settingsserializer.cpp

示例3: XOJ_CHECK_TYPE

void PdfExport::writeGzStream(Stream* str, GList* replacementList)
{
    XOJ_CHECK_TYPE(PdfExport);

    Object obj1;
    str->getDict()->lookup("Length", &obj1);
    if (!obj1.isInt())
    {
        g_error("PDFDoc::writeGzStream, no Length in stream dict");
        return;
    }

    const int length = obj1.getInt();
    obj1.free();

    char* buffer = new char[length];

    str->unfilteredReset();
    for (int i = 0; i < length; i++)
    {
        int c = str->getUnfilteredChar();
        buffer[i] = c;
    }
    GString* text = GzHelper::gzuncompress(buffer, length);
    writeStream(text->str, text->len, replacementList);

    g_string_free(text, true);

    delete buffer;

    str->reset();
}
开发者ID:cass00,项目名称:xournalpp,代码行数:32,代码来源:PdfExport.cpp

示例4: FTRACE

// -----------------------------------------------------------------------------
// CCommonTestClass::ExternalizeMPXCollectionTypeL()
// Returns: Symbian OS errors.
// -----------------------------------------------------------------------------
TInt CCommonTestClass::ExternalizeMPXCollectionTypeL()
    {
	FTRACE(FPrint(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL testing CMPXCollectionType::ExternalizeMPXCollectionTypeL begin")));
    iLog->Log(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL testing CMPXCollectionType::ExternalizeMPXCollectionTypeL begin"));
    TInt err = KErrNone;
    if ( iType != NULL )
        {
    	FTRACE(FPrint(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL started Externalize")));
        iLog->Log(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL started Externalize"));
        CBufBase* buffer = CBufFlat::NewL( 50 );
        CleanupStack::PushL( buffer );
        RBufWriteStream writeStream( *buffer );
        CleanupClosePushL( writeStream );
        iType->ExternalizeL( writeStream );
        writeStream.CommitL();
        buffer->Compress();
        CleanupStack::PopAndDestroy( &writeStream );
        CleanupStack::PopAndDestroy( buffer ); 
        }
    else
        {
        err = KErrBadTestParameter;
    	FTRACE(FPrint(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL Stif test script is wrong.")));
        iLog->Log(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL Stif test script is wrong."));
        }
	FTRACE(FPrint(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL testing CMPXCollectionType::ExternalizeMPXCollectionTypeL end err=%d"), err));
    iLog->Log(_L("CCommonTestClass::ExternalizeMPXCollectionTypeL testing CMPXCollectionType::ExternalizeMPXCollectionTypeL end err=%d"), err);
	return err;
    }
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:33,代码来源:testmpxcollectiontype.cpp

示例5: SSMLOGLEAVEIFNULL

void CCmdTestList::AddMultipleWaitCommandL(TInt32 aTimeout)
	{
	RDebug::Printf("CCmdTestList::AddMultipleWaitCommandL");
	SSMLOGLEAVEIFNULL(iCommandList);
	//
	const TInt KTempDataLength = 1024;
	CBufFlat* inputBuffer = CBufFlat::NewL(KTempDataLength);
	CleanupStack::PushL(inputBuffer);
	RBufWriteStream writeStream(*inputBuffer);
	CleanupClosePushL(writeStream);
	writeStream.WriteInt32L(aTimeout);
#ifdef SYMBIAN_SSM_FLEXIBLE_MERGE
	writeStream.WriteUint16L(KDefaultCommandPriority);
#endif //SYMBIAN_SSM_FLEXIBLE_MERGE
	writeStream.CommitL();
	RDesReadStream readStream(inputBuffer->Ptr(0));
	CleanupClosePushL(readStream);
	TArray<MSsmCommand*> deferredList = iDeferredList.Array();
	CSsmCommandBase* cmd = CCmdMultipleWait::NewL(readStream, deferredList);
	CleanupStack::PushL(cmd);
	static_cast<MSsmCommandList&>(*iCommandList).AppendL(cmd);
	iDeferredList.Reset();
	CleanupStack::Pop(cmd);

	CleanupStack::PopAndDestroy(&readStream);
	CleanupStack::PopAndDestroy(&writeStream);
	CleanupStack::PopAndDestroy(inputBuffer);
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:28,代码来源:tcmd_cmdlist.cpp

示例6: outputNorm

void
Console::output()
{
  // Print Non-linear Residual
  if (onNonlinearResidual())
  {
    if (_write_screen)
      Moose::out << std::setw(2) << _nonlinear_iter << " Nonlinear |R| = " << outputNorm(_old_nonlinear_norm, _norm) << std::endl;

    if (_write_file)
      _file_output_stream << std::setw(2) << _nonlinear_iter << " Nonlinear |R| = " << std::scientific << _norm << std::endl;
  }

  // Print Linear Residual
  else if (onLinearResidual())
  {
    if (_write_screen)
      Moose::out << std::setw(7) << _linear_iter << " Linear |R| = " << std::scientific << outputNorm(_old_linear_norm, _norm) << std::endl;

    if (_write_file)
      _file_output_stream << std::setw(7) << _linear_iter << std::scientific << " Linear |R| = " << std::scientific << _norm << std::endl;
  }

  // Call the base class output function
  else
  {
    writeVariableNorms();
    TableOutputter::output();
  }

  // Write the file
  if (_write_file)
    writeStream();
}
开发者ID:joshua-cogliati-inl,项目名称:moose,代码行数:34,代码来源:Console.C

示例7: writeStream

/**
Helper function to compare the data of the command.
*/
void CCmdTestWaitForApparcInit::CompareCommandsDataL(CCmdWaitForApparcInit* aTestCmd, TCmdErrorSeverity aSeverity, const TUint16 aPriority)
	{
	// create output buffer and stream
 	CBufFlat* outputBuffer = CBufFlat::NewL(KTempDataLength);
	CleanupStack::PushL(outputBuffer);
	RBufWriteStream writeStream(*outputBuffer);
	CleanupClosePushL(writeStream);

	// externalise the data
	aTestCmd->ExternalizeL(writeStream);
	RDesReadStream readStream(outputBuffer->Ptr(0));
	CleanupClosePushL(readStream);
	TCmdErrorSeverity severity = static_cast<TCmdErrorSeverity>(readStream.ReadInt16L());
	TEST(aSeverity == severity);
#ifdef SYMBIAN_SSM_FLEXIBLE_MERGE
	TUint16 priority = readStream.ReadUint16L();
	TEST(aPriority == priority);
#else
	TEST(aPriority == KDefaultPriority);
#endif

	CleanupStack::PopAndDestroy(&readStream);
	CleanupStack::PopAndDestroy(&writeStream);
	CleanupStack::PopAndDestroy(outputBuffer);
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:28,代码来源:tcmd_step_waitforapparcinit.cpp

示例8: GTEST_TEST_F

GTEST_TEST_F(ConfigManager, newSave) {
	ConfigMan.create();

	ConfigMan.setInt("width", 640);
	ConfigMan.setInt("height", 480);

	const Common::UString game1 = ConfigMan.createGame("/path/to/game1/");

	ConfigMan.setGame(game1);

	ConfigMan.setString("path", "/path/to/game1/");
	ConfigMan.setInt("width", 800);
	ConfigMan.setInt("height", 600);
	ConfigMan.setBool("fullscreen", true);

	const Common::UString game2 = ConfigMan.createGame("/path/to/game2/");

	ConfigMan.setGame(game2);

	ConfigMan.setString("path", "/path/to/game2");

	Common::MemoryWriteStreamDynamic writeStream(true);
	ConfigMan.save(writeStream);

	compareStream(writeStream, kConfigFile);
}
开发者ID:Supermanu,项目名称:xoreos,代码行数:26,代码来源:configman.cpp

示例9: writeStream

Console::~Console()
{
  // Write the libMesh performance log header
  if (_perf_header)
  {
    if (_write_screen && !_timing)
      Moose::out << Moose::perf_log.get_info_header();

    if (_write_file)
      _file_output_stream << Moose::perf_log.get_info_header();
  }

  // Write the solve log (Moose Test Performance)
  if (_solve_log)
  {
    if (_write_screen && !_timing)
      Moose::out << Moose::perf_log.get_perf_info();
    if (_write_file)
      _file_output_stream << Moose::perf_log.get_perf_info();
  }

  // Write the setup log (Setup Performance)
  if (_setup_log)
  {
    if (_write_screen && !_timing)
      Moose::out << Moose::setup_perf_log.get_perf_info();
    if (_write_file)
      _file_output_stream << Moose::setup_perf_log.get_perf_info();
  }

  // Write the libMesh log
#ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING
  if (_libmesh_log)
  {
    if (_write_screen && !_timing)
      Moose::out << libMesh::perflog.get_perf_info();
    if (_write_file)
      _file_output_stream << libMesh::perflog.get_perf_info();
  }
#endif

  // Write the file output stream
  if (_write_file)
    writeStream();

  /* If --timing was not used disable the logging b/c the destructor of these
   * object does the output, if --timing was used do nothing because all other
   * screen related output was disabled above */
  if (!_timing)
  {
    /* Disable the logs, without this the logs will be printed
       during the destructors of the logs themselves */
    Moose::perf_log.disable_logging();
    Moose::setup_perf_log.disable_logging();
#ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING
    libMesh::perflog.disable_logging();
#endif
  }
}
开发者ID:joshua-cogliati-inl,项目名称:moose,代码行数:59,代码来源:Console.C

示例10: writeStream

bool SkBBoxHierarchyRecord::shouldRewind(void* data) {
    // SkBBoxHierarchy::rewindInserts is called by SkPicture after the
    // SkPicture has rewound its command stream.  To match that rewind in the
    // BBH, we rewind all draws that reference commands that were recorded
    // past the point to which the SkPicture has rewound, which is given by
    // writeStream().bytesWritten().
    SkPictureStateTree::Draw* draw = static_cast<SkPictureStateTree::Draw*>(data);
    return draw->fOffset >= writeStream().bytesWritten();
}
开发者ID:Tkkg1994,项目名称:Platfrom-kccat6,代码行数:9,代码来源:SkBBoxHierarchyRecord.cpp

示例11: TableOutputter

Console::Console(const std::string & name, InputParameters parameters) :
    TableOutputter(name, parameters),
    _max_rows(getParam<unsigned int>("max_rows")),
    _fit_mode(getParam<MooseEnum>("fit_mode")),
    _use_color(false),
    _scientific_time(getParam<bool>("scientific_time")),
    _write_file(getParam<bool>("output_file")),
    _write_screen(getParam<bool>("output_screen")),
    _verbose(getParam<bool>("verbose")),
    _old_linear_norm(std::numeric_limits<Real>::max()),
    _old_nonlinear_norm(std::numeric_limits<Real>::max()),
    _perf_log(getParam<bool>("perf_log")),
    _solve_log(isParamValid("solve_log") ? getParam<bool>("solve_log") : _perf_log),
    _setup_log(isParamValid("setup_log") ? getParam<bool>("setup_log") : _perf_log),
#ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING
    _libmesh_log(getParam<bool>("libmesh_log")),
#endif
    _setup_log_early(getParam<bool>("setup_log_early")),
    _perf_header(isParamValid("perf_header") ? getParam<bool>("perf_header") : _perf_log),
    _all_variable_norms(getParam<bool>("all_variable_norms")),
    _outlier_variable_norms(getParam<bool>("outlier_variable_norms")),
    _outlier_multiplier(getParam<std::vector<Real> >("outlier_multiplier")),
    _timing(_app.getParam<bool>("timing"))
{
  // If --timing was used from the command-line, do nothing, all logs are enabled
  if (!_timing)
  {
    // Disable performance logging (all log input options must be false)
    if (!_perf_log && !_setup_log && !_solve_log && !_perf_header && !_setup_log_early)
    {
      Moose::perf_log.disable_logging();
      Moose::setup_perf_log.disable_logging();
    }

    // Disable libMesh log
#ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING
    if (!_libmesh_log)
      libMesh::perflog.disable_logging();
#endif
  }

  // Set output coloring
  if (getParam<bool>("use_color"))
  {
    char * term_env = getenv("TERM");
    if (term_env)
    {
      std::string term(term_env);
      if (term == "xterm-256color" || term == "xterm")
        _use_color = true;
    }
  }

  // If file output is desired, wipe out the existing file if not recovering
  if (_write_file && !_app.isRecovering())
    writeStream(false);
}
开发者ID:atomica,项目名称:moose,代码行数:57,代码来源:Console.C

示例12: bufPtr

HBufC8* RContactRemoteView::PackageSortOrderLC(const RContactViewSortOrder& aSortOrder,TContactViewPreferences aContactTypes) const
    {
    TInt bufLength=aSortOrder.ExternalizedSize();
    bufLength+=sizeof(TContactViewPreferences);//
    HBufC8* buf=HBufC8::NewLC(bufLength);
    TPtr8 bufPtr(buf->Des());
    RDesWriteStream writeStream(bufPtr);
    writeStream << (TInt32&)aContactTypes;
    writeStream << aSortOrder;
    bufPtr.SetLength(bufLength);
    return buf;
    }
开发者ID:KDE,项目名称:android-qt-mobility,代码行数:12,代码来源:remoteview.cpp

示例13: EUNIT_PRINT

void CNSmlDummyDataProvider_Test::DoStoreFormatLL()
    {
    const CSmlDataStoreFormat& storeFormat = iCNSmlDummyDataProvider->DoStoreFormatL();
    EUNIT_PRINT( storeFormat.DisplayName() );
    EUNIT_PRINT( _L("Property count %d"), storeFormat.FolderPropertyCount() );
    CBufFlat* store = CBufFlat::NewL( 512 );
    CleanupStack::PushL( store );
    RBufWriteStream writeStream(*store, 0);
    CleanupClosePushL( writeStream );
    storeFormat.ExternalizeL( writeStream );
    CleanupStack::PopAndDestroy( 2, store );
    }
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:12,代码来源:cnsmldummydataprovider_test.cpp

示例14: args

/**
Searches all contact items in the view for fields that contain the search
strings specified. 

@capability ReadUserData
@param aFindWords A descriptor array containing one or more search strings
@param aMatchedContacts On return, an array of matching contact items
@param find behaviour configuration uid to be passed to the server.
 */
void RContactRemoteView::ContactsMatchingCriteriaL(const MDesCArray& aFindWords, RPointerArray<CViewContact>& aMatchedContacts, TBool aPrefixSearch,TUid aUid)
    {
    if(aUid != KNullUid)
        {
        TIpcArgs args(aUid.iUid);
        User::LeaveIfError(SendReceive(ECntSendPluginUidToServer,args));
        }
    CBufBase* buffer = CBufFlat::NewL(32);
    CleanupStack::PushL(buffer);
    RBufWriteStream writeStream(*buffer);
    CleanupClosePushL(writeStream);

    writeStream.WriteUint32L(aPrefixSearch);
    const TInt count = aFindWords.MdcaCount();
    writeStream.WriteUint32L(count);
    for (TInt i=0; i<count; ++i)
        {
        TPtrC ptr = aFindWords.MdcaPoint(i);
        writeStream.WriteUint32L(ptr.Length());
        writeStream << ptr;
        }
    
    writeStream.CommitL();
    CleanupStack::PopAndDestroy(&writeStream); //writeStream.Close()

    TPtr8 ptr(buffer->Ptr(0));
    const TInt bufferSize = buffer->Size();
    TPckg<TInt> size(bufferSize);

    TPckgBuf<TInt> pckg;
    TIpcArgs args(&pckg,&size,&ptr);
    User::LeaveIfError(SendReceive(ECntContactMatchingCriteriaExternalizedSize,args));
    CleanupStack::PopAndDestroy(buffer);

    //Internalize Contacts
    HBufC8* buf=HBufC8::NewLC(pckg());
    TPtr8 contactsbufPtr(buf->Des());
    TIpcArgs args2(&contactsbufPtr);
    User::LeaveIfError(SendReceive(ECntGetContactMatchingCriteria,args2));

    RDesReadStream readStream(contactsbufPtr);
    CleanupClosePushL(readStream);
    const TInt findCount = readStream.ReadUint32L();
    for (TInt zz=0;zz<findCount;++zz)
        {
        CViewContact* thisContact = CViewContact::NewLC(KNullContactId);
        readStream >> *thisContact;
        aMatchedContacts.AppendL(thisContact);
        CleanupStack::Pop(thisContact);
        }
    CleanupStack::PopAndDestroy(2, buf);
    }
开发者ID:KDE,项目名称:android-qt-mobility,代码行数:61,代码来源:remoteview.cpp

示例15: imageSize

bool ossimOpjJp2Writer::writeFile()
{
   // This method is called from ossimImageFileWriter::execute().

   bool result = false;
   
   if( theInputConnection.valid() &&
       (getErrorStatus() == ossimErrorCodes::OSSIM_OK) )
   {

      // Make sure Area of Interest is an even multiple of tiles
      ossimIrect areaOfInterest = theInputConnection->getAreaOfInterest();
      ossimIpt imageSize(areaOfInterest.size());
      ossimIpt imageLr(areaOfInterest.lr());
      ossim_uint32 xBoundaryAdjustFactor = DEFAULT_TILE_SIZE.x - (imageSize.x % DEFAULT_TILE_SIZE.x);
      ossim_uint32 yBoundaryAdjustFactor = DEFAULT_TILE_SIZE.y - (imageSize.y % DEFAULT_TILE_SIZE.y);
      imageLr.x += xBoundaryAdjustFactor;
      imageLr.y += yBoundaryAdjustFactor;
      areaOfInterest.set_lr(imageLr); 
      theInputConnection->setAreaOfInterest(areaOfInterest);

      // Set the tile size for all processes.
      theInputConnection->setTileSize( DEFAULT_TILE_SIZE );
      theInputConnection->setToStartOfSequence();
      
      //---
      // Note only the master process used for writing...
      //---
      if(theInputConnection->isMaster())
      {
         if (!isOpen())
         {
            open();
         }
         
         if ( isOpen() )
         {
            result = writeStream();
         }
      }
      else // Slave process.
      {
         // This will return after all tiles for this node have been processed.
         theInputConnection->slaveProcessTiles();

         result = true;
      }
   }
      
   return result;
   
} // End: ossimOpjJp2Writer::writeFile()
开发者ID:geoware,项目名称:ossim-plugins,代码行数:52,代码来源:ossimOpjJp2Writer.cpp


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