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


C++ stringc::size方法代码示例

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


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

示例1: isInSameDirectory

//! looks if file is in the same directory of path. returns offset of directory.
//! 0 means in same directory. 1 means file is direct child of path
		s32 ioutils::isInSameDirectory(const core::stringc& path,
				const core::stringc& file)
		{
			s32 subA = 0;
			s32 subB = 0;
			s32 pos;

			if (path.size() && !path.equalsn(file, path.size()))
				return -1;

			pos = 0;
			while ((pos = path.findFirst('/', pos)) >= 0)
			{
				subA += 1;
				pos += 1;
			}

			pos = 0;
			while ((pos = file.findFirst('/', pos)) >= 0)
			{
				subB += 1;
				pos += 1;
			}

			return subB - subA;
		}
开发者ID:CowPlay,项目名称:irrgame_sdk,代码行数:28,代码来源:ioutils.cpp

示例2: getFileBasename

//! returns the base part of a filename, i.e. all except for the directory
//! part. If no directory path is prefixed, the full name is returned.
core::stringc CFileSystem::getFileBasename(const core::stringc& filename, bool keepExtension) const
{
    // find last forward or backslash
    s32 lastSlash = filename.findLast('/');
    const s32 lastBackSlash = filename.findLast('\\');
    lastSlash = core::max_(lastSlash, lastBackSlash);

    // get number of chars after last dot
    s32 end = 0;
    if (!keepExtension)
    {
        // take care to search only after last slash to check only for
        // dots in the filename
        end = filename.findLast('.', lastSlash);
        if (end == -1)
            end=0;
        else
            end = filename.size()-end;
    }

    if ((u32)lastSlash < filename.size())
        return filename.subString(lastSlash+1, filename.size()-lastSlash-1-end);
    else if (end != 0)
        return filename.subString(0, filename.size()-end);
    else
        return filename;
}
开发者ID:jivibounty,项目名称:irrlicht,代码行数:29,代码来源:CFileSystem.cpp

示例3: writeMeshASCII

bool CSTLMeshWriter::writeMeshASCII(io::IWriteFile* file, scene::IMesh* mesh, s32 flags)
{
	// write STL MESH header

	file->write("solid ",6);
	const core::stringc name(SceneManager->getMeshCache()->getMeshFilename(mesh));
	file->write(name.c_str(),name.size());
	file->write("\n\n",2);

	// write mesh buffers
	
	for (u32 i=0; i<mesh->getMeshBufferCount(); ++i)
	{
		IMeshBuffer* buffer = mesh->getMeshBuffer(i);
		if (buffer)
		{
			const u16 indexCount = buffer->getIndexCount();

			switch(buffer->getVertexType())
			{
			case video::EVT_STANDARD:
				{
					video::S3DVertex* vtx = (video::S3DVertex*)buffer->getVertices();
					for (u32 j=0; j<indexCount; j+=3)
						writeFace(file,
							vtx[buffer->getIndices()[j]].Pos,
							vtx[buffer->getIndices()[j+1]].Pos,
							vtx[buffer->getIndices()[j+2]].Pos);
				}
				break;
			case video::EVT_2TCOORDS:
				{
					video::S3DVertex2TCoords* vtx = (video::S3DVertex2TCoords*)buffer->getVertices();
					for (u32 j=0; j<indexCount; j+=3)
						writeFace(file,
							vtx[buffer->getIndices()[j]].Pos,
							vtx[buffer->getIndices()[j+1]].Pos,
							vtx[buffer->getIndices()[j+2]].Pos);
				}
				break;
			case video::EVT_TANGENTS:
				{
					video::S3DVertexTangents* vtx = (video::S3DVertexTangents*)buffer->getVertices();
					for (u32 j=0; j<indexCount; j+=3)
						writeFace(file,
							vtx[buffer->getIndices()[j]].Pos,
							vtx[buffer->getIndices()[j+1]].Pos,
							vtx[buffer->getIndices()[j+2]].Pos);
				}
				break;
			}
			file->write("\n",1);
		}
	}

	file->write("endsolid ",9);
	file->write(name.c_str(),name.size());

	return true;
}
开发者ID:jivibounty,项目名称:irrlicht,代码行数:60,代码来源:CSTLMeshWriter.cpp

示例4: writeMeshASCII

bool CSTLMeshWriter::writeMeshASCII(io::IWriteFile* file, scene::IMesh* mesh, s32 flags)
{
	// write STL MESH header

	file->write("solid ",6);
	const core::stringc name(SceneManager->getMeshCache()->getMeshName(mesh));
	file->write(name.c_str(),name.size());
	file->write("\n\n",2);

	// write mesh buffers

	for (u32 i=0; i<mesh->getMeshBufferCount(); ++i)
	{
		IMeshBuffer* buffer = mesh->getMeshBuffer(i);
		if (buffer)
		{
			const u32 indexCount = buffer->getIndexCount();
			for (u32 j=0; j<indexCount; j+=3)
			{
				writeFace(file,
					buffer->getPosition(buffer->getIndices()[j]),
					buffer->getPosition(buffer->getIndices()[j+1]),
					buffer->getPosition(buffer->getIndices()[j+2]));
			}
			file->write("\n",1);
		}
	}

	file->write("endsolid ",9);
	file->write(name.c_str(),name.size());

	return true;
}
开发者ID:Aeshylus,项目名称:Test,代码行数:33,代码来源:CSTLMeshWriter.cpp

