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

C++ oss函数代码示例

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

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



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

示例1: oss

std::string pciEntry::verbose() const {
    std::ostringstream oss(std::ostringstream::out);
    oss << " (vendor:" << hexFmt(vendor, 4, false) << " device:" << hexFmt(device, 4, false);
    if (subvendor != 0xffff || subdevice != 0xffff)
	oss << " subv:" << hexFmt(subvendor, 4, false) << " subd:" << hexFmt(subdevice, 4, false);
    oss << ")";

    return oss.str();
}
开发者ID:DrakXtools,项目名称:ldetect,代码行数:9,代码来源:pci.cpp


示例2: oss

 std::string BaseDeviate::make_repr(bool incl_seed)
 {
     // Remember: Don't start with nothing!  See discussion in FormatAndThrow in Std.h
     std::ostringstream oss(" ");
     oss << "galsim.BaseDeviate(";
     if (incl_seed) oss << "seed='"<<serialize()<<"'";
     oss<<")";
     return oss.str();
 }
开发者ID:craiglagegit,项目名称:GalSim,代码行数:9,代码来源:Random.cpp


示例3: oss

 std::string BinomialDeviate::make_repr(bool incl_seed)
 {
     std::ostringstream oss(" ");
     oss << "galsim.BinomialDeviate(";
     if (incl_seed) oss << seedstring(split(serialize(), ' ')) << ", ";
     oss << "N="<<getN()<<", ";
     oss << "p="<<getP()<<")";
     return oss.str();
 }
开发者ID:esheldon,项目名称:GalSim,代码行数:9,代码来源:Random.cpp


示例4: oss

 std::string SBMoffat::SBMoffatImpl::serialize() const
 {
     std::ostringstream oss(" ");
     oss.precision(std::numeric_limits<double>::digits10 + 4);
     oss << "galsim._galsim.SBMoffat("<<getBeta()<<", "<<getScaleRadius();
     oss << ", None, None, "<<getTrunc()<<", "<<getFlux();
     oss << ", galsim.GSParams("<<*gsparams<<"))";
     return oss.str();
 }
开发者ID:AriannaLanz,项目名称:GalSim,代码行数:9,代码来源:SBMoffat.cpp


示例5: main

int main(int argc, char* argv[]) {
    if (argc != 3) {
        std::cout << "usage: " << argv[0] << " hash file " << std::endl;
        std::cout << "       check the MD5 hash of a file" << std::endl;
        std::cout << "       Adobe Source Libraries v" << ADOBE_VERSION_MAJOR << "."
                  << ADOBE_VERSION_MINOR << "." << ADOBE_VERSION_SUBMINOR << std::endl;
        std::cout << "       Boost v" << BOOST_VERSION / 100000 << "." << BOOST_VERSION / 100 % 1000
                  << "." << BOOST_VERSION % 100 << std::endl;

        return 1;
    }

    bool success = false;

    try {
        adobe::md5_t m;
        boost::filesystem::path file_path(argv[2]);
        boost::filesystem::ifstream stream(file_path, std::ios::binary | std::ios::in);

        while (stream.good()) {
            boost::array<std::ifstream::char_type, 256 * 1024> buffer;

            stream.read(&buffer[0], static_cast<std::streamsize>(buffer.size()));

            std::streamsize gcount(stream.gcount());

            if (gcount > 0)
                m.update(&buffer[0], static_cast<std::size_t>(gcount));
        }

        adobe::md5_t::digest_t hash(m.final());
        adobe::md5_t::digest_t::iterator first(hash.begin());
        adobe::md5_t::digest_t::iterator last(hash.end());

        std::string actual;
        std::ostringstream oss(actual);
        for (; first != last; ++first) {
            oss.width(2);
            oss << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(*first);
        }


        std::string expected(argv[1]);
        success = oss.str() == expected;
        if (!success)
            std::cout << "Expected: " << expected << " actual: " << oss.str() << std::endl;
    }

    catch (const std::exception& error) {
        std::cerr << "Exception: " << error.what() << std::endl;
    }
    catch (...) {
        std::cerr << "Unknown exception" << std::endl;
    }
    return success ? 0 : 1;
}
开发者ID:BobArcher,项目名称:adobe_source_libraries,代码行数:56,代码来源:check_md5.cpp


