本文整理汇总了C++中Strings::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ Strings::empty方法的具体用法?C++ Strings::empty怎么用?C++ Strings::empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Strings
的用法示例。
在下文中一共展示了Strings::empty方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: strip
String String::strip(Strings tokens) const
{
if(tokens.empty())
tokens.push_back(L" ");
IndexVar left = 0, right = mContent.size();
while(left<mContent.size())
{
bool flag = false;
for(Strings::iterator ptr = tokens.begin(); ptr != tokens.end(); ptr++)
if(find(*ptr,left)==left)
{
flag = true;
break;
}
if(!flag)
break;
left++;
}
while(right>=0)
{
bool flag = false;
for(Strings::iterator ptr = tokens.begin(); ptr != tokens.end(); ptr++)
if(rfind(*ptr,right-1)==right-1)
{
flag = true;
break;
}
if(!flag)
break;
right--;
}
return substr(left,right-left);
}
示例2: split
Strings String::split(Strings tokens) const
{
if(tokens.empty())
tokens.push_back(L" ");
Strings ans;
base_wstring nowS;
IndexVar index = 0;
while(index<mContent.size())
{
bool flag = false;
for(Strings::iterator ptr = tokens.begin(); ptr != tokens.end(); ptr++)
if(find(*ptr,index)==index)
{
flag = true;
ans.push_back(nowS);
nowS = L"";
break;
}
if(!flag)
nowS += mContent[index];
index++;
}
ans.push_back(nowS);
return ans;
}
示例3: writeConfig
void ConfigTool::writeConfig() const
{
Global* global = Global::instance();
global->setConfigFAttribute( Config::FATTR_VERSION, 1.2f );
global->setWindowIAttribute( eq::server::Window::IATTR_HINT_FULLSCREEN,
eq::fabric::ON );
if( _mode != MODE_WALL )
{
global->setWindowIAttribute(eq::server::Window::IATTR_HINT_DOUBLEBUFFER,
eq::fabric::OFF );
global->setWindowIAttribute( eq::server::Window::IATTR_HINT_DRAWABLE,
eq::fabric::PBUFFER );
}
if( _mode >= MODE_DB && _mode <= MODE_DB_STREAM )
global->setWindowIAttribute( eq::server::Window::IATTR_PLANES_STENCIL,
eq::fabric::ON );
ServerPtr server = new eq::server::Server;
const Strings nodeNames = readNodenames( _nodesFile );
co::ConnectionDescriptionPtr desc = new ConnectionDescription;
if( !nodeNames.empty( ))
desc->setHostname( nodeNames.front( ));
server->addConnectionDescription( desc );
Config* config = new Config( server );
_writeResources( config, nodeNames );
_writeCompound( config );
lunchbox::Log::instance( "", 0 )
<< lunchbox::disableHeader << global << *server << std::endl
<< lunchbox::enableHeader << lunchbox::disableFlush;
}
示例4: _startLocalServer
co::ConnectionPtr _startLocalServer()
{
Strings dirNames;
dirNames.push_back( "" );
dirNames.push_back( "./" );
// Add path of current .so so search paths for EqualizerServer
#ifndef _WIN32
Dl_info dl_info;
dladdr((void *)_startLocalServer, &dl_info);
char libPath[1024];
strncpy(libPath, dl_info.dli_fname, 1024);
char* k = strrchr(libPath, '/');
*(k + 1) = '\0';
dirNames.push_back( libPath );
#endif
#ifdef EQ_BUILD_DIR
#ifdef NDEBUG
dirNames.push_back( std::string( EQ_BUILD_DIR ) + "libs/server/Release/" );
#else
dirNames.push_back( std::string( EQ_BUILD_DIR ) + "libs/server/Debug/" );
#endif
dirNames.push_back( std::string( EQ_BUILD_DIR ) + "libs/server/" );
#endif
#ifdef _MSC_VER
const std::string libName = "EqualizerServer.dll";
#elif defined (_WIN32)
const std::string libName = "libEqualizerServer.dll";
#elif defined (Darwin)
const std::string libName = "libEqualizerServer.dylib";
#else
const std::string libName = "libEqualizerServer.so";
#endif
while( !_libeqserver.isOpen() && !dirNames.empty( ))
{
_libeqserver.open( dirNames.back() + libName );
dirNames.pop_back();
}
if( !_libeqserver.isOpen( ))
{
EQWARN << "Can't open Equalizer server library" << std::endl;
return 0;
}
eqsStartLocalServer_t eqsStartLocalServer = (eqsStartLocalServer_t)
_libeqserver.getFunctionPointer( "eqsStartLocalServer" );
if( !eqsStartLocalServer )
{
EQWARN << "Can't find server entry function eqsStartLocalServer"
<< std::endl;
return 0;
}
return eqsStartLocalServer( Global::getConfigFile( ));
}
示例5: _startLocalServer
co::ConnectionPtr _startLocalServer()
{
Strings dirNames;
dirNames.push_back( "" );
#ifdef EQ_BUILD_DIR
#ifdef NDEBUG
dirNames.push_back( std::string( EQ_BUILD_DIR ) + "lib/Release/" );
#else
dirNames.push_back( std::string( EQ_BUILD_DIR ) + "lib/Debug/" );
#endif
dirNames.push_back( std::string( EQ_BUILD_DIR ) + "lib/" );
#endif
#ifdef _MSC_VER
const std::string libName = "EqualizerServer.dll";
#elif defined (_WIN32)
const std::string libName = "libEqualizerServer.dll";
#elif defined (Darwin)
const std::string libName = "libEqualizerServer.dylib";
#else
const std::string libName = "libEqualizerServer.so";
#endif
while( !_libeqserver.isOpen() && !dirNames.empty( ))
{
_libeqserver.open( dirNames.back() + libName );
dirNames.pop_back();
}
if( !_libeqserver.isOpen( ))
{
LBWARN << "Can't open Equalizer server library" << std::endl;
return 0;
}
eqsStartLocalServer_t eqsStartLocalServer = (eqsStartLocalServer_t)
_libeqserver.getFunctionPointer( "eqsStartLocalServer" );
if( !eqsStartLocalServer )
{
LBWARN << "Can't find server entry function eqsStartLocalServer"
<< std::endl;
return 0;
}
return eqsStartLocalServer( Global::getConfigFile( ));
}
示例6: Required
bool Required(const Group & group) const
{
if (mode == Auto && group.autoTest == NULL)
return false;
if ((mode == Create || mode == Verify) && group.dataTest == NULL)
return false;
if (mode == Special && group.specialTest == NULL)
return false;
if (filters.empty())
return true;
bool required = false;
for (size_t i = 0; i < filters.size(); ++i)
{
if (group.name.find(filters[i]) != std::string::npos)
{
required = true;
break;
}
}
return required;
}
示例7: OnActive
void GSTitle::OnActive()
{
static bool first = true;
if (first)
{
first = false;
TheAvatarManager::Instance()->Load();
// Set default keyboard layout
KbSetLayout(KB_LAYOUT_REGULAR);
TheGSOptions::Instance()->LoadFromConfig();
}
// Kill off any dummy player object
TheGame::Instance()->ClearGameObjects();
#ifdef SHOW_FRAME_TIME
Font* font = (Font*)TheResourceManager::Instance()->GetRes("font2d/arial-font.font");
TheGame::Instance()->SetFrameTimeFont(font);
#endif
GSGui::OnActive();
if (!m_titleImage.OpenAndLoad("title-bgimage.txt"))
{
std::cout << "Failed to load GUI title bg image!\n";
Assert(0);
}
m_gui = LoadGui("gui-title.txt");
Assert(m_gui);
GuiButton* start = (GuiButton*)GetElementByName(m_gui, "start-button");
start->SetCommand(Amju::OnStartButton);
start->SetHasFocus(true);
GuiButton* options = (GuiButton*)GetElementByName(m_gui, "options-button");
options->SetCommand(Amju::OnOptionsButton);
GuiButton* quick = (GuiButton*)GetElementByName(m_gui, "quick-start-button");
static PlayerInfoManager* pim = ThePlayerInfoManager::Instance();
if (pim->GetNumPlayerNames() > 0)
{
quick->SetVisible(true);
quick->SetCommand(Amju::OnQuickStartButton);
quick->SetHasFocus(true);
// Change button text to player name
Strings names = pim->GetPlayerNames();
Assert(!names.empty());
pim->SetCurrentPlayer(names[0]);
PlayerInfo* pi = pim->GetPI();
Assert(pi);
std::string playername = pi->PIGetString(PI_KEY("playername"));
quick->SetText(playername);
}
else
{
quick->SetVisible(false);
}
GuiButton* quit = (GuiButton*)GetElementByName(m_gui, "quit-button");
quit->SetCommand(Amju::OnQuitButton);
quit->SetIsCancelButton(true);
#ifdef SHOW_VERSION
GuiText* ver = (GuiText*)GetElementByName(m_gui, "version");
std::string s = "v." + ToString(VersionMajor) + "." + ToString(VersionMinor);
#ifdef _DEBUG
s += " DEBUG";
#endif
ver->SetText(s);
#endif
//CreateText("my game");
#ifdef PLAY_MUSIC
TheSoundManager::Instance()->PlaySong(ROConfig()->GetValue("music-title", "Sound/hammers.it"));
#endif
}