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


C++ platform类代码示例

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


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

示例1: MakePipe

pair<UniqueHandle, UniqueHandle>
MakePipe()
{
#	if YCL_Win32
	::HANDLE h_raw_read, h_raw_write;

	YCL_CallWin32F(CreatePipe, &h_raw_read, &h_raw_write, {}, 0);

	UniqueHandle h_read(h_raw_read), h_write(h_raw_write);

	YCL_CallWin32F(SetHandleInformation, h_write.get(), HANDLE_FLAG_INHERIT,
		HANDLE_FLAG_INHERIT);
	return {std::move(h_read), std::move(h_write)};
#	elif YCL_API_Has_unistd_h
	int fds[2];

	// TODO: Check whether '::socketpair' is available.
	if(::pipe(fds) != 0)
		ThrowFileOperationFailure("Failed getting file size.");

	auto pr(make_pair(UniqueHandle(fds[0]), UniqueHandle(fds[1])));
	auto check([](UniqueHandle& h, const char* msg){
		// NOTE: %O_NONBLOCK is initially cleared on ::pipe results.
		//	See http://pubs.opengroup.org/onlinepubs/9699919799/.
		if(!(h && h->SetNonblocking()))
			ThrowFileOperationFailure(msg);
	});

	check(pr.first, "Failed making pipe for reading."),
	check(pr.second, "Failed making pipe for writing.");
	return pr;
#	else
#	error "Unsupported platform found."
#	endif
}
开发者ID:xuxiaowei007,项目名称:YSLib,代码行数:35,代码来源:Host.cpp

示例2: dir_name

DirectoryFindData::DirectoryFindData(const wstring& name)
	: dir_name(name), find_data()
{
	if(ystdex::rtrim(dir_name, L"/\\").empty())
		dir_name = L'.';
	YAssert(dir_name.back() != '\\', "Invalid argument found.");

	using platform::FileOperationFailure;
	const auto attr(::GetFileAttributesW(dir_name.c_str()));
	yconstexpr const auto& msg("Opening directory failed.");

	if(YB_UNLIKELY(attr == INVALID_FILE_ATTRIBUTES))
		// TODO: Call %::GetLastError to distinguish concreate errors.
		throw FileOperationFailure(EINVAL, std::generic_category(), msg);
	if(attr & FILE_ATTRIBUTE_DIRECTORY)
		dir_name += L"\\*";
	else
		throw FileOperationFailure(ENOTDIR, std::generic_category(), msg);
}
开发者ID:jwk000,项目名称:YSLib,代码行数:19,代码来源:MinGW32.cpp

示例3: get_device_ids

 cl_device_id  clutil_platform::get_device_ids(cl_device_type device_type)
 {
     return platform_util->get_device_ids(device_type);
 }
开发者ID:rchatsiri,项目名称:techniquecpp,代码行数:4,代码来源:clutil_platform.hpp

示例4: get_source_size

 std::size_t clutil_platform::get_source_size()
 {
     return platform_util->get_source_size();
 }
开发者ID:rchatsiri,项目名称:techniquecpp,代码行数:4,代码来源:clutil_platform.hpp

示例5: cl_build_programs

 void clutil_platform::cl_build_programs()
 {
     platform_util->cl_build_programs();
 }
开发者ID:rchatsiri,项目名称:techniquecpp,代码行数:4,代码来源:clutil_platform.hpp

示例6: cl_create_programs_with_source

 void clutil_platform::cl_create_programs_with_source()
 {
     platform_util->cl_create_programs_with_source();
 }
开发者ID:rchatsiri,项目名称:techniquecpp,代码行数:4,代码来源:clutil_platform.hpp

示例7: cl_create_context

 void clutil_platform::cl_create_context()
 {
     platform_util->cl_create_context();
 }
开发者ID:rchatsiri,项目名称:techniquecpp,代码行数:4,代码来源:clutil_platform.hpp

