本文整理汇总了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;
}
示例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
示例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;
}
示例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
示例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());
}
示例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);
}
}
示例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);
}
示例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 ".";
}
示例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;
}
示例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;
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}