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


C++ stringc类代码示例

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


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

示例1: sPP

EffectHandler::SPostProcessingPair EffectHandler::obtainScreenQuadMaterialFromFile(const irr::core::stringc& filename,
        irr::video::E_MATERIAL_TYPE baseMaterial)
{
    CShaderPreprocessor sPP(driver);

    sPP.addShaderDefine("SCREENX", core::stringc(ScreenRTTSize.Width));
    sPP.addShaderDefine("SCREENY", core::stringc(ScreenRTTSize.Height));

    video::E_VERTEX_SHADER_TYPE VertexLevel = driver->queryFeature(video::EVDF_VERTEX_SHADER_3_0) ? EVST_VS_3_0 : EVST_VS_2_0;
    video::E_PIXEL_SHADER_TYPE PixelLevel = driver->queryFeature(video::EVDF_PIXEL_SHADER_3_0) ? EPST_PS_3_0 : EPST_PS_2_0;

    E_SHADER_EXTENSION shaderExt = (driver->getDriverType() == EDT_DIRECT3D9) ? ESE_HLSL : ESE_GLSL;

    video::IGPUProgrammingServices* gpu = driver->getGPUProgrammingServices();

    const stringc shaderString = sPP.ppShaderFF(filename.c_str());

    ScreenQuadCB* SQCB = new ScreenQuadCB(this, true);

    s32 PostMat = gpu->addHighLevelShaderMaterial(
                      sPP.ppShader(SCREEN_QUAD_V[shaderExt]).c_str(), "vertexMain", VertexLevel,
                      shaderString.c_str(), "pixelMain", PixelLevel,
                      SQCB, baseMaterial);

    SPostProcessingPair pPair(PostMat, SQCB);

    SQCB->drop();

    return pPair;
}
开发者ID:EEmmanuel7,项目名称:irrlicht-sandbox,代码行数:30,代码来源:EffectHandler.cpp

示例2: writeStrc

// ----------------------------------------------------------------------------
void Editor::writeStrc(FILE* fp, stringc str)
{
    u8 size;
    size = str.size() + 1;
    fwrite(&size, sizeof(u8), 1, fp);
    fwrite(str.c_str(), sizeof(c8), size, fp);
} // writeStrc
开发者ID:CruzR,项目名称:stk-editor,代码行数:8,代码来源:editor.cpp

示例3: CXSprite

CXSpritePtr XSpriteManager::createRes(const stringc& name, int flag)
{		
	CXSpritePtr sprite = new CXSprite();
	if(sprite->LoadFromFile(name.c_str()))
	{
		sprite->setName(name);
		DBG("engineDbg_Res","create sprite name: %s", name.c_str());
	}
	else
	{
		sprite = 0;
		DBG("engineDbg_Res","can not create sprite, name: %s", name.c_str());
	}	

	if(sprite.isValid())
	{
		stringc baseName, exten, path;

		StringUtil::splitFullFilename(name, baseName, exten, path);
		baseName = path+baseName+".tga";

		renderer::TextureManager& texMgr = renderer::TextureManager::getInstance();				
		sprite->SetTexture(texMgr.getRes(baseName));
	}

	return sprite;
}
开发者ID:KerwinMa,项目名称:firstlight,代码行数:27,代码来源:XSpriteMgr.cpp

示例4: getLib

// ----------------------------------------------------------------------------
stringc Editor::getLib(stringc s)
{
    u32 ix;
    ix = s.findLast('/');
    s = s.subString(0, ix);
    ix = s.findLast('/');
    s = s.subString(ix + 1, s.size() - ix - 1);
    return s;
} // getLib
开发者ID:CruzR,项目名称:stk-editor,代码行数:10,代码来源:editor.cpp

示例5: getSettingAsInteger

	s32 getSettingAsInteger(const stringw& key) const
	{
		//we implicitly cast to string instead of stringw because strtol10 does not accept wide strings
		const stringc s = getSetting(key);
		if (s.empty())
			return 0;

		return strtol10(s.c_str());
	}
开发者ID:Aeshylus,项目名称:Test,代码行数:9,代码来源:main.cpp

示例6: logMessage

 //-------------------------------------------------------------------------
 //                              l o g M e s s a g e 
 //-------------------------------------------------------------------------
 void CApplication::logMessage(stringc msg)
 {
     msg += "\n";
     fputs(msg.c_str(), stdout);
     if(m_logFile)
     {
         m_logFile->write(msg.c_str(),msg.size());
         m_logFile->write("\n",1);
     }
 }
