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


C++ String::rfind方法代码示例

本文整理汇总了C++中ogre::String::rfind方法的典型用法代码示例。如果您正苦于以下问题:C++ String::rfind方法的具体用法?C++ String::rfind怎么用?C++ String::rfind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ogre::String的用法示例。


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

示例1: getConfigPaths

    //---------------------------------------------------------------------
    void FileSystemLayer::getConfigPaths()
    {
        // try to determine the application's path:
        // recent systems should provide the executable path via the /proc system
        Ogre::String appPath = resolveSymlink("/proc/self/exe");
        if (appPath.empty())
        {
            // if /proc/self/exe isn't available, try it via the program's pid
            pid_t pid = getpid();
            char proc[64];
            int retval = snprintf(proc, sizeof(proc), "/proc/%llu/exe", (unsigned long long) pid);
            if (retval > 0 && retval < (long)sizeof(proc))
                appPath = resolveSymlink(proc);
        }

        if (!appPath.empty())
        {
            // we need to strip the executable name from the path
            Ogre::String::size_type pos = appPath.rfind('/');
            if (pos != Ogre::String::npos)
                appPath.erase(pos);
        }
        else
        {
            // couldn't find actual executable path, assume current working dir
            appPath = ".";
        }

        // use application path as first config search path
        mConfigPaths.push_back(appPath + '/');
        // then search inside ../share/OGRE
        mConfigPaths.push_back(appPath + "/../share/OGRE/");
        // then try system wide /etc
        mConfigPaths.push_back("/etc/OGRE/");
    }
开发者ID:terakuran,项目名称:ogre,代码行数:36,代码来源:OgreFileSystemLayer.cpp

示例2: getConfigPaths

	void FileSystemLayer::getConfigPaths()
	{
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
		// try to determine the application's path
		DWORD bufsize = 256;
		char* resolved = 0;
		do
		{
			char* buf = OGRE_ALLOC_T(char, bufsize, Ogre::MEMCATEGORY_GENERAL);
			DWORD retval = GetModuleFileName(NULL, buf, bufsize);
			if (retval == 0)
			{
				// failed
				OGRE_FREE(buf, Ogre::MEMCATEGORY_GENERAL);
				break;
			}

			if (retval < bufsize)
			{
				// operation was successful.
				resolved = buf;
			}
			else
			{
				// buffer was too small, grow buffer and try again
				OGRE_FREE(buf, Ogre::MEMCATEGORY_GENERAL);
				bufsize <<= 1;
			}
		} while (!resolved);

		Ogre::String appPath = resolved;
		if (resolved)
			OGRE_FREE(resolved, Ogre::MEMCATEGORY_GENERAL);
		if (!appPath.empty())
		{
			// need to strip the application filename from the path
			Ogre::String::size_type pos = appPath.rfind('\\');
			if (pos != Ogre::String::npos)
				appPath.erase(pos);
		}
		else
		{
			// fall back to current working dir
			appPath = ".";
		}

#elif OGRE_PLATFORM == OGRE_PLATFORM_WINRT
		Ogre::String appPath;
		if(!widePathToOgreString(appPath, Windows::ApplicationModel::Package::Current->InstalledLocation->Path->Data()))
		{
			// fallback to current working dir
			appPath = ".";
		}
#endif

		// use application path as config search path
		mConfigPaths.push_back(appPath + '\\');
	}
开发者ID:Ali-il,项目名称:gamekit,代码行数:58,代码来源:OgreFileSystemLayer.cpp


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