示例5: isimg

bool FileSceneNode::isimg(core::stringc name) {
    if ((name.subString(name.size() - 4, 4).equals_ignore_case(".bmp")) ||
            (name.subString(name.size() - 4, 4).equals_ignore_case(".jpg")) ||
            (name.subString(name.size() - 4, 4).equals_ignore_case(".tga")) ||
            (name.subString(name.size() - 4, 4).equals_ignore_case(".pcx")) ||
            (name.subString(name.size() - 4, 4).equals_ignore_case(".png")) ||
            (name.subString(name.size() - 4, 4).equals_ignore_case(".psd")))
        return true;
    return false;
}
开发者ID:echoline,项目名称:IrrGUI,代码行数:10,代码来源:FileSceneNode.cpp

示例6: isanimesh

bool FileSceneNode::isanimesh(core::stringc name) {
    if ((name.subString(name.size() - 4, 4).equals_ignore_case(".md2")) ||
            (name.subString(name.size() - 4, 4).equals_ignore_case(".md3")) ||
            (name.subString(name.size() - 4, 4).equals_ignore_case(".obj")) ||
            (name.subString(name.size() - 4, 4).equals_ignore_case(".bsp")) ||
            (name.subString(name.size() - 5, 5).equals_ignore_case(".my3d")) ||
            (name.subString(name.size() - 5, 5).equals_ignore_case(".lmts")) ||
            (name.subString(name.size() - 4, 4).equals_ignore_case(".csm")) ||
            (name.subString(name.size() - 4, 4).equals_ignore_case(".oct")))
        return true;
    return false;
}
开发者ID:echoline,项目名称:IrrGUI,代码行数:12,代码来源:FileSceneNode.cpp

示例7: isvid

bool FileSceneNode::isvid(core::stringc name) {
    if ((name.subString(name.size() - 4, 4).equals_ignore_case(".avi")) ||
            (name.subString(name.size() - 4, 4).equals_ignore_case(".wmv")) ||
            (name.subString(name.size() - 4, 4).equals_ignore_case(".mpg")) ||
            (name.subString(name.size() - 5, 5).equals_ignore_case(".mpeg")) ||
            (name.subString(name.size() - 4, 4).equals_ignore_case(".mp4")) ||
            (name.subString(name.size() - 4, 4).equals_ignore_case(".mkv")) ||
            (name.subString(name.size() - 4, 4).equals_ignore_case(".ogm")) ||
            (name.subString(name.size() - 3, 3).equals_ignore_case(".rm")) ||
            (name.subString(name.size() - 5, 5).equals_ignore_case(".divx")))
        return true;
    return false;
}
开发者ID:echoline,项目名称:IrrGUI,代码行数:13,代码来源:FileSceneNode.cpp

示例8: getAbsolutePath

core::stringc CFileSystem::getAbsolutePath(const core::stringc& filename) const
{
	c8 *p=0;

#ifdef _IRR_WINDOWS_API_
	#if !defined ( _WIN32_WCE )
	c8 fpath[_MAX_PATH];
	p = _fullpath( fpath, filename.c_str(), _MAX_PATH);
	#endif

#elif (defined(_IRR_POSIX_API_) || defined(_IRR_OSX_PLATFORM_))
	c8 fpath[4096];
	fpath[0]=0;
	p = realpath(filename.c_str(), fpath);
	if (!p)
	{
		// content in fpath is undefined at this point
		if ('0'==fpath[0]) // seems like fpath wasn't altered
		{
			// at least remove a ./ prefix
			if ('.'==filename[0] && '/'==filename[1])
				return filename.subString(2, filename.size()-2);
			else
				return filename;
		}
		else
			return core::stringc(fpath);
	}

#endif

	return core::stringc(p);
}
开发者ID:AwkwardDev,项目名称:pseuwow,代码行数:33,代码来源:CFileSystem.cpp

示例9: writeMeshBinary