示例6: str

//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerTest::EresParseAndSerializePlan
//
//	@doc:
//		Verifies that after parsing the given DXL file into a DXL tree,
//		it will be serialized back to the same string.
//
//---------------------------------------------------------------------------
GPOS_RESULT
CParseHandlerTest::EresParseAndSerializePlan
	(
	IMemoryPool *pmp,
	const CHAR *szDXLFileName,
	BOOL fValidate
	)
{
	CWStringDynamic str(pmp);
	COstreamString oss(&str);
	
	// read DXL file
	CHAR *szDXL = CDXLUtils::SzRead(pmp, szDXLFileName);

	GPOS_CHECK_ABORT;
		
	const CHAR *szValidationPath = NULL;
	
	if (fValidate)
	{  
	   szValidationPath = CTestUtils::m_szXSDPath;
	}

	// the root of the parsed DXL tree
	ULLONG ullPlanId = ULLONG_MAX;
	ULLONG ullPlanSpaceSize = ULLONG_MAX;
	CDXLNode *pdxlnRoot = CDXLUtils::PdxlnParsePlan(pmp, szDXL, szValidationPath, &ullPlanId, &ullPlanSpaceSize);
	
	GPOS_CHECK_ABORT;

	oss << "Serializing parsed tree" << std::endl;

	CWStringDynamic strPlan(pmp);
	COstreamString osPlan(&strPlan);

	CDXLUtils::SerializePlan(pmp, osPlan, pdxlnRoot, ullPlanId, ullPlanSpaceSize, true /*fSerializeHeaderFooter*/, true /*fIndent*/);

	GPOS_CHECK_ABORT;

	CWStringDynamic dstrExpected(pmp);
	dstrExpected.AppendFormat(GPOS_WSZ_LIT("%s"), szDXL);

	if (!dstrExpected.FEquals(&strPlan))
	{
		GPOS_TRACE(dstrExpected.Wsz());
		GPOS_TRACE(strPlan.Wsz());

		GPOS_ASSERT(!"Not matching");
	}
	
	// cleanup
	pdxlnRoot->Release();
	GPOS_DELETE_ARRAY(szDXL);
	
	return GPOS_OK;
}
开发者ID:whatcat,项目名称:gporca,代码行数:65,代码来源:CParseHandlerTest.cpp


示例7: str

//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerTest::EresParseAndSerializePlan
//
//	@doc:
//		Verifies that after parsing the given DXL file into a DXL tree,
//		it will be serialized back to the same string.
//
//---------------------------------------------------------------------------
GPOS_RESULT
CParseHandlerTest::EresParseAndSerializePlan
	(
	IMemoryPool *mp,
	const CHAR *dxl_filename,
	BOOL fValidate
	)
{
	CWStringDynamic str(mp);
	COstreamString oss(&str);
	
	// read DXL file
	CHAR *dxl_string = CDXLUtils::Read(mp, dxl_filename);

	GPOS_CHECK_ABORT;
		
	const CHAR *szValidationPath = NULL;
	
	if (fValidate)
	{  
	   szValidationPath = CTestUtils::m_szXSDPath;
	}

	// the root of the parsed DXL tree
	ULLONG plan_id = gpos::ullong_max;
	ULLONG plan_space_size = gpos::ullong_max;
	CDXLNode *root_dxl_node = CDXLUtils::GetPlanDXLNode(mp, dxl_string, szValidationPath, &plan_id, &plan_space_size);
	
	GPOS_CHECK_ABORT;

	oss << "Serializing parsed tree" << std::endl;

	CWStringDynamic strPlan(mp);
	COstreamString osPlan(&strPlan);

	CDXLUtils::SerializePlan(mp, osPlan, root_dxl_node, plan_id, plan_space_size, true /*serialize_header_footer*/, true /*indentation*/);

	GPOS_CHECK_ABORT;

	CWStringDynamic dstrExpected(mp);
	dstrExpected.AppendFormat(GPOS_WSZ_LIT("%s"), dxl_string);

	if (!dstrExpected.Equals(&strPlan))
	{
		GPOS_TRACE(dstrExpected.GetBuffer());
		GPOS_TRACE(strPlan.GetBuffer());

		GPOS_ASSERT(!"Not matching");
	}
	
	// cleanup
	root_dxl_node->Release();
	GPOS_DELETE_ARRAY(dxl_string);
	
	return GPOS_OK;
}
开发者ID:b-xiang,项目名称:gporca,代码行数:65,代码来源:CParseHandlerTest.cpp