开发者ID:bdbdonp,项目名称:tubras,代码行数:13,代码来源:CApplication.cpp

示例7:

Scenario::Scenario(IrrlichtDevice* dev, stringc file, stringc mapName)
{
    device = dev;

    device->getFileSystem()->addZipFileArchive(file.c_str());

    IAnimatedMesh* mesh = device->getSceneManager()->getMesh(mapName.c_str());

    ISceneNode* node = device->getSceneManager()->addOctreeSceneNode(mesh->getMesh(0), 0, -1, 1024);

}
开发者ID:prakashgupta,项目名称:suproject,代码行数:11,代码来源:Scenario.cpp

示例8: _extractDir

    //-------------------------------------------------------------------------
    //                         _ e x t r a c t D i r 
    //-------------------------------------------------------------------------
    stringc _extractDir(stringc filename)
    {
        stringc result="";
        // 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+1);
        else
            return ".";
    }
开发者ID:bdbdonp,项目名称:tubras,代码行数:16,代码来源:TScript.cpp

示例9: SingleSysCall

/// @brief SystemCall to stringc
stringc SingleSysCall( const stringc& command, const u32 LENGTH )
{
    /// open pipe to shell command result
	FILE *f = popen( command.c_str(), "r");
	if (!f) { printf ( "Could not open temporary file as bash script.\n" );	return stringc(""); }

	/// create linebuffer
	c8* buffer = new c8[LENGTH];
	if (!buffer) { printf ( "Sorry, but you are out of memory.\n" ); return stringc(""); }

	u32 lineCount = 0;

	stringc s = "";

	while (fgets(buffer, LENGTH, f))
	{
		/* ... */
		lineCount++;
		s += stringc(buffer);
	}

	delete buffer;

	pclose(f);

	return s;
}
开发者ID:benjaminhampe,项目名称:DarkGDK,代码行数:28,代码来源:CClassBuilder.cpp

示例10: if

void NBEFileParser::parseLine(stringc line){
	stringc l = line.trim(" \t\n\r");

	if (l == "")
		return;

	#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 8
		stringc lw = irr::core::stringc(l);
		lw.make_lower();		
	#else
		stringc lw = l.make_lower();
	#endif
	

	if (stage == ERS_ROOT){
		if (lw.find("name ") == 0){
			stringc name = l.subString(4, l.size());
			proj->name = name.trim();
		}else if (lw.find("node ") == 0){
			stage = ERS_NODE;
			node = new Node(state->GetDevice(),state,proj->GetNodeCount());
			stringc name = l.subString(4,l.size());
			node->name = name.trim();
		}
	}else if (stage == ERS_NODE){
		if (lw.find("position ") == 0){
			printf("-- position parser not complete!\n");
		}else if (lw.find("nodebox ") == 0){
			stringc n = l.subString(7,l.size());
			n = n.trim();
			stringc ls[7];
			int i = 0;
			while (n!=""){
				int nid = n.find(" ");

				if (nid==-1){
					nid = n.size();
				}
				if (i>=7){
					printf("-- too many arguments to nodebox tag!\n%s\n",n.c_str());
					break;
				}
				ls[i] = n.subString(0,nid).trim();
				n = n.subString(nid,n.size()).trim();
				printf(">> %i ",i);
				printf(" is '%s'\n",ls[i].c_str());
				i++;				
			}
			node->addNodeBox();
			node->GetCurrentNodeBox()->name = ls[0];
			node->GetCurrentNodeBox()->one = vector3df(atof(ls[1].c_str()),atof(ls[2].c_str()),atof(ls[3].c_str()));
			node->GetCurrentNodeBox()->two = vector3df(atof(ls[4].c_str()),atof(ls[5].c_str()),atof(ls[6].c_str()));
			node->remesh();
		}else if (lw.find("end node") == 0){
			proj->AddNode(node);
			node = NULL;
			stage = ERS_ROOT;
		}		
	}
}
开发者ID:ShadowNinja,项目名称:NodeBoxEditor,代码行数:60,代码来源:NBEFileParser.cpp

示例11: LoadLines