bool CSTLMeshWriter::writeMeshBinary(io::IWriteFile* file, scene::IMesh* mesh, s32 flags)
{
	// write STL MESH header

	file->write("binary ",7);
	const core::stringc name(SceneManager->getMeshCache()->getMeshName(mesh));
	const s32 sizeleft = 73-name.size(); // 80 byte header
	if (sizeleft<0)
		file->write(name.c_str(),73);
	else
	{
		char* buf = new char[80];
		memset(buf, 0, 80);
		file->write(name.c_str(),name.size());
		file->write(buf,sizeleft);
		delete [] buf;
	}
	u32 facenum = 0;
	for (u32 j=0; j<mesh->getMeshBufferCount(); ++j)
		facenum += mesh->getMeshBuffer(j)->getIndexCount()/3;
	file->write(&facenum,4);

	// write mesh buffers

	for (u32 i=0; i<mesh->getMeshBufferCount(); ++i)
	{
		IMeshBuffer* buffer = mesh->getMeshBuffer(i);
		if (buffer)
		{
			const u32 indexCount = buffer->getIndexCount();
			const u16 attributes = 0;
			for (u32 j=0; j<indexCount; j+=3)
			{
				const core::vector3df& v1 = buffer->getPosition(buffer->getIndices()[j]);
				const core::vector3df& v2 = buffer->getPosition(buffer->getIndices()[j+1]);
				const core::vector3df& v3 = buffer->getPosition(buffer->getIndices()[j+2]);
				const core::plane3df tmpplane(v1,v2,v3);
				file->write(&tmpplane.Normal, 12);
				file->write(&v1, 12);
				file->write(&v2, 12);
				file->write(&v3, 12);
				file->write(&attributes, 2);
			}
		}
	}
	return true;
}
开发者ID:Aeshylus,项目名称:Test,代码行数:47,代码来源:CSTLMeshWriter.cpp

示例10: GetContextPathFromFilename

core::stringc GetContextPathFromFilename( const core::stringc& filename )
{
    core::stringc path;
    s32 i=filename.size()-1;
    while ( i >= 0 && filename[i] != '/' )
    {
        i--;
    }
    path = filename.subString( 0, i+1 );
    return path;
}
开发者ID:huytd,项目名称:fosengine,代码行数:11,代码来源:SkinLoader.cpp

示例11: getFileDir

//! returns the directory part of a filename, i.e. all until the first
//! slash or backslash, excluding it. If no directory path is prefixed, a '.'
//! is returned.
core::stringc CFileSystem::getFileDir(const core::stringc& filename) const
{
	// find last forward or backslash
	s32 lastSlash = filename.findLast('/');
	const s32 lastBackSlash = filename.findLast('\\');
	lastSlash = lastSlash > lastBackSlash ? lastSlash : lastBackSlash;

	if ((u32)lastSlash < filename.size())
		return filename.subString(0, lastSlash);
	else
		return ".";
}
开发者ID:AwkwardDev,项目名称:pseuwow,代码行数:15,代码来源:CFileSystem.cpp

示例12: getFileBasename

//! returns the base part of a filename, i.e. all except for the directory
//! part. If no directory path is prefixed, the full name is returned.
core::stringc CFileSystem::getFileBasename(const core::stringc& filename, bool keepExtension) const
{
	// find last forward or backslash
	s32 lastSlash = filename.findLast('/');
	const s32 lastBackSlash = filename.findLast('\\');
	lastSlash = core::max_(lastSlash, lastBackSlash);
	s32 end = 0;
	if (!keepExtension)
	{
		end = filename.findLast('.');
		if (end == -1)
			end=0;
		else
			end = filename.size()-end;
	}

	if ((u32)lastSlash < filename.size())
		return filename.subString(lastSlash+1, filename.size()-lastSlash-1-end);
	else if (end != 0)
		return filename.subString(0, filename.size()-end);
	else
		return filename;
}
开发者ID:AwkwardDev,项目名称:pseuwow,代码行数:25,代码来源:CFileSystem.cpp

示例13: deletePathFromFilename

//! deletes the path from a filename
void CPakReader::deletePathFromFilename(core::stringc& filename)
{
	// delete path from filename
	const c8* p = filename.c_str() + filename.size();

	// search for path separator or beginning

	while (*p!='/' && *p!='\\' && p!=filename.c_str())
		--p;

	if (p != filename.c_str())
	{
		++p;
		filename = p;
	}
}
开发者ID:jivibounty,项目名称:irrlicht,代码行数:17,代码来源:CPakReader.cpp

示例14: deletePathFromFilename

//! deletes the path from a filename
void CPakReader::deletePathFromFilename(core::stringc& filename)
{
	// delete path from filename
	const c8* p = filename.c_str() + filename.size();

	// suche ein slash oder den anfang.

	while (*p!='/' && *p!='\\' && p!=filename.c_str())
		--p;

	core::stringc newName;

	if (p != filename.c_str())
	{
		++p;
		filename = p;
	}
}
开发者ID:JJHOCK,项目名称:l2adenalib,代码行数:19,代码来源:CPakReader.cpp

示例15: stringc

core::stringc CMS3DMeshFileLoader::stripPathFromString(const core::stringc& inString, bool returnPath) const
{
	s32 slashIndex=inString.findLast('/'); // forward slash
	s32 backSlash=inString.findLast('\\'); // back slash

	if (backSlash>slashIndex) slashIndex=backSlash;

	if (slashIndex==-1)//no slashes found
	{
		if (returnPath)
			return core::stringc(); //no path to return
		else
			return inString;
	}

	if (returnPath)
		return inString.subString(0, slashIndex + 1);
	else
		return inString.subString(slashIndex+1, inString.size() - (slashIndex+1));
}
开发者ID:344717871,项目名称:STK_android,代码行数:20,代码来源:CMS3DMeshFileLoader.cpp


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