本文整理汇总了C++中StringVector::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ StringVector::push_back方法的具体用法?C++ StringVector::push_back怎么用?C++ StringVector::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringVector
的用法示例。
在下文中一共展示了StringVector::push_back方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create
void SQLiteIDSubIDSubIDNameValueList::create ()
{
StringVector sql;
sql.push_back ( "CREATE TABLE " + tableName + " ( "\
+ n1 [0] + " TEXT NOT NULL, "\
+ n1 [1] + " TEXT NOT NULL, "\
+ n1 [2] + " TEXT NOT NULL, "\
+ n1 [3] + " TEXT NOT NULL, "\
+ n1 [4] + " TEXT, "\
+ n1 [5] + " TEXT, "\
+ n1 [6] + " INTEGER CHECK ( " + n1 [6] + " = 0 OR " + n1 [6] + " = 1 ), "\
+ n1 [7] + " INTEGER CHECK ( " + n1 [7] + " = 0 OR " + n1 [7] + " = 1 ), "\
+ "PRIMARY KEY ( "\
+ n1 [0] + ", "\
+ n1 [1] + ", "\
+ n1 [2] + ", "\
+ n1 [3] + ", "\
+ n1 [4]\
+ " ) "\
+ ")" );
createTables ( sql );
}
示例2: split
void split(StringVector& v, const String& s, const String& separator)
{
String sTmp(s);
char *p = NULL;
const char *sep = separator.c_str();
char *tokenHelper = NULL;
p = strtok_s(
const_cast<char*>(sTmp.c_str()),
sep,
&tokenHelper);
while (p != NULL)
{
v.push_back(p);
p = strtok_s(
NULL,
sep,
&tokenHelper);
}
}
示例3: getMultiSetting
//-----------------------------------------------------------------------
StringVector ConfigFile::getMultiSetting(const String& key, const String& section) const
{
StringVector ret;
SettingsBySection::const_iterator seci = mSettings.find(section);
if (seci != mSettings.end())
{
SettingsMultiMap::const_iterator i;
i = seci->second->find(key);
// Iterate over matches
while (i != seci->second->end() && i->first == key)
{
ret.push_back(i->second);
++i;
}
}
return ret;
}
示例4: initialiseIndexScore
static void initialiseIndexScore ()
{
int numEntries;
char* info = getFileInfo ( MsparamsDir::instance ().getParamPath ( "indicies.txt" ), '>', 1, true, &numEntries );
for ( int i = 0 ; i < numEntries ; i++ ) {
names.push_back ( ( i == 0 ) ? strtok ( info, "\n" ) : strtok ( NULL, "\n" ) );
DoubleVector dv (52);
indexV.push_back ( dv );
fill ( dv.begin (), dv.end (), 0.0 );
for ( ; ; ) {
char aa;
double value;
char* line = strtok ( NULL, "\n" );
if ( !strcmp ( line, ">" ) ) break;
sscanf ( line, "%c %lf", &aa, &value );
indexV [i][aa-'A'] = value;
}
}
initialised = true;
}
示例5: _setup
KDvoid SdkSample::_setup ( RenderWindow* pWindow )
{
// assign mRoot here in case Root was initialised after the Sample's constructor ran.
m_pRoot = Root::getSingletonPtr ( );
m_pWindow = pWindow;
locateResources ( );
createSceneManager ( );
setupView ( );
m_pTrayMgr = new SdkTrayManager ( "SampleControls", pWindow, this ); // create a tray interface
loadResources ( );
m_bResourcesLoaded = true;
// show stats and logo and hide the cursor
m_pTrayMgr->showFrameStats ( TL_BOTTOMLEFT );
m_pTrayMgr->showLogo ( TL_BOTTOMRIGHT );
m_pTrayMgr->hideCursor ( );
// create a params panel for displaying sample details
StringVector aItems;
aItems.push_back ( "cam.pX" );
aItems.push_back ( "cam.pY" );
aItems.push_back ( "cam.pZ" );
aItems.push_back ( "" );
aItems.push_back ( "cam.oW" );
aItems.push_back ( "cam.oX" );
aItems.push_back ( "cam.oY" );
aItems.push_back ( "cam.oZ" );
aItems.push_back ( "" );
aItems.push_back ( "Filtering" );
aItems.push_back ( "Poly Mode" );
m_pDetailsPanel = m_pTrayMgr->createParamsPanel ( TL_NONE, "DetailsPanel", 200, aItems );
m_pDetailsPanel->hide ( );
m_pDetailsPanel->setParamValue ( 9, "Bilinear" );
m_pDetailsPanel->setParamValue ( 10, "Solid" );
setupContent ( );
m_bContentSetup = true;
m_bDone = false;
}
示例6: createFrameListener
//-------------------------------------------------------------------------------------
void BaseApplication::createFrameListener(void) {
LogManager::getSingletonPtr()->logMessage("*** Initializing OIS ***");
auto keyMouse = getForWindow(_window);
_keyboard = keyMouse.keyboard;
_mouse = keyMouse.mouse;
OgreBites::InputContext inputContext;
inputContext.mKeyboard = _keyboard;
inputContext.mMouse =_mouse;
_trayMgr = new OgreBites::SdkTrayManager("InterfaceName", _window, inputContext, this);
_trayMgr->showFrameStats(OgreBites::TL_BOTTOMLEFT);
_trayMgr->showLogo(OgreBites::TL_BOTTOMRIGHT);
_trayMgr->hideCursor();
// create a params panel for displaying sample details
StringVector items;
items.push_back("cam.pX");
items.push_back("cam.pY");
items.push_back("cam.pZ");
items.push_back("");
items.push_back("cam.oW");
items.push_back("cam.oX");
items.push_back("cam.oY");
items.push_back("cam.oZ");
items.push_back("");
items.push_back("Filtering");
items.push_back("Poly Mode");
_detailsPanel = _trayMgr->createParamsPanel(OgreBites::TL_NONE, "DetailsPanel", 200, items);
_detailsPanel->setParamValue(9, "Bilinear");
_detailsPanel->setParamValue(10, "Solid");
_detailsPanel->hide();
_root->addFrameListener(this);
_mouse->setEventCallback(this);
_keyboard->setEventCallback(this);
}
示例7: GetSSIHeader
//return the eader in the same position as they was added
StringVector CLocation::GetSSIHeader()const
{
vector<pair<size_t, string>> orderPair;
for (SiteSpeceficInformationMap::const_iterator it = m_siteSpeceficInformation.begin(); it != m_siteSpeceficInformation.end(); it++)
orderPair.push_back(make_pair(it->second.second, it->first));
std::sort(orderPair.begin(), orderPair.end());
StringVector header;
for (vector<pair<size_t, string>>::const_iterator it = orderPair.begin(); it != orderPair.end(); it++)
header.push_back(it->second);
return header;
//return GetSSIOrder();
//StringVector header;
//for( SiteSpeceficInformationMap::const_iterator it = m_siteSpeceficInformation.begin(); it!=m_siteSpeceficInformation.end(); it++)
//for (StringVector::const_iterator it = order.begin(); it != order.end(); it++)
//header.push_back(m_siteSpeceficInformation[*it]. );
//return header;
}
示例8: luaFuncExeDirs
static int luaFuncExeDirs(lua_State* l)
{
Block* b = mbGetActiveContext()->ActiveBlock();
if (!b)
{
MB_LOGERROR("must be within a block");
mbExitError();
}
luaL_checktype(l, 1, LUA_TTABLE);
int tableLen = luaL_len(l, 1);
StringVector strings;
for (int i = 1; i <= tableLen; ++i)
{
lua_rawgeti(l, 1, i);
strings.push_back(std::string());
mbLuaToStringExpandMacros(&strings.back(), b, l, -1);
}
b->AddExeDirs(strings);
return 0;
}
示例9: split
StringVector split(const std::string& string,
const std::string& delimiter)
{
size_t begin = 0;
size_t end = 0;
StringVector strings;
while(end != std::string::npos)
{
end = string.find(delimiter, begin);
if(end > begin)
{
std::string substring = string.substr(begin, end - begin);
if(!substring.empty()) strings.push_back(substring);
}
begin = end + delimiter.size();
}
return strings;
}
示例10: setupModels
void SkeletalAnimation::setupModels()
{
SceneNode* sn = NULL;
Entity* ent = NULL;
AnimationState* as = NULL;
for (unsigned int i = 0; i < NUM_MODELS; i++)
{
// create scene nodes for the models at regular angular intervals
sn = mSceneManager->getRootSceneNode()->createChildSceneNode();
sn->yaw(Radian(Math::TWO_PI * (float)i / (float)NUM_MODELS));
sn->translate(0, 0, -20, Node::TS_LOCAL);
mModelNodes.push_back(sn);
// create and attach a jaiqua entity
ent = mSceneManager->createEntity("Sinbad" + StringConverter::toString(i + 1), "Sinbad.mesh");
sn->attachObject(ent);
// enable the entity's sneaking animation at a random speed and loop it manually since translation is involved
as = ent->getAnimationState("Dance");
as->setEnabled(true);
as->setLoop(true);
mAnimSpeeds.push_back(Math::RangeRandom(0.5, 1.5));
mAnimStates.push_back(as);
}
// create name and value for skinning mode
StringVector names;
names.push_back("Skinning");
String value = "Software";
// change the value if hardware skinning is enabled
Pass* pass = ent->getSubEntity(0)->getMaterial()->getBestTechnique()->getPass(0);
if (pass->hasVertexProgram() && pass->getVertexProgram()->isSkeletalAnimationIncluded()) value = "Hardware";
}
示例11: while
ConfigDocument::StringVector
ConfigDocument::getInstances(const std::string& _type)
{
StringVector names;
if (document_ != NULL) {
QString section = section_.c_str();
QString type = _type.c_str();
// get the root nodes first child
QDomNode n1 = document_->documentElement().firstChild();
while(!n1.isNull()) {
QDomElement e1 = n1.toElement();
if (!e1.isNull() &&
( (n1.nodeName() == "section" &&
e1.attribute("name") == section) ||
(n1.nodeName() == section))) {
QDomNode n2 = n1.firstChild();
while (!n2.isNull()) {
QDomElement e2 = n2.toElement();
if (!e2.isNull() &&
n2.nodeName() == "instance" &&
e2.attribute("type") == type) {
std::string name = e2.attribute("name").latin1();
if (name != "")
names.push_back(name);
}
n2 = n2.nextSibling();
}
}
n1 = n1.nextSibling();
}
}
return names;
}
示例12: get_lname_aliases
void get_lname_aliases (const std::string& name,
StringVector& aliases)
{
for (std::size_t i = 0; locale_aliases [i].name; i++) {
if (0 == ci_compare (locale_aliases [i].name, name.c_str ())) {
// store the whole structure data
store_aliases (aliases, locale_aliases [i]);
break;
}
// check the entry's aliases as well
for (std::size_t j = 0; locale_aliases [i].aliases [j]; j++) {
if (0 == ci_compare (locale_aliases [i].aliases [j],
name.c_str ())) {
// store the whole structure data
store_aliases (aliases, locale_aliases [i]);
break;
}
}
}
if (aliases.empty ())
aliases.push_back (name);
}
示例13: splitByCharA
void splitByCharA(LPCSTR str, StringVector& parts, CHAR sepChar)
{
if (NULL == str) return;
std::string temp = str;
temp += sepChar;
std::string::size_type begin = 0;
std::string::size_type pos = temp.find(sepChar);
while (pos != std::string::npos)
{
std::string part;
if (pos > begin)
{
part = temp.substr(begin, pos - begin);
}
parts.push_back(part);
begin = pos + 1;
pos = temp.find(sepChar, begin);
}
}
示例14: initSearchPaths
bool AppDelegate::initSearchPaths(StringVector& kPaths)
{
string strPlatformUIPath = "Published-iOS";
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
strPlatformUIPath = "Published-Android";
#endif
m_strLuaScriptPath = m_strBasePlatformPath + string("lua_scripts");
m_strImagePath = m_strBasePlatformPath + string("images");
m_strAppIconPath = m_strBasePlatformPath + string("images/app_icon");
m_strFontPath = m_strBasePlatformPath + string("fonts");
m_strSoundPath = m_strBasePlatformPath + string("sounds");
m_strPublishedPath = m_strBasePlatformPath + string("ui_system/") + strPlatformUIPath;
kPaths.push_back(m_strLuaScriptPath);
kPaths.push_back(m_strImagePath);
kPaths.push_back(m_strAppIconPath);
kPaths.push_back(m_strFontPath);
kPaths.push_back(m_strSoundPath);
kPaths.push_back(m_strPublishedPath);
return true;
}
示例15:
TEST_F(IdfFixture, IdfObject_StringFieldGetterWithReturnDefaultOption) {
// NON-EXTENSIBLE OBJECT
std::stringstream text;
text << "Refrigeration:Condenser:AirCooled," << std::endl
<< " MyCondenser," << std::endl
<< " ," << std::endl
<< " ," << std::endl // default is 0.0
<< " ," << std::endl // default is "Fixed"
<< " 125.0;"; // default is 250.0
// default is 0.2
//
// default is "General"
// default is 0.0
// default is 0.0
// default is 0.0
OptionalIdfObject oObj = IdfObject::load(text.str());
ASSERT_TRUE(oObj);
IdfObject object = *oObj;
// returns set values
OptionalString idfField = object.getString(0,true);
ASSERT_TRUE(idfField);
EXPECT_EQ("MyCondenser",*idfField);
idfField = object.getString(1,true);
ASSERT_TRUE(idfField);
EXPECT_EQ("",*idfField);
idfField = object.getString(4,true);
ASSERT_TRUE(idfField);
EXPECT_EQ("125.0",*idfField);
// returns default for fields behind fields with set values
idfField = object.getString(2,true);
ASSERT_TRUE(idfField);
EXPECT_EQ("0.0",*idfField);
idfField = object.getString(3,true);
ASSERT_TRUE(idfField);
EXPECT_EQ("Fixed",*idfField);
// returns default for non-existent fields
idfField = object.getString(6,true);
EXPECT_FALSE(idfField);
idfField = object.getString(7,true);
ASSERT_TRUE(idfField);
EXPECT_EQ("General",*idfField);
idfField = object.getString(8,true);
ASSERT_TRUE(idfField);
EXPECT_EQ("0.0",*idfField);
idfField = object.getString(10,true);
ASSERT_TRUE(idfField);
EXPECT_EQ("0.0",*idfField);
idfField = object.getString(11,true);
EXPECT_FALSE(idfField);
// EXTENSIBLE OBJECT
text.str("");
text << "DaylightingDevice:Tubular," << std::endl
<< " MyTDD," << std::endl
<< " MyDome," << std::endl
<< " MyDiffuser," << std::endl
<< " MyConstruction," << std::endl
<< " 1.0," << std::endl
<< " 2.0;";
// \default 0.28
// Transition Zone 1 Name
// Transition Zone 1 Length
// ... (extensible 2)
oObj = IdfObject::load(text.str());
ASSERT_TRUE(oObj);
object = *oObj;
EXPECT_EQ(6u,object.numFields());
// returns set values
idfField = object.getString(0,true);
ASSERT_TRUE(idfField);
EXPECT_EQ("MyTDD",*idfField);
idfField = object.getString(5,true);
ASSERT_TRUE(idfField);
EXPECT_EQ("2.0",*idfField);
// returns default for non-existent, non-extensible fields
idfField = object.getString(6,true);
ASSERT_TRUE(idfField);
EXPECT_EQ("0.28",*idfField);
EXPECT_EQ(6u,object.numFields());
idfField = object.getString(6);
EXPECT_FALSE(idfField);
StringVector newGroup;
newGroup.push_back("MyFirstTransistionZone");
newGroup.push_back("1.5");
ASSERT_FALSE(object.pushExtensibleGroup(newGroup).empty());
// returns default for fields behind fields with set values
idfField = object.getString(6,true);
ASSERT_TRUE(idfField);
EXPECT_EQ("0.28",*idfField);
idfField = object.getString(6);
ASSERT_TRUE(idfField);
EXPECT_TRUE(idfField->empty());
//.........这里部分代码省略.........