bool LoadLines( Container& container, const stringc& filename, const u32 LENGTH )
{
    /// open file
	FILE *f = fopen( filename.c_str(), "r");
	if (!f)	{ printf ( "Could not open file.\n" ); return false; }

	/// create buffer
	c8* b = new c8[LENGTH];
	if (!b) { printf ( "Sorry, but you are out of memory.\n" ); return false; }

	/// read line-count
	u32 lineCount = 0;
	while (fgets(b, LENGTH, f)) { lineCount++; }

	/// process line-count
	printf ( "Loaded file has %d container.\n", lineCount );
	if (lineCount == 0) { fclose(f); return false; }

	/// reallocate container
	container.reallocate( lineCount );
	container.set_used( 0 );

	/// rewind
	fseek( f, 0L, SEEK_SET );

	/// fill container
	while (fgets(b, LENGTH, f)) { container.push_back( stringc(b) ); }

	/// end
	fclose(f);
	if (b) delete b;
	return true;
}
开发者ID:benjaminhampe,项目名称:DarkGDK,代码行数:33,代码来源:CClassBuilder.cpp

示例12: StoreLines

bool StoreLines( const Container& container, const stringc& filename )
{
    /// open file
	FILE *f = fopen( filename.c_str(), "w");
	if (!f)
	{
		printf ( "Could not open temporary write-file.\n" );
		return false;
	}

	u32 i = 0;
	while (f && i<container.size())
	{
		fputs( container[i].c_str(), f );
		// if ( container[i].size() > fputs( container[i].c_str(), f ) )
		// {
		//		printf ( "Maybe some error while reading [%d].\n", i );
		// }
		fputs( "\n", f );
		i++;
	}

	fclose( f );
	f = 0;

	return true;
}
开发者ID:benjaminhampe,项目名称:DarkGDK,代码行数:27,代码来源:CClassBuilder.cpp

示例13: setLanguage

bool CLanguages::setLanguage(stringc lang)
{
	m_Language->value = lang;
	bool found = false;

	for (u32 i=0; i< m_ListOfAvailableLanguages.size(); i++)
	{
		if(m_ListOfAvailableLanguages[i]->value.equals_ignore_case(lang))
		{
			m_Language->name = m_ListOfAvailableLanguages[i]->name;
			m_Language->index = m_ListOfAvailableLanguages[i]->index;
			found = true;
		}
	}

	if(!found)
	{
		printf("Language '%s' not found! Setting english as default language.\n", lang.c_str());
		m_Language->value = "en";
		m_Language->name = "english";
		m_Language->index = 0;
	}

	LoadStringTable();

	return found;
}
开发者ID:bpetar,项目名称:leonline,代码行数:27,代码来源:Languages.cpp

示例14: StoreCall

bool StoreCall( const stringc& command, const stringc& filename, const u32 LENGTH )
{
    /// open shell-pipe
	FILE *_shell = popen( command.c_str(), "r");
	if (!_shell) { printf ( "%s > %s\n", command.c_str(), filename.c_str() ); return false; }

	/// open write-file
	FILE *_file = fopen( filename.c_str(), "w");
	if (!_file)	{ printf ( "Could not open write-file %s.\n", filename.c_str() ); return false; }

	printf ( "%s > %s OK\n", command.c_str(), filename.c_str() );

	/// create linebuffer
	c8* _buffer = new c8[LENGTH];
	if (!_buffer) { printf ( "Sorry, but you are out of memory.\n" ); return false; }

	u32 lineCount = 0;

	while (fgets(_buffer, LENGTH, _shell))
	{
		fputs(_buffer, _file);
		lineCount++;
	}

	delete _buffer;

	pclose(_shell);
	fclose(_file);

	return true;
}
开发者ID:benjaminhampe,项目名称:DarkGDK,代码行数:31,代码来源:CClassBuilder.cpp

示例15: trimLine

bool trimLine( stringc& line, u32 loop_count, const c8* char_list, const u32 char_count )
{
	u32 k_max = 3;
	bool result = false;

	/// find from start
	u32 k = 0;
	s32 pos = line.findFirstChar(char_list, char_count);
	if ( pos != -1 )
	{
		result = true;
		while ( (pos != -1) && (k<k_max) )
		{
			line.erase( k ); // more hackisch
			pos = line.findFirstChar(char_list, char_count);
			k++;
		}
	}

	/// find from back
	k = 0;
	pos = line.findLastChar(char_list, char_count);
	if ( pos != -1 )
	{
		result = true;
		while ( (pos != -1) && (k<k_max) )
		{
			line.erase( line.size()-1 ); // more hackisch
			pos = line.findLastChar(char_list, char_count);
			k++;
		}
	}
	return result;
}
开发者ID:benjaminhampe,项目名称:DarkGDK,代码行数:34,代码来源:CClassBuilder.cpp


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