本文整理汇总了C++中StringList::add方法的典型用法代码示例。如果您正苦于以下问题:C++ StringList::add方法的具体用法?C++ StringList::add怎么用?C++ StringList::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringList
的用法示例。
在下文中一共展示了StringList::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createTracts_addTractLines
void WikiTractsPages::createTracts_addTractLines( int level , XmlBrainTract& tract , StringList& lines ) {
// tract info
String sname = "TRACT";
if( !tract.index.isEmpty() )
sname += " " + tract.index;
String s = String( " " ).replicate( level + 1 ) + "* " + wm -> getWikiLink( tract.link , sname ) + ": " + wm -> getWikiBold( tract.name );
if( !tract.synonyms.isEmpty() )
s += " (" + tract.synonyms + ")";
s += "; " + tract.function;
if( !tract.notes.isEmpty() )
s += " (" + tract.notes + ")";
if( !tract.source.isEmpty() )
s += "; path: {" + tract.source + "} -> {" + tract.target + "}";
lines.add( s );
if( !tract.imgsrc.isEmpty() ) {
s = String( " " ).replicate( level + 2 ) + "* " + wm -> getImageWikiLink( tract.imgsrc , tract.imgheight );
lines.add( s );
}
// tracts paths
for( int k = 0; k < tract.paths.count(); k++ ) {
XmlBrainTractPath& path = tract.paths.getClassRefByIndex( k );
createTracts_addTractPathLines( level + 1 , path , lines );
}
// child tract
for( int k = 0; k < tract.childs.count(); k++ ) {
XmlBrainTract& child = tract.childs.getClassRefByIndex( k );
createTracts_addTractLines( level + 1 , child , lines );
}
}
示例2: createAreaPages_createAreaCircuitTableLine
void WikiAreaPages::createAreaPages_createAreaCircuitTableLine( MindLocalCircuitDef *circuit , StringList& lines ) {
String line;
if( circuit == NULL ) {
line = "|| *ID* || *Name* || *Regions* ||";
lines.add( line );
return;
}
line = "|| " + circuit -> getId() + " || " + circuit -> getName() + " || ";
MapStringToClass<MindRegionDef>& regions = circuit -> getRegions();
String id;
String list;
for( int k = 0; k < regions.count(); k++ ) {
id = regions.getKeyByIndex( k );
if( k > 0 )
list += ", ";
list += wm -> getRegionReference( id );
}
line += list + " ||";
lines.add( line );
}
示例3: RemoveObjFromContainer
bool TestReplPack::RemoveObjFromContainer ( )
{
ReplRegistry& RegObj = ReplRegistry::getInstance();
ReplHashStrContainer* pReplHashStrContainer2 = ( ReplHashStrContainer* ) RegObj.get ( 2 );
if ( pReplHashStrContainer2 == NULL )
return false;
replHashStrNodeList& NodeList = replHashStrNodeList::getInstance ();
DLinkQueue theNodeQueue;
NodeList.getNodeList ( theNodeQueue );
pReplHashStrContainer2->addNodeList ( &theNodeQueue );
Replicable* pUser26 = pReplHashStrContainer2->removeObj ( "Yuan S. Feng26", 0 );
Replicable* pUser27 = pReplHashStrContainer2->removeObj ( "Yuan S. Fing27", 0 );
Replicable* pUser28 = pReplHashStrContainer2->removeObj ( "Yuan S. Yong28", 0 );
Replicable* pUser29 = pReplHashStrContainer2->removeObj ( "Yuan S. Ming29", 0 );
pReplHashStrContainer2->removeNodeList();
pReplHashStrContainer2->addAndUpdateObj ( pUser26 );
pReplHashStrContainer2->addAndUpdateObj ( pUser27 );
pReplHashStrContainer2->addAndUpdateObj ( pUser28 );
pReplHashStrContainer2->addAndUpdateObj ( pUser29 );
StringList theStringList;
theStringList.add ( "Yuan S. Feng26" );
theStringList.add ( "Yuan S. Fing27" );
theStringList.add ( "Yuan S. Yong28" );
theStringList.add ( "Yuan S. Ming29" );
ReplSender& SendObj = ReplSender::getInstance ( );
SendObj.sendMutiReplPack ( 2, &theStringList, &theNodeQueue, 70 );
return true;
}
示例4: addNerveList
void WikiNerveSpecPages::addNerveList( int level , XmlNerveInfo& nerve , StringList& lines ) {
// item string
String s = String( " " ).replicate( level + 2 ) + "* *" + nerve.name + "*";
if( !nerve.synonyms.isEmpty() )
s += " (" + nerve.synonyms + ")";
if( !nerve.origin.isEmpty() )
s += "; ORIGIN={" + nerve.origin + "}";
if( !nerve.branches.isEmpty() )
s += "; BRANCHES={" + nerve.branches + "}";
if( !nerve.distribution.isEmpty() )
s += "; DISTRIBUTION={" + nerve.distribution + "}";
if( !nerve.modality.isEmpty() )
s += "; MODALITY={" + nerve.modality + "}";
String muscles = getNerveDivision_muscles( nerve.name );
if( !muscles.isEmpty() )
s += "; MUSCLES={" + muscles + "}";
if( nerve.fibers.count() > 0 )
s += "; FIBERS={" + getNerveDivision_fibers( nerve.fibers ) + "}";
if( nerve.rootNerves.count() > 0 )
s += "; NERVES={" + getNerveDivision_rootNerves( nerve.rootNerves ) + "}";
lines.add( s );
// image
if( !nerve.imgsrc.isEmpty() ) {
s = String( " " ).replicate( level + 3 ) + "* " + wm -> getImageWikiLink( nerve.imgsrc , nerve.imgheight );
lines.add( s );
}
// childs
for( int k = 0; k < nerve.childs.count(); k++ )
addNerveList( level + 1 , nerve.childs.getClassRefByIndex( k ) , lines );
}
示例5: createTracts_addTractTableLines
void WikiTractsPages::createTracts_addTractTableLines( MapStringToClass<XmlBrainTractSet>& tractsets , StringList& lines ) {
lines.add( "*Tracts overview*:" );
lines.add( "|| *Tract* || *Name* || *Function* ||" );
for( int k = 0; k < tractsets.count(); k++ ) {
XmlBrainTractSet& one = tractsets.getClassRefByIndex( k );
createTracts_addTractSetTableLines( one , lines );
}
}
示例6: assertTermEditDistance
void
Test::testTermEditDistance()
{
{ // Test blueprint.
TermEditDistanceBlueprint prototype;
{
EXPECT_TRUE(assertCreateInstance(prototype, "termEditDistance"));
StringList params, in, out;
FT_SETUP_FAIL(prototype, params);
FT_SETUP_FAIL(prototype, params.add("foo"));
FT_SETUP_FAIL(prototype, params.add("0"));
FtIndexEnvironment ie;
ie.getBuilder().addField(FieldType::INDEX, CollectionType::SINGLE, "foo");
ie.getBuilder().addField(FieldType::INDEX, CollectionType::ARRAY, "afoo");
ie.getBuilder().addField(FieldType::INDEX, CollectionType::WEIGHTEDSET, "wfoo");
FT_SETUP_FAIL(prototype, ie, params.clear());
FT_SETUP_OK (prototype, ie, params.add("foo"), in.add("fieldLength(foo)"), out.add("out").add("del").add("ins").add("sub"));
FT_SETUP_FAIL(prototype, ie, params.add("afoo"));
FT_SETUP_FAIL(prototype, ie, params.add("wfoo"));
FT_SETUP_FAIL(prototype, ie, params.add("0"));
}
{
FT_DUMP_EMPTY(_factory, "termEditDistance");
FtIndexEnvironment ie;
ie.getBuilder().addField(FieldType::ATTRIBUTE, CollectionType::SINGLE, "foo");
ie.getBuilder().addField(FieldType::INDEX, CollectionType::ARRAY, "abar");
ie.getBuilder().addField(FieldType::INDEX, CollectionType::WEIGHTEDSET, "wbar");
FT_DUMP_EMPTY(_factory, "termEditDistance", ie); // must be a single-value index field
StringList dump;
#ifdef VISIT_BETA_FEATURES
ie.getBuilder().addField(FieldType::INDEX, CollectionType::SINGLE, "bar");
vespalib::string bn = "termEditDistance(bar)";
dump.add(bn + ".out");
dump.add(bn + ".del");
dump.add(bn + ".ins");
dump.add(bn + ".sub");
#endif
FT_DUMP(_factory, "termEditDistance", ie, dump);
}
}
{ // Test executor.
assertTermEditDistance("abcde", "abcde", 0, 0, 0);
assertTermEditDistance("abcde", "abcd.", 0, 0, 1);
assertTermEditDistance("abcde", ".bcd.", 0, 0, 2);
assertTermEditDistance("abcde", ".bc..", 0, 0, 3);
assertTermEditDistance("abcde", "..c..", 0, 0, 4);
assertTermEditDistance("abcd" , "..c..", 0, 1, 3);
assertTermEditDistance("abc", "..c..", 0, 2, 2);
assertTermEditDistance("ab", "..b..", 0, 3, 1);
assertTermEditDistance("a", "..a..", 0, 4, 0);
}
}
示例7: createNeurons_addEndings
void WikiTractsPages::createNeurons_addEndings( XmlBrainEndingSet& set , StringList& lines ) {
lines.add( "*" + set.name + "*:" );
lines.add( "" );
String s = wm -> getImageWikiLink( set.imgsrc , set.imgheight );
lines.add( s );
lines.add( "" );
for( int k = 0; k < set.childs.count(); k++ )
createNeurons_addEndingItem( 0 , set.childs.getClassRefByIndex( k ) , lines );
lines.add( "" );
}
示例8: createTracts_addTractSetLines
void WikiTractsPages::createTracts_addTractSetLines( XmlBrainTractSet& ts , StringList& lines ) {
lines.add( "TRACT SET: *" + ts.name + "*" );
lines.add( "" );
String s = wm -> getImageWikiLink( ts.imgsrc , ts.imgheight );
lines.add( s );
lines.add( "" );
for( int k = 0; k < ts.tracts.count(); k++ ) {
XmlBrainTract& tract = ts.tracts.getClassRefByIndex( k );
createTracts_addTractLines( 0 , tract , lines );
}
}
示例9: createTracts_addTractSetLinks
void WikiTractsPages::createTracts_addTractSetLinks( XmlBrainTractSet& ts , StringList& lines ) {
lines.add( "" );
lines.add( "== " + ts.name + " ==" ); //ts.name gives the value from xml file
lines.add( "" );
String indexValue = wm -> getTractPageLink( ts.id );
lines.add( "TRACT SET: " + wm -> getWikiLink( indexValue , ts.name ) ); //ts.name gives the value from xml file
lines.add( "" );
for( int k = 0; k < ts.tracts.count(); k++ ) {
XmlBrainTract& tract = ts.tracts.getClassRefByIndex( k );
createTracts_addTractLinks( 0 , tract , lines );
}
}
示例10: createAreaPages_getCircuitLines
void WikiAreaPages::createAreaPages_getCircuitLines( XmlCircuitInfo& info , StringList& lines ) {
String ref;
if( info.reference.equals( "UNKNOWN" ) )
ref = "(unknown reference)";
else
ref = "- see [" + info.reference + " Reference]";
lines.add( " * [" + info.image + " " + info.name + "] " + ref );
lines.add( "" );
lines.add( wm -> getImageWikiLink( info.image , info.imageHeight , info.imageWidth ) );
lines.add( "" );
}
示例11: main
int main(){
LDAPConnection *lc=new LDAPConnection("192.168.3.128",389);
std::cout << "----------------------doing bind...." << std::endl;
try{
lc->bind("uid=admin,dc=home,dc=local" , "secret");
std::cout << lc->getHost() << std::endl;
StringList tmp;
tmp.add("subschemasubentry");
LDAPSearchResults* entries = lc->search("",
LDAPConnection::SEARCH_BASE,
"(objectClass=*)",
tmp );
LDAPEntry* rootDse = entries->getNext();
std::string schemabase="cn=subschema";
if(rootDse){
const LDAPAttribute* schemaAttr = rootDse->getAttributes()->getAttributeByName("subschemaSubentry");
schemabase = *(schemaAttr->getValues().begin());
}
StringList attrs;
attrs.add("objectClasses");
attrs.add("attributeTypes");
entries = lc->search(schemabase, LDAPConnection::SEARCH_BASE, "(objectClass=*)",
attrs);
if (entries != 0){
LDAPEntry* entry = entries->getNext();
if(entry != 0){
const LDAPAttribute* oc = entry->getAttributes()->getAttributeByName("objectClasses");
LDAPSchema schema;
schema.setObjectClasses((oc->getValues()));
LDAPObjClass test = schema.getObjectClassByName("inetOrgPerson");
std::cout << test.getDesc() << std::endl;
// StringList mustAttr = test.getMay();
// for( StringList::const_iterator i = mustAttr.begin(); i != mustAttr.end(); i++ ){
// std::cout << *i << std::endl;
// }
StringList sup = test.getSup();
for( StringList::const_iterator i = sup.begin(); i != sup.end(); i++ ){
std::cout << *i << std::endl;
}
}
}
lc->unbind();
delete lc;
}catch (LDAPException e){
std::cout << "---------------- caught Exception ---------"<< std::endl;
std::cout << e << std::endl;
}
}
示例12: createAreaPages_createRegionTableSection
void WikiAreaPages::createAreaPages_createRegionTableSection( MindArea *area , MindLocalCircuitDef& circuit , StringList& lines ) {
// heading
String s = createAreaPages_getRegionTableRow( NULL );
lines.add( s );
// regions
MindAreaDef *areaDef = area -> getMindAreaDef();
MapStringToClass<MindRegionDef>& regionMap = circuit.getRegions();
for( int k = 0; k < regionMap.count(); k++ ) {
MindRegionDef *region = regionMap.getClassByIndex( k );
s = createAreaPages_getRegionTableRow( region );
lines.add( s );
}
}
示例13: GetStringList
StringList ArrayList::GetStringList(const string& lName)
{
//Look for ann array list whose first item is a string with lName and second item is a stringlist, i.e. {{string, {string string string}}
StringList aList;
for(u_int i = 0; i < Count(); i++)
{
ArrayListItemBase* listPtr = const_cast<ArrayListItemBase*>(mList[i]);
//Check for a list which first element is a string, i.e. a {{string}, {string, string}} list
if(dynamic_cast< ArrayListItem<ArrayList> *>(listPtr))
{
ArrayList list = (ArrayList) *(dynamic_cast< ArrayListItem<ArrayList> *>(listPtr));
if(list.Count())
{
ArrayListItemBase* anItem = &list[0];
if(dynamic_cast<ArrayListItem<string>*>(anItem))
{
string str = (string) *dynamic_cast<ArrayListItem<string>*>(anItem);
if(str == lName && list.Count() > 1)
{
ArrayListItemBase* anItem = &list[1];
if(dynamic_cast<ArrayListItem<StringList> *>(anItem))
{
//This is a stringList
StringList list = (StringList) *(dynamic_cast<ArrayListItem<StringList>*>(anItem));
for(int i = 0; i < list.Count(); i++)
{
string str = list[i];
aList.add(str);
}
}
if(dynamic_cast<ArrayListItem<ArrayList> *>(anItem))
{
//Assume this list only contains strings!
ArrayList list = (ArrayList) *(dynamic_cast<ArrayListItem<ArrayList>*>(anItem));
for(int i = 0; i < list.Count(); i++)
{
string str = list.GetString(i);
aList.add(str);
}
}
}
}
}
}
}
return aList;
}
示例14: StringList
StringList *StringTool::parseMatchPattern(const char *pPattern)
{
char *pBegin;
char ch;
StringList *pList = new StringList();
if (!pList)
return NULL;
char achBuf[2048];
pBegin = achBuf;
*pBegin++ = 0;
while ((ch = *pPattern++))
{
switch (ch)
{
case '*':
case '?':
if (pBegin - 1 != achBuf)
pList->add(achBuf, pBegin - achBuf);
pBegin = achBuf;
while (1)
{
*pBegin++ = ch;
if (*pPattern != ch)
break;
++pPattern;
}
if (ch == '*')
pList->add(achBuf, 1);
else
pList->add(achBuf, pBegin - achBuf);
pBegin = achBuf;
*pBegin++ = 0;
break;
case '\\':
ch = *pPattern++;
//fall through
default:
if (ch)
*pBegin++ = ch;
break;
}
}
if (pBegin - 1 != achBuf)
pList->add(achBuf, pBegin - achBuf);
return pList;
}
示例15: createTracts_addTractSetTableLines
void WikiTractsPages::createTracts_addTractSetTableLines( XmlBrainTractSet& ts , StringList& lines ) {
lines.add( "|| *" + ts.name + "* || || ||" );
for( int k = 0; k < ts.tracts.count(); k++ ) {
XmlBrainTract& tract = ts.tracts.getClassRefByIndex( k );
createTracts_addTractTableLines( 0 , tract , lines );
}
}