本文整理汇总了C++中Any函数的典型用法代码示例。如果您正苦于以下问题:C++ Any函数的具体用法?C++ Any怎么用?C++ Any使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Any函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: switch
// 获取属性值
Any TriggerObject::getProperty(uint id)const
{
if(id > ID_NullObject_Begin && id < ID_NullObject_End)
return NullObject::getProperty(id);
switch(id)
{
case ID_Trigger: // 触发器设置
{
return Any();
}
break;
case ID_TriggerCondition: // 满足条件
{
return Any(getCondition());
}
break;
case ID_TriggerOnEnterEvent: // 进入事件
{
return Any(getOnEnterEvent());
}
break;
case ID_TriggerOnLeaveEvent: // 退出事件
{
return Any(getOnLeaveEvent());
}
break;
default:
return Any();
break;
}
}
开发者ID:duzhi5368,项目名称:FKOgreWorldEdit,代码行数:32,代码来源:TriggerObject.cpp
示例2: PageData
//---------------------------------------------------------------------
WorkQueue::Response* Page::handleRequest(const WorkQueue::Request* req, const WorkQueue* srcQ)
{
// Background thread (maybe)
PageRequest preq = any_cast<PageRequest>(req->getData());
// only deal with own requests; we shouldn't ever get here though
if (preq.srcPage != this)
return 0;
PageResponse res;
res.pageData = OGRE_NEW PageData();
WorkQueue::Response* response = 0;
try
{
prepareImpl(res.pageData);
response = OGRE_NEW WorkQueue::Response(req, true, Any(res));
}
catch (Exception& e)
{
// oops
response = OGRE_NEW WorkQueue::Response(req, false, Any(res),
e.getFullDescription());
}
return response;
}
开发者ID:JangoOs,项目名称:kbengine_ogre_demo,代码行数:27,代码来源:OgrePage.cpp
示例3: Any
//---------------------------------------------------------------------
WorkQueue::Response* TerrainPagedWorldSection::handleRequest(const WorkQueue::Request* req, const WorkQueue* srcQ)
{
if(mPagesInLoading.empty())
{
mHasRunningTasks = false;
req->abortRequest();
return OGRE_NEW WorkQueue::Response(req, true, Any());
}
unsigned long currentTime = Root::getSingletonPtr()->getTimer()->getMilliseconds();
if(currentTime < mNextLoadingTime)
{
// Wait until the next page is to be loaded -> we are in background thread here
OGRE_THREAD_SLEEP(mNextLoadingTime - currentTime);
}
PageID pageID = mPagesInLoading.front();
// call the TerrainDefiner from the background thread
long x, y;
// pageID is the same as a packed index
mTerrainGroup->unpackIndex(pageID, &x, &y);
if(!mTerrainDefiner)
mTerrainDefiner = OGRE_NEW TerrainDefiner();
mTerrainDefiner->define(mTerrainGroup, x, y);
// continue loading in main thread
return OGRE_NEW WorkQueue::Response(req, true, Any());
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:31,代码来源:OgreTerrainPagedWorldSection.cpp
示例4: if
void Preferences::onChangeHedgeSelection(int) {
fl::Engine* engine = Model::Default()->engine();
if (ui->ckx_any->isChecked() and not engine->hasHedge(Any().name()))
engine->addHedge(new Any);
else if (not ui->ckx_any->isChecked() and engine->hasHedge(Any().name()))
delete engine->removeHedge(Any().name());
if (ui->ckx_extremely->isChecked() and not engine->hasHedge(Extremely().name()))
engine->addHedge(new Extremely);
else if (not ui->ckx_extremely->isChecked() and engine->hasHedge(Extremely().name()))
delete engine->removeHedge(Extremely().name());
if (ui->ckx_not->isChecked() and not engine->hasHedge(Not().name()))
engine->addHedge(new Not);
else if (not ui->ckx_not->isChecked() and engine->hasHedge(Not().name()))
delete engine->removeHedge(Not().name());
if (ui->ckx_seldom->isChecked() and not engine->hasHedge(Seldom().name()))
engine->addHedge(new Seldom);
else if (not ui->ckx_seldom->isChecked() and engine->hasHedge(Seldom().name()))
delete engine->removeHedge(Seldom().name());
if (ui->ckx_somewhat->isChecked() and not engine->hasHedge(Somewhat().name()))
engine->addHedge(new Somewhat);
else if (not ui->ckx_somewhat->isChecked() and engine->hasHedge(Somewhat().name()))
delete engine->removeHedge(Somewhat().name());
if (ui->ckx_very->isChecked() and not engine->hasHedge(Very().name()))
engine->addHedge(new Very);
else if (not ui->ckx_very->isChecked() and engine->hasHedge(Very().name()))
delete engine->removeHedge(Very().name());
Window::mainWindow()->fixDependencies();
}
开发者ID:DevasenaInupakutika,项目名称:assn2,代码行数:34,代码来源:Preferences.cpp
示例5: Any
Any Converter<float>::convert(const Any& a)
{
if (typeid(int) == a.type())
return Any(helper<float, int>::convert(a));
else if (typeid(const char *) == a.type())
return Any(helper<float, const char *>::convert(a));
return any_cast<float>(a);
}
开发者ID:biofag,项目名称:UMOF,代码行数:9,代码来源:converters.cpp
示例6: Any
Any Converter<float>::convert(const Any& a)
{
if (Type::from<int>() == a.type())
return Any(helper<float, int>::convert(a));
else if (Type::from<const char *>() == a.type())
return Any(helper<float, const char *>::convert(a));
return any_cast<float>(a);
}
开发者ID:crazybie,项目名称:uMOF,代码行数:9,代码来源:converter.cpp
示例7: switch
// 获取属性值
Any CameraObject::getProperty(uint id)const
{
if(id > ID_NullObject_Begin && id < ID_NullObject_End)
return NullObject::getProperty(id);
switch(id)
{
case ID_Camera: // 摄像机设置
{
return Any();
}
break;
case ID_PolygonMode: // 几何渲染模式
{
return Any((long)m_camera->getPolygonMode());
}
break;
case ID_LodBias: // LOD偏移
{
return Any(m_camera->getLodBias());
}
break;
case ID_NearClipDistance: // 近裁面
{
return Any(m_camera->getNearClipDistance());
}
break;
case ID_FarClipDistance: // 远裁面
{
return Any(m_camera->getFarClipDistance());
}
break;
case ID_FOVy: // FOVy角度
{
return Any(m_camera->getFOVy().valueDegrees());
}
break;
case ID_AspectRatio: // 窗口比率
{
return Any(m_camera->getAspectRatio());
}
break;
case ID_ProjectionType: // 投影方式
{
return Any((long)m_camera->getProjectionType());
}
break;
case ID_OrthoWindow: // 正交投影窗口大小
{
return Any(Vector2(m_camera->getOrthoWindowWidth() , m_camera->getOrthoWindowHeight()));
}
break;
default:
return Any();
break;
}
}
开发者ID:duzhi5368,项目名称:FKOgreWorldEdit,代码行数:57,代码来源:CameraObject.cpp
示例8: Any
Any ArticulatedModel::Instruction::Identifier::toAny() const {
if (isAll()) {
return Any(Any::ARRAY, "all");
} else if (isRoot()) {
return Any(Any::ARRAY, "root");
} else if (id.initialized()) {
return Any(int(id));
} else {
return Any(name);
}
}
开发者ID:A7med-Shoukry,项目名称:g3d,代码行数:11,代码来源:ArticulatedModel_serialize.cpp
示例9: convertToAny
Any convertToAny(NPP npp, const NPVariant* variant)
{
switch (variant->type)
{
case NPVariantType_Void:
case NPVariantType_Null:
return Any();
break;
case NPVariantType_Bool:
return NPVARIANT_TO_BOOLEAN(*variant);
break;
case NPVariantType_Int32:
return NPVARIANT_TO_INT32(*variant);
break;
case NPVariantType_Double:
return NPVARIANT_TO_DOUBLE(*variant);
break;
case NPVariantType_String:
return std::string(NPVARIANT_TO_STRING(*variant).utf8characters, NPVARIANT_TO_STRING(*variant).utf8length);
break;
case NPVariantType_Object:
{
NPObject* object = NPVARIANT_TO_OBJECT(*variant);
if (!object)
{
break;
}
if (StubObject::isStub(object))
{
StubObject* stub = static_cast<StubObject*>(object);
return stub->getObject();
}
PluginInstance* instance = static_cast<PluginInstance*>(npp->pdata);
if (instance)
{
ProxyControl* proxyControl = instance->getProxyControl();
if (proxyControl)
{
return proxyControl->createProxy(object);
}
}
break;
}
default:
break;
}
return Any();
}
开发者ID:giobeatle1794,项目名称:es-operating-system,代码行数:48,代码来源:bridge.cpp
示例10: Any
void CCPlayer::Open(const std::string& loadParams)
{
CCMessageCenter::GetInstance()->PostMessage(MESSAGE_OBJECT_ENUM_CLIENT,
MESSAGE_OBJECT_ENUM_PLAYER,
COMMAND_TYPE_ENUM_OPEN,
Any(loadParams));
}
开发者ID:fastget,项目名称:CCPlayer_On_iOS,代码行数:7,代码来源:Player.cpp
示例11: find
//---------------------------------------------------------------------
void TerrainPagedWorldSection::loadPage(PageID pageID, bool forceSynchronous)
{
if (!mParent->getManager()->getPagingOperationsEnabled())
return;
PageMap::iterator i = mPages.find(pageID);
if (i == mPages.end())
{
std::list<PageID>::iterator it = find( mPagesInLoading.begin(), mPagesInLoading.end(), pageID);
if(it==mPagesInLoading.end())
{
mPagesInLoading.push_back(pageID);
mHasRunningTasks = true;
}
// no running tasks, start the new one
if(mPagesInLoading.size()==1)
{
Root::getSingleton().getWorkQueue()->addRequest(
mWorkQueueChannel, WORKQUEUE_LOAD_TERRAIN_PAGE_REQUEST,
Any(), 0, forceSynchronous);
}
}
PagedWorldSection::loadPage(pageID, forceSynchronous);
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:27,代码来源:OgreTerrainPagedWorldSection.cpp
示例12: RTException
void StateRoom::accessRoom()
{
INetworkRelay *network = this->_world->getSharedObject<INetworkRelay>("NetworkRelay");
if (network) {
Remote *remote = NULL;
if (this->_textboxRoom->getString() != "")
this->_textboxRoom->setString("defaulte");
if (!(remote = network->getRemote(0)))
throw RTException("Invalid remote");
IBuffer *buffer = network->getTCPBuffer();
*buffer << static_cast<char>(INetworkRelay::CHANGE_ROOM_QUERY);
*buffer << this->_textboxRoom->getString();
remote->sendTCP(buffer);
Thread<INetworkRelay> *thread = new Thread<INetworkRelay>();
thread->start(network, &INetworkRelay::start, Any());
while (42) {
LockVector<IBuffer *> &recv_buffer = remote->getRecvBufferTCP();
auto guard = create_lock(recv_buffer);
for (auto it = recv_buffer.begin(); it != recv_buffer.end();)
{
if (this->parsePacket(recv_buffer, it))
return ;
}
}
} else {
throw RTException("Invalid network");
}
}
开发者ID:deb0ch,项目名称:R-Type,代码行数:32,代码来源:StateRoom.cpp
示例13: ss
Signature TextureProxy::MakeSignature(const Proxy<res::Image> &image, vid::opengl::TextureFormat format, vid::opengl::TextureFlags flags, const math::Vector<2, bool> &clamp)
{
std::ostringstream ss(image.GetSignature());
switch (format)
{
case vid::opengl::defaultTextureFormat:
break;
case vid::opengl::alphaTextureFormat:
ss << ":alpha";
break;
case vid::opengl::luminanceTextureFormat:
ss << ":luminance";
break;
default:
assert(!"invalid texture format");
}
if (flags & vid::opengl::filterTextureFlag) ss << ":filter";
if (flags & vid::opengl::mipmapTextureFlag) ss << ":mipmap";
if (Any(clamp))
{
ss << ":clamp";
if (!clamp.x) ss << ".y";
else if (!clamp.y) ss << ".x";
}
return Signature("OpenGL texture", ss.str());
}
开发者ID:davidosborn,项目名称:page,代码行数:26,代码来源:TextureProxy.cpp
示例14: Room
RoomServer::RoomServer(ServerRelay *server, const std::string &nameRoomServer)
: Room(), _serverRelay(server), _nameRoomServer(nameRoomServer)
{
std::cout << "Creating new room: " << this->_nameRoomServer << std::endl;
this->_runWorldServer = new RunWorldServer(server, nameRoomServer);
this->_thread.start(this->_runWorldServer, &RunWorldServer::run, Any());
}
开发者ID:deb0ch,项目名称:R-Type,代码行数:7,代码来源:RoomServer.cpp
示例15: inputStream
void Instance::LoadModList()
{
if (GetModListFile().FileExists())
{
wxFileInputStream inputStream(GetModListFile().GetFullPath());
wxStringList modListFile = ReadAllLines(inputStream);
for (wxStringList::iterator iter = modListFile.begin(); iter != modListFile.end(); iter++)
{
// Normalize the path to the instMods dir.
wxFileName modFile(*iter);
modFile.Normalize(wxPATH_NORM_ALL, GetInstModsDir().GetFullPath());
modFile.MakeRelativeTo();
if (!Any(modList.begin(), modList.end(), [&modFile] (Mod mod) -> bool
{ return mod.GetFileName().SameAs(wxFileName(modFile)); }))
{
//SetNeedsRebuild();
modList.push_back(Mod(modFile));
}
}
}
for (size_t i = 0; i < modList.size(); i++)
{
if (!modList[i].GetFileName().FileExists())
{
SetNeedsRebuild();
modList.erase(modList.begin() + i);
i--;
}
}
LoadModListFromDir(GetInstModsDir());
}
开发者ID:bartbes,项目名称:MultiMC4,代码行数:35,代码来源:instance.cpp
示例16: Any
void GameObject::createGameObject(const String &name, const String &meshName)
{
mEntity = mSceneMgr->createEntity(generateName(name), meshName);
mSceneNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
mSceneNode->getUserObjectBindings().setUserAny("GameObject", Any(this));
mSceneNode->attachObject(mEntity);
}
开发者ID:keinerweiss,项目名称:3DGPProject,代码行数:7,代码来源:GameObject.cpp
示例17: ServiceControl
void ServiceControl(int offset, const std::string& operation, int ranking)
{
if (0 <= offset && offset <= 3)
{
if (operation == "register")
{
if (!servregs[offset])
{
std::stringstream servicename;
servicename << SERVICE << offset;
InterfaceMap ifm;
ifm.insert(std::make_pair(servicename.str(), static_cast<void*>(this)));
ServiceProperties props;
props.insert(std::make_pair(ServiceConstants::SERVICE_RANKING(), Any(ranking)));
servregs[offset] = mc->RegisterService(ifm, props);
}
}
if (operation == "unregister")
{
if (servregs[offset])
{
ServiceRegistrationU sr1 = servregs[offset];
sr1.Unregister();
servregs[offset] = 0;
}
}
}
}
开发者ID:GHfangxin,项目名称:MITK,代码行数:28,代码来源:usTestModuleS.cpp
示例18: csharpformat
std::string csharpformat(std::string fmt, T1 t1)
{
std::vector<streamable> args;
args.push_back(Any(t1));
csharpformat(fmt, arga);
}
开发者ID:GoMani,项目名称:Mervin,代码行数:7,代码来源:logger.cpp
示例19: switch
Any& Any::operator=(Type t) {
switch (t) {
case NONE:
*this = Any();
break;
case TABLE:
case ARRAY:
*this = Any(t);
break;
default:
alwaysAssertM(false, "Can only assign NONE, TABLE, or ARRAY Type enum.");
}
return *this;
}
开发者ID:lev1976g,项目名称:easywow,代码行数:17,代码来源:Any.cpp
示例20: Any
GLight::operator Any() const {
Any a(Any::TABLE, "GLight");
a.set("position", position.operator Any());
a.set("rightDirection", rightDirection.operator Any());
a.set("spotDirection", spotDirection.operator Any());
a.set("spotCutoff", spotCutoff);
a.set("spotSquare", spotSquare);
Any att(Any::ARRAY);
att.append(attenuation[0], attenuation[1], attenuation[2]);
a.set("attenuation", att);
a.set("color", color.operator Any());
a.set("enabled", enabled);
a.set("specular", specular);
a.set("diffuse", diffuse);
return a;
}
开发者ID:Blumfield,项目名称:TBCPvP,代码行数:17,代码来源:GLight.cpp
注:本文中的Any函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论