示例8: oss

 std::string SBAdd::SBAddImpl::repr() const 
 {
     std::ostringstream oss(" ");
     oss << "galsim._galsim.SBAdd([";
     ConstIter sptr = _plist.begin(); 
     oss << sptr->repr();
     for (++sptr; sptr!=_plist.end(); ++sptr) oss << ", " << sptr->repr();
     oss << "], galsim.GSParams("<<*gsparams<<"))";
     return oss.str();
 }
开发者ID:craiglagegit,项目名称:GalSim,代码行数:10,代码来源:SBAdd.cpp


示例9: writeU16

void NodeMetadata::serialize(std::ostream &os)
{
	u8 buf[2];
	writeU16(buf, typeId());
	os.write((char*)buf, 2);

	std::ostringstream oss(std::ios_base::binary);
	serializeBody(oss);
	os<<serializeString(oss.str());
}
开发者ID:Jobava,项目名称:Voxelands,代码行数:10,代码来源:nodemetadata.cpp


示例10: oss

string  uniqAlUnitColumnCollection::print(const vocTable & voc) const {
  ostringstream oss("");
  int count=0;
  for (vector<uniqAlUnitColumn>::const_iterator it=collection.begin();it!=collection.end();++it){
    //    if (it != collection.begin()){oss<<", ";}
    oss<<count<<" ["<<it->print(voc)<<"] ";
    ++count;
  }
  return oss.str();
}
开发者ID:patrik-lambert,项目名称:bia-aligner,代码行数:10,代码来源:alUnit.cpp


示例11: oss

 std::string SBAutoCorrelate::SBAutoCorrelateImpl::serialize() const
 {
     std::ostringstream oss(" ");
     oss.precision(std::numeric_limits<double>::digits10 + 4);
     oss << "galsim._galsim.SBAutoCorrelate(" << _adaptee.serialize() << ", ";
     if (_real_space) oss << "True";
     else oss << "False";
     oss << ", galsim.GSParams("<<*gsparams<<"))";
     return oss.str();
 }
开发者ID:AriannaLanz,项目名称:GalSim,代码行数:10,代码来源:SBConvolve.cpp


示例12: mda

//---------------------------------------------------------------------------
//	@function:
//		CMDAccessorTest::EresUnittest_Navigate
//
//	@doc:
//		Test fetching a MD object from the cache and navigating its dependent
//		objects
//
//---------------------------------------------------------------------------
GPOS_RESULT
CMDAccessorTest::EresUnittest_Navigate()
{
	CAutoMemoryPool amp;
	IMemoryPool *mp = amp.Pmp();
	
	// setup a file-based provider
	CMDProviderMemory *pmdp = CTestUtils::m_pmdpf;
	pmdp->AddRef();

	CMDAccessor mda(mp, CMDCache::Pcache(), CTestUtils::m_sysidDefault, pmdp);
	
	// lookup a function in the MD cache
	CMDIdGPDB *mdid_func = GPOS_NEW(mp) CMDIdGPDB(GPDB_FUNC_TIMEOFDAY /* OID */, 1 /* major version */, 0 /* minor version */);

	const IMDFunction *pmdfunc = mda.RetrieveFunc(mdid_func);
	
	// lookup function return type
	IMDId *pmdidFuncReturnType = pmdfunc->GetResultTypeMdid();
	const IMDType *pimdtype = mda.RetrieveType(pmdidFuncReturnType);
		
	// lookup equality operator for function return type
	IMDId *pmdidEqOp = pimdtype->GetMdidForCmpType(IMDType::EcmptEq);

#ifdef GPOS_DEBUG
	const IMDScalarOp *md_scalar_op =
#endif
	mda.RetrieveScOp(pmdidEqOp);
		
#ifdef GPOS_DEBUG
	// print objects
	CWStringDynamic str(mp);
	COstreamString oss(&str);
	
	oss << std::endl;
	oss << std::endl;

	pmdfunc->DebugPrint(oss);
	oss << std::endl;

	pimdtype->DebugPrint(oss);
	oss << std::endl;
	
	md_scalar_op->DebugPrint(oss);
	oss << std::endl;
					
	GPOS_TRACE(str.GetBuffer());
	
#endif
	
	mdid_func->Release();
	
	return GPOS_OK;
}
开发者ID:b-xiang,项目名称:gporca,代码行数:63,代码来源:CMDAccessorTest.cpp


示例13: oss

// Generates a human-readable string representation of a token.
std::string Token::toString()
{
	std::ostringstream oss("");
	oss << "[Token]" 
		<< "\nText: \"" << stringValue << "\""
		<< "\nFile: \"" << tokenFileName << "\""
		<< "\nLocation: Line " << tokenLocation.first_line << "." << tokenLocation.first_column << " - " 
		<< tokenLocation.last_line << "." << tokenLocation.last_column 
		<< std::endl;
	return oss.str();
}
开发者ID:smallzhan,项目名称:cplus2asp,代码行数:12,代码来源:Token.cpp


示例14: tryStringFind

void tryStringFind()
{
    std::ostringstream oss(std::ostringstream::out);
    oss<<"ls -l | wc -w";

    std::string cmd = oss.str();
    std::string mem1(10,' ');
    std::copy(cmd.begin(), std::find(cmd.begin(), cmd.end(), '|'), mem1.begin());

    std::cout<<"cmd : "<<cmd<<std::endl;
    std::cout<<"membre1 : "<<mem1<<std::endl;
}
开发者ID:NiNjA-CodE,项目名称:C_CPP,代码行数:12,代码来源:algorithm.cpp


示例15: oss

bool v4l_capture::init_all(size_t _width, size_t _height, unsigned int _devId)
{
  width = _width;
  height = _height;
  std::ostringstream oss("");
  oss << "/dev/video" << _devId;
  dev_name = oss.str();
  if (!open_device()) return false;
  init_device();
  if (!start_capturing()) return false;
  return true;
}
开发者ID:YoheiKakiuchi,项目名称:hrpsys-base,代码行数:12,代码来源:camera.cpp


示例16: writeConfigurationToFile

	void writeConfigurationToFile()
	{
		std::ofstream oss("settings.lua");
		oss << "setfenv(1, Configuration);" << std::endl;
		oss << "setResolution( " << int(screenWidth) << ", " << int(screenHeight) << " );" << std::endl;
		oss << "setBpp( " << int(bpp) << " );" << std::endl;
		oss << "useFullscreen( " << std::boolalpha << fullscreenenabled << " );" << std::endl;
		oss << "showDebugStdout( " << std::boolalpha <<  debug_stdout << " );" << std::endl;
		oss << "showDebugFileout( " << std::boolalpha << debug_fileout << " );" << std::endl;
		oss << "showInfoMessages( " << std::boolalpha << show_info_messages << " );" << std::endl;
		oss << "showWarningMessages( " << std::boolalpha << show_warn_messages << " );" << std::endl;
	}
开发者ID:Faultless,项目名称:Dawn,代码行数:12,代码来源:configuration.cpp


