本文整理汇总了C++中Strings::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ Strings::push_back方法的具体用法?C++ Strings::push_back怎么用?C++ Strings::push_back使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Strings
的用法示例。
在下文中一共展示了Strings::push_back方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: Split
// Split string cs into a vector of strings.
// Character c is used to split the strings.
// Strings in the result vector do not include the c character.
Strings Split(const std::string& cs, char c)
{
Strings r;
std::string s(cs);
while (true)
{
int i = s.find(c);
if (i == std::string::npos)
{
// No special character found, so push back the entire string and finish.
r.push_back(s);
break;
}
else
{
// Found the special character.
// Push back whatever is before the character, then work on the remainder
// of the string.
r.push_back(s.substr(0, i));
s = s.substr(i + 1);
Trim(&s);
if (s.empty())
{
break;
}
}
}
return r;
}
示例3: initComponents
void initComponents()
{
setBackground(BG_COLOR);
setBounds(120, 120, ICON_WIDTH * 3 + PROGRESS_SIZE + PADDING * 3 + 40, ICON_HEIGHT + PROGRESS_SIZE + 50);
statusLabel_ = new Label("ready");
statusLabel_->setBounds(START_X, START_Y, ICON_WIDTH * 4, ICON_HEIGHT);
statusLabel_->setBackground(BG_COLOR);
statusLabel_->setForeground(monagui::Color::gray);
add(statusLabel_);
playButton_ = new ImageSinkButton(playImage_, stopImage_, playImageFocused_);
playButton_->setBounds(ICON_WIDTH + PADDING + START_X, ICON_HEIGHT + START_Y + PADDING, ICON_WIDTH, ICON_HEIGHT);
add(playButton_);
backButton_ = new ImageButton(backImage_, backImageFocused_);
backButton_->setBounds(START_X, ICON_HEIGHT + START_Y + PADDING, ICON_WIDTH, ICON_HEIGHT);
add(backButton_);
forwardButton_ = new ImageButton(forwardImage_, forwardImageFocused_);
forwardButton_->setBounds(ICON_WIDTH * 2 + PADDING * 2 + START_X, ICON_HEIGHT + START_Y + PADDING, ICON_WIDTH, ICON_HEIGHT);
add(forwardButton_);
Strings icons;
icons.push_back(APPLICATION_DATA_DIR"/BAR0.JPG");
icons.push_back(APPLICATION_DATA_DIR"/BAR1.JPG");
icons.push_back(APPLICATION_DATA_DIR"/BAR2.JPG");
icons.push_back(APPLICATION_DATA_DIR"/BAR3.JPG");
icons.push_back(APPLICATION_DATA_DIR"/BAR4.JPG");
progressIcon_ = new ProgressIcon(icons, PROGRESS_SIZE, PROGRESS_SIZE);
progressIcon_->setBounds(ICON_WIDTH * 3 + PADDING * 3 + START_X, ICON_HEIGHT + START_Y + PADDING, PROGRESS_SIZE, PROGRESS_SIZE);
add(progressIcon_);
}
示例4: test
bool AbstractAligner::test(bool gaps) const {
Strings aln;
aln.push_back("AT");
aln.push_back(gaps ? "T" : "A");
try {
align_seqs(aln);
} catch (...) {
return false;
}
return aln[0] == "AT" && aln[1] == (gaps ? "-T" : "A-");
}
示例5: Split
Strings CUtils::Split(String data, const String & separator)
{
Strings dataSplitted;
int position(0);
while ((position = data.find(separator)) != -1) {
dataSplitted.push_back(data.substr(0, position));
data = data.substr(position + separator.length());
}
if (data.length() > 0) dataSplitted.push_back(data);
return dataSplitted;
}
示例6: _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( ));
}
示例7: 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);
}
示例8: FindAllFilesOfType
///---------------------------------------------------------------------------------
///
///---------------------------------------------------------------------------------
bool FindAllFilesOfType( const std::string& directory, const std::string& searchPattern, Strings& out_filesFound )
{
#ifdef WIN32
_finddata_t fd;
std::string searchPath = directory + searchPattern;
intptr_t searchHandle = _findfirst( searchPath.c_str(), &fd );
if (searchHandle != -1)
{
do
{
// ConsolePrintf( "%s %i\n", (directory + std::string(fd.name)).c_str(), fd.attrib );
out_filesFound.push_back( directory + std::string( fd.name ) );
} while (_findnext( searchHandle, &fd ) == 0);
}
else return false;
if (_findclose( searchHandle ) == 0 && out_filesFound.size() != 0)
return true;
return false;
#else
return false;
#endif
}
示例9: initLocal
bool Client::initLocal( const int argc, char** argv )
{
if( _impl->name.empty() && argc > 0 && argv )
{
const boost::filesystem::path prog = argv[0];
setName( prog.stem().string( ));
}
const auto options = _getProgramOptions();
arg::variables_map vm;
try
{
Strings args;
for( int i = 0; i < argc; ++i )
if( strcmp( argv[i], "--" ) != 0 )
args.push_back( argv[i] );
arg::store( arg::command_line_parser( args )
.options( options ).allow_unregistered().run(), vm );
arg::notify( vm );
}
catch( const std::exception& e )
{
LBERROR << "Error in argument parsing: " << e.what() << std::endl;
return false;
}
const bool isClient = vm.count( "eq-client" );
std::string clientOpts;
if( vm.count( "eq-layout" ))
_impl->activeLayouts.push_back( vm["eq-layout"].as< std::string >( ));
if( vm.count( "eq-gpufilter" ))
_impl->gpuFilter = vm["eq-gpufilter"].as< std::string >();
if( vm.count( "eq-modelunit" ))
_impl->modelUnit = vm["eq-modelunit"].as< float >();
LBVERB << "Launching " << getNodeID() << std::endl;
if( !Super::initLocal( argc, argv ))
return false;
if( isClient )
{
LBVERB << "Client node started from command line with option "
<< clientOpts << std::endl;
if( !_setupClient( clientOpts ))
{
exitLocal();
return false;
}
_impl->running = true;
clientLoop();
exitClient();
}
_impl->initQt( argc, argv );
return true;
}
示例10: GetPlayerNames
Strings PlayerInfoManager::GetPlayerNames() const
{
// TODO Sort strings in order of use, most recent first, i.e. descending order
typedef std::map<unsigned int, std::string, std::greater<unsigned int> > TimestampName;
TimestampName tn;
// Put names into map so they will be sorted, most recent first
for (PIMap::const_iterator it = m_map.begin(); it != m_map.end(); ++it)
{
unsigned int timestamp = it->second.first;
tn[timestamp] = it->first;
}
// Copy names in order into vector
Strings s;
for (TimestampName::const_iterator it = tn.begin(); it != tn.end(); ++it)
{
s.push_back(it->second);
}
// TODO something like
// std::copy(tn.begin, tn.end, std::back_inserter(s));
return s;
}
示例11: getKeys
Strings getKeys() const
{
Strings keys;
for( ValueMapCIter i = _data.begin(); i != _data.end(); ++i )
keys.push_back( i->first );
return keys;
}
示例12: dir_children
Strings dir_children(const std::string& d) {
Strings result;
fs::directory_iterator dir(d), end;
BOOST_FOREACH (const fs::path& child,
std::make_pair(dir, end)) {
result.push_back(child.string());
}
示例13: expandShellWildcard
Strings expandShellWildcard( const std::string& filename )
{
Strings expandedFilenames;
namespace fs = boost::filesystem;
const fs::path& filePath( filename );
const fs::path& parent = filePath.parent_path();
if( !fs::exists( parent ) || !fs::is_directory( parent ))
LBTHROW( std::runtime_error( "Not a valid path" ));
// Convert the filename with shell-like wildcard into a POSIX regex
const boost::regex regex = convertToRegex( filename );
for( fs::directory_iterator it( parent );
it != fs::directory_iterator(); ++it )
{
const std::string& candidate = it->path().string();
if( boost::regex_match( candidate, regex ))
expandedFilenames.push_back( candidate );
}
return expandedFilenames;
}
示例14: main
int main(int argc, char **argv)
{
std::cout << "Usage: " << StripPath(argv[0]) << " [modelPath]\n";
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
int windowX = 640;
int windowY = 480;
glutInitWindowSize(windowX, windowY);
glutCreateWindow("Anim Test");
// Set callbacks
glutDisplayFunc(draw);
glutIdleFunc(idle);
glutReshapeFunc(resize);
glutKeyboardFunc(keydown);
//glutKeyboardUpFunc(keyup);
//glutSpecialFunc(specialkeydown);
//glutSpecialUpFunc(specialkeyup);
glutMouseFunc(mousedown);
glutMotionFunc(mousemove);
glutPassiveMotionFunc(mousemove);
AmjuGL::SetImpl(new AmjuGLOpenGL(MyCreateWindowGLUT));
AmjuGL::CreateWindow(&w);
AmjuGL::Init();
float aspect = (float)windowX / (float)windowY;
AmjuGL::SetMatrixMode(AmjuGL::AMJU_PROJECTION_MATRIX);
AmjuGL::SetPerspectiveProjection(45.0f, aspect, 1.0f, 1000.0f);
glDisable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
AmjuGL::Enable(AmjuGL::AMJU_BLEND);
// glFrontFace(GL_CW); // this means we need to reverse the winding order when we load the tris for an MD3
// Look for md3 characters
DirEnts des;
Dir(".", &des, false);
for (unsigned int i = 0; i < des.size(); i++)
{
DirEnt& de = des[i];
if (de.m_name[0] == '.')
{
continue;
}
if (de.m_isDir)
{
std::cout << de.m_name << "\n";
charlist.push_back(de.m_name);
}
}
glutMainLoop();
return 0;
}
示例15: leafNames
void Node::leafNames(Node* node, Strings& leafNameVec)
{
if(node->isLeaf())
leafNameVec.push_back(node->name());
for(unsigned int i = 0; i < node->numberOfChildren(); i++)
leafNames(node->child(i), leafNameVec);
}