示例8: context_properties

 void  clutil_platform::context_properties()
 {
     platform_util->context_properties();
 }
开发者ID:rchatsiri,项目名称:techniquecpp,代码行数:4,代码来源:clutil_platform.hpp

示例9: get_platform_ids

 cl_platform_id  clutil_platform::get_platform_ids()
 {
     return platform_util->get_platform_ids();
 }
开发者ID:rchatsiri,项目名称:techniquecpp,代码行数:4,代码来源:clutil_platform.hpp

示例10: AutoId

ItemLoaderRepo::ItemLoaderRepo()
    : Repository<PropertyLoaderBase<Item> >( mDefault )
{
    int32_t id = AutoId( "plasma_gun" );
    mElements.insert( id, new PlasmaGunLoader() );
    id = AutoId( "guard_plasma_gun" );
    mElements.insert( id, new PlasmaGunLoader() );
    id = AutoId( "pistol" );
    mElements.insert( id, new PistolLoader() );
    id = AutoId( "shotgun" );
    mElements.insert( id, new ShotgunLoader() );
    id = AutoId( "rocket_launcher" );
    mElements.insert( id, new RocketLauncherLoader() );
    id = AutoId( "ion_gun" );
    mElements.insert( id, new IonGunLoader() );
    id = AutoId( "gatling_gun" );
    mElements.insert( id, new GatlingGunLoader() );
    id = AutoId( "gauss_gun" );
    mElements.insert( id, new GaussGunLoader() );
    id = AutoId( "lucky_rocket" );
    mElements.insert( id, new LuckyRocketLoader() );
    id = AutoId("rusty_reaper"); 
    mElements.insert(id, new RustyReaperLoader());
    Init();
}
开发者ID:HalalUr,项目名称:Reaping2,代码行数:25,代码来源:item_loader_factory.cpp

示例11:

RenderableLayer::RenderableLayer()
{
    mIdToRendLayerMap[AutoId( "background" )] = RenderableLayer::Background;
    mIdToRendLayerMap[AutoId( "background_1" )] = RenderableLayer::Background_1;
    mIdToRendLayerMap[AutoId( "corpses" )] = RenderableLayer::Corpses;
    mIdToRendLayerMap[AutoId( "creeps" )] = RenderableLayer::Creeps;
    mIdToRendLayerMap[AutoId( "players" )] = RenderableLayer::Players;
    mIdToRendLayerMap[AutoId( "buildings" )] = RenderableLayer::Buildings;
}
开发者ID:HalalUr,项目名称:Reaping2,代码行数:9,代码来源:renderable_layer.cpp

示例12: LoadItemFromOneDesc

bool ItemLoaderRepo::LoadItemFromOneDesc( Json::Value& ItemDesc )
{
    std::string nameStr;
    if( !Json::GetStr( ItemDesc["name"], nameStr ) )
    {
        return false;
    }
    PropertyLoaderBase<Item>& itemLoader = operator()( AutoId( nameStr ) );

    Json::Value& setters = ItemDesc["set"];
    if ( !setters.isArray() )
    {
        return false;
    }
    if ( setters.empty() )
    {
        return true;
    }
    L1( "Load item_loader: %s\n", nameStr.c_str() );
    itemLoader.Load( *setters.begin() );
    return true;
}
开发者ID:HalalUr,项目名称:Reaping2,代码行数:22,代码来源:item_loader_factory.cpp

示例13: getY

int fish::getY()
   {
      return plat.getY();
   }
开发者ID:lxyyxl638,项目名称:Fishtank,代码行数:4,代码来源:fish.cpp

示例14: getExp

int fish::getExp()
   {
      return plat.getExp();
   }
开发者ID:lxyyxl638,项目名称:Fishtank,代码行数:4,代码来源:fish.cpp

示例15: askHP

int fish::askHP(int ID)
   {
       return plat.askHP(ID);
   }
开发者ID:lxyyxl638,项目名称:Fishtank,代码行数:4,代码来源:fish.cpp


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