示例17: spliceVectorToStringByDelim

std::string spliceVectorToStringByDelim(const std::vector<std::string> &elts, const std::string& delim)
{
    std::ostringstream oss("");
    
    if (elts.empty() == false) {
        std::vector<std::string>::const_iterator it = elts.begin(), end = elts.end();
        std::copy(it, end - 1, std::ostream_iterator<std::string>(oss, delim.c_str()));

        oss << *(end - 1);
    }

    return oss.str();
}
开发者ID:fieldwind,项目名称:syncsdk,代码行数:13,代码来源:baseutils.cpp


示例18: oss

string linkCluster::print() const {
  ostringstream oss("");
  for (vector<int>::const_iterator p=sPosis.begin();p!=sPosis.end();++p){
    if (p != sPosis.begin()){oss<<",";}
    oss<<*p;
  }
  oss<<"-";
  for (vector<int>::const_iterator p=tPosis.begin();p!=tPosis.end();++p){
    if (p != tPosis.begin()){oss<<",";}
    oss<<*p;
  }
  return oss.str();
}
开发者ID:patrik-lambert,项目名称:bia-aligner,代码行数:13,代码来源:linkCluster.cpp


示例19: loadGameConfAndInitWorld

bool loadGameConfAndInitWorld(const std::string &path, const SubgameSpec &gamespec)
{
	// Override defaults with those provided by the game.
	// We clear and reload the defaults because the defaults
	// might have been overridden by other subgame config
	// files that were loaded before.
	g_settings->clearDefaults();
	set_default_settings(g_settings);
	Settings game_defaults;
	getGameMinetestConfig(gamespec.path, game_defaults);
	override_default_settings(g_settings, &game_defaults);

	infostream << "Initializing world at " << path << std::endl;

	fs::CreateAllDirs(path);

	// Create world.mt if does not already exist
	std::string worldmt_path = path + DIR_DELIM "world.mt";
	if (!fs::PathExists(worldmt_path)) {
		Settings conf;

		conf.set("gameid", gamespec.id);
		conf.set("backend", "sqlite3");
		conf.set("player_backend", "sqlite3");
		conf.setBool("creative_mode", g_settings->getBool("creative_mode"));
		conf.setBool("enable_damage", g_settings->getBool("enable_damage"));

		if (!conf.updateConfigFile(worldmt_path.c_str()))
			return false;
	}

	// Create map_meta.txt if does not already exist
	std::string map_meta_path = path + DIR_DELIM + "map_meta.txt";
	if (!fs::PathExists(map_meta_path)) {
		verbosestream << "Creating map_meta.txt (" << map_meta_path << ")"
			      << std::endl;
		fs::CreateAllDirs(path);
		std::ostringstream oss(std::ios_base::binary);

		Settings conf;
		MapgenParams params;

		params.readParams(g_settings);
		params.writeParams(&conf);
		conf.writeLines(oss);
		oss << "[end_of_params]\n";

		fs::safeWriteToFile(map_meta_path, oss.str());
	}
	return true;
}
开发者ID:Gael-de-Sailly,项目名称:minetest,代码行数:51,代码来源:subgames.cpp


示例20: serialize_digest

std::string AuthStore::BinarySerializerDeserializer::
  serialize_digest(const Digest* digest)
{
  std::ostringstream oss(std::ostringstream::out|std::ostringstream::binary);
  oss << digest->_ha1 << '\0';
  oss << digest->_opaque << '\0';
  oss << digest->_nonce << '\0';
  oss << digest->_impi << '\0';
  oss << digest->_realm << '\0';
  oss.write((const char *)&digest->_nonce_count, sizeof(int));
  oss << digest->_impu << '\0';

  return oss.str();
}
开发者ID:Metaswitch,项目名称:memento,代码行数:14,代码来源:authstore.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ ossimNotify函数代码示例发布时间:2022-05-30
下一篇:
C++ ospfs_inode函数代码示例发布时间: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