本文整理汇总了C++中stringc::size方法的典型用法代码示例。如果您正苦于以下问题:C++ stringc::size方法的具体用法?C++ stringc::size怎么用?C++ stringc::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stringc
的用法示例。
在下文中一共展示了stringc::size方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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
示例2: 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;
}
示例3: 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
示例4: 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);
}
}
示例5: _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 ".";
}
示例6: FindFiles
/// @brief List all files of given extension-list
u32 FindFiles( Container& out, const stringc& rootDir, const Container& fileTypes )
{
if (rootDir.size()==0)
return 0;
if (fileTypes.size()==0)
return 0;
const u32 old_size = out.size();
for (u32 i=0; i<fileTypes.size(); i++)
{
core::stringc command;
command = "find ";
command += rootDir;
command += " -iname '*.";
command += fileTypes[i];
command += "' | sort";
AddLines( out, command );
}
return out.size() - old_size; // return Number of added lines(stringc) to container 'out'.
}
示例7: puzzle_select
//.........这里部分代码省略.........
}
while(irrlicht->device->run() && game_state == GAME_STATE_MENU)
{
const uint32 time_physics_curr = btclock->getTimeMicroseconds();
const d32 frameTime = ((d32)(time_physics_curr - time_physics_prev)) / 1000000.0; // todo: is this truncated correctly?
time_physics_prev = time_physics_curr;
d32 capped_dt = frameTime;
if (capped_dt > maxDelta) { capped_dt = maxDelta; }
render_dt += capped_dt;
if ( render_dt >= render_ms )
{
render_dt = 0.0f;
irrlicht->driver->beginScene(true, true, SColor(255,100,100,140));
irrlicht->smgr->drawAll();
irrlicht->driver->clearZBuffer();
for (s4 i = 0; i < file_count; i++)
{
SColor color = SColor(255,150,150,230);
if (i == selected_level)
{
color = SColor(255,255,255,255);
}
font->draw(found_levels[i], rect<s32>(10,20 + 20 * i,300,50), color);
}
stringc text = "How To Throw A Baseball Through Solid Wall";
font->draw(text, rect<s32>(300,90,300,50), SColor(255,255,255,255));
text = "Arrow keys to move.";
font->draw(text, rect<s32>(300,120,300,50), SColor(255,255,255,255));
text = "A and D rotate camera. W zooms in, S zooms out.";
font->draw(text, rect<s32>(300,140,300,50), SColor(255,255,255,255));
text = "R to reset back to menu.";
font->draw(text, rect<s32>(300,160,300,50), SColor(255,255,255,255));
text = "Esc to quit.";
font->draw(text, rect<s32>(300,180,300,50), SColor(255,255,255,255));
text = "00_levels.fixed.txt: spacebar, backspace adjusts layers. ";
font->draw(text, rect<s32>(300,200,300,50), SColor(255,255,255,255));
text = "Baseball Gates is the only puzzle with a solution.";
font->draw(text, rect<s32>(300,240,300,50), SColor(255,255,255,255));
text = "Black cubes are placeholders for watermills.";
font->draw(text, rect<s32>(300,260,300,50), SColor(255,255,255,255));
text = "Put water in front of them to turn them on.";
font->draw(text, rect<s32>(300,280,300,50), SColor(255,255,255,255));
text = "antithesis.ctr is an experiment. Use mouse to grab things.";
font->draw(text, rect<s32>(300,320,300,50), SColor(255,255,255,255));
irrlicht->driver->endScene();
}
dt += capped_dt;
while( dt >= tick_ms ) // run 30 times per second
{
dt -= tick_ms;
receiver->input();
s4 prev_selected_level = selected_level;
if (receiver->up.state) selected_level--;
if (receiver->down.state) selected_level++;
if (selected_level < 2) selected_level = file_count - 1;
if (selected_level >= file_count) selected_level = 2;
if (receiver->enter.state) game_state = GAME_STATE_PLAY;
if (receiver->QUIT) game_state = GAME_STATE_QUIT;
}
}
selected_file = found_levels[selected_level];
s4 string_size = selected_file.size() - 1;
char file_type[3];
file_type[2] = selected_file[string_size];
file_type[1] = selected_file[string_size-1];
file_type[0] = selected_file[string_size-2];
//std::cout << file_type[0] << file_type[1] << file_type[2] << std::endl;
if (file_type[0] == 't') {
puzzle_type = 0;
} else if (file_type[0] == 'c') {
puzzle_type = 1;
}
delete [] found_levels;
file_system->changeWorkingDirectoryTo(prev_dir);
// irrlicht->smgr->setActiveCamera(0);
// camera->remove();
//irrlicht->smgr->clear();
}