本文整理汇总了C++中StringList::count方法的典型用法代码示例。如果您正苦于以下问题:C++ StringList::count方法的具体用法?C++ StringList::count怎么用?C++ StringList::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringList
的用法示例。
在下文中一共展示了StringList::count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createAreaPages_getCircuitKey
String WikiAreaPages::createAreaPages_getCircuitKey( MindArea *area , XmlCircuitInfo& info ) {
// get circuit regions
StringList comps;
wm -> circuitsxml.getCircuitComponents( info , comps );
// check circuit mentions area regions
StringList compUsed;
for( int k = 0; k < comps.count(); k++ ) {
String comp = comps.get( k );
String region = wm -> hmindxml.getMappedRegion( comp );
if( !region.isEmpty() )
if( area -> getMindAreaDef() -> findRegion( region ) != NULL )
compUsed.add( region );
}
if( compUsed.count() == 0 )
return( "" );
// make key
compUsed.sort();
char l_buf[ 10 ];
sprintf( l_buf , "%3.3d" , compUsed.count() );
String key = l_buf;
for( int k = 0; k < compUsed.count(); k++ )
key += "." + compUsed.get( k );
// ensure unique
key += "." + info.id;
return( key );
}
示例2: getFileUpDown
String SensorFileSysWalker::getFileUpDown( String file , int move ) {
ASSERTMSG( move != 0 , "Unexpected" );
String dir = getDir( file );
StringList files;
// read directory
getDirList( dir , files );
// find current index
String fileOnly = getFileOnly( file );
int index = files.find( fileOnly );
ASSERTMSG( index >= 0 , "Unexpected: " + file );
int indexMove = ( move > 0 )? ( ( files.count() - index ) * move ) / 100 : ( index * move ) / 100;
// assure at least move by 1
if( indexMove == 0 )
indexMove = ( move > 0 )? 1 : -1;
index += indexMove;
if( index < 0 )
index = 0;
else
if( index >= files.count() )
index = files.count() - 1;
String fileNew = dir + "\\" + files.get( index );
return( fileNew );
}
示例3: checkNerves
void ModelVerifier::checkNerves() {
// check nerves use correct components
logger.logInfo( "checkNerves: CHECK NERVES ..." );
bool checkAll = true;
StringList nerves;
nervesxml.getNerveList( nerves );
for( int k = 0; k < nerves.count(); k++ ) {
String id = nerves.get( k );
// verify
logger.logInfo( "checkNerves: verify nerve id=" + id );
if( !checkNerves_verifyComponents( id ) )
checkAll = false;
}
// veriy modaility
ClassList<XmlNerveInfo>& divs = nervesxml.getDivisions();
for( int k = 0; k < divs.count(); k++ ) {
XmlNerveInfo& div = divs.getRef( k );
for( int z = 0; z < div.childs.count(); z++ ) {
MapStringToPtr fibers;
if( !checkNerves_verifyModalityByChilds( div.childs.getClassRefByIndex( z ) , fibers ) )
checkAll = false;
}
}
if( checkAll )
logger.logInfo( "checkNerves: NERVES ARE OK" );
else
logger.logInfo( "checkNerves: NERVES HAVE ERRORS" );
}
示例4: addFiberItem
void NerveTool::addFiberItem( StringList& fibersinfo , String type , String from , String to , StringList& mids ) {
String s = "<fibers type=\"" + type + "\" src=\"" + from + "\" dst=\"" + to + "\">";
for( int k = 0; k < mids.count(); k++ )
s += "<mid id=\"" + mids.get( k ) + "\"/>";
s += "</fibers>";
fibersinfo.add( s );
}
示例5: sendNewDirectoryInfo
void SensorFileSysWalker::sendNewDirectoryInfo() {
logger.logInfo( "sendNewDirectoryInfo: execute..." );
// send current directory list
StringList files;
getDirList( curDir , files );
for( int k = 0; k < files.count(); k++ ) {
String file = files.get( k );
sendSignal( SIGNAL_DIR_LISTITEM , file );
}
}
示例6: getNerveDivision_rootNerves
String WikiNerveSpecPages::getNerveDivision_rootNerves( StringList rootNerves ) {
String s;
for( int k = 0; k < rootNerves.count(); k++ ) {
String nerve = rootNerves.get( k );
if( k > 0 )
s += "; ";
XmlNerveInfo& nf = wm -> nervesxml.getNerveInfo( nerve );
s += "[" + nf.div -> origin + " " + nf.name + "]";
}
return( s );
}
示例7: createAreaPages_createCircuitsAndReferencesTableSection
void WikiAreaPages::createAreaPages_createCircuitsAndReferencesTableSection( String wikiDir , MindArea *area ) {
// skip circuits for target areas - will be in region pages
if( area -> isTargetArea() )
return;
// collect circuits which reference any of area regions
MindService *ms = MindService::getService();
StringList circuits;
wm -> circuitsxml.getCircuitList( circuits );
MapStringToString circuitKeys;
for( int k = 0; k < circuits.count(); k++ ) {
String circuitId = circuits.get( k );
XmlCircuitInfo& info = wm -> circuitsxml.getCircuitInfo( circuitId );
String key = createAreaPages_getCircuitKey( area , info );
if( key.isEmpty() )
continue;
circuitKeys.add( key , circuitId );
}
// add circuits section - sorted by relevance
StringList lines;
for( int k = circuitKeys.count() - 1; k >= 0; k-- ) {
String circuitId = circuitKeys.getClassByIndex( k );
XmlCircuitInfo& info = wm -> circuitsxml.getCircuitInfo( circuitId );
createAreaPages_getCircuitLines( info , lines );
}
String sectionName = "Thirdparty Circuits";
String wikiPage = wm -> getAreaPage( area -> getAreaId() );
wm -> updateFileSection( wikiDir , wikiPage , sectionName , lines );
lines.clear();
// add unique and sorted references - sorted by relevance
MapStringToClass<MindArea> refs;
for( int k = circuitKeys.count() - 1; k >= 0; k-- ) {
String circuitId = circuitKeys.getClassByIndex( k );
XmlCircuitInfo& info = wm -> circuitsxml.getCircuitInfo( circuitId );
if( !info.reference.equals( "UNKNOWN" ) )
if( refs.get( info.reference ) == NULL ) {
refs.add( info.reference , area );
lines.add( String( " * " ) + info.reference );
}
}
sectionName = "References";
wm -> updateFileSection( wikiDir , wikiPage , sectionName , lines );
}
示例8: getNerveDivision_muscles
String WikiNerveSpecPages::getNerveDivision_muscles( String name ) {
StringList muscles;
wm -> musclesxml.getMusclesByNerve( name , muscles );
if( muscles.count() == 0 )
return( "" );
// form muscle string
muscles.sort();
String ms;
for( int k = 0; k < muscles.count(); k++ ) {
String muscle = muscles.get( k );
XmlMuscleInfo& info = wm -> musclesxml.getMuscleInfo( muscle );
if( k > 0 )
ms += "; ";
ms += "[" + info.link + " " + info.name + "] - " + info.action;
}
return( ms );
}
示例9: loadLevel
void XmlSpinalCordLayout::loadLevel( Xml xmlLevel , MapStringToClass<StringList>& levelData ) {
for( Xml xmlChild = xmlLevel.getFirstChild( "lamina" ); xmlChild.exists(); xmlChild = xmlChild.getNextChild( "lamina" ) ) {
String id = xmlChild.getAttribute( "id" );
String elements = xmlChild.getAttribute( "elements" );
StringList& items = levelData.getRef( id );
StringList parts;
elements.split( parts , "," );
for( int k = 0; k < parts.count(); k++ ) {
String element = parts.get( k );
ASSERTMSG( hmind -> getIndexedElement( element ) != NULL , "unknown element index=" + element );
if( items.find( element ) < 0 )
items.add( element );
}
}
}
示例10: checkForDevicesExecute
//---------------------------------------------------------------------------
void __fastcall TMain::checkForDevicesExecute(TObject *Sender)
{
if(!buildDeviceList())
{
Log(lError) <<"Failed building device list";
return;
}
for(int i = 0; i < 90; i++)
{
StringList serials = getSerialsForDeviceType((DeviceTypeID) i);
for(u_int j = 0; j < serials.count(); j++)
{
Log(lInfo) <<"Found device of type '"<<::toString((DeviceTypeID) i)<<"' with serial: " <<serials[j];
}
}
}
示例11: execute_data
void NerveTool::execute_data( StringList& data , FILE *sout ) {
ClassList<Nerve> nn;
// parse
for( int k = 0; k < data.count(); k++ ) {
String so = data.get( k );
if( so.isEmpty() )
continue;
String s = so;
int res = execute_line( s , sout , nn );
if( res != 0 )
fprintf( sout , "invalid string (%d): error=%s, full=%s\n" , res , ( const char * )s , ( const char * )so );
}
// output
output_data( sout , nn );
}
示例12: getEnumProperty
int Xml::getEnumProperty( String name , String pairList ) {
String value = getProperty( name );
StringList pairs;
pairList.split( pairs , "," );
for( int k = 0; k < pairs.count(); k++ ) {
StringList items;
pairs.get( k ).split( items , "=" );
String key = items.get( 0 );
key.trim();
if( value.equals( key ) )
return( items.get( 1 ).toInteger() );
}
ASSERTFAILED( "unable to find value=" + value + " in enum: " + pairList );
return( 0 );
}
示例13: addOneToMany
void NerveTool::addOneToMany( StringList& fibersinfo , String type , String from , StringList& to ) {
StringList mids;
for( int k = 0; k < to.count(); k++ )
addFiberItem( fibersinfo , type , from , to.get( k ) , mids );
}
示例14: addManyToOne
void NerveTool::addManyToOne( StringList& fibersinfo , String type , StringList& from , String to ) {
StringList mids;
for( int k = 0; k < from.count(); k++ )
addFiberItem( fibersinfo , type , from.get( k ) , to , mids );
}
示例15: printStackInternal
void Logger::printStackInternal( rfc_threadstack *stack , int skipTop , bool printInplace )
{
int startItem = rfc_thr_stackfulldepth( stack ) - 1;
StringList lines;
lines.add( String( "CALL STACK:" ) );
if( skipTop == 0 )
skipTop = stack -> extraLevels;
if( skipTop > 0 ) {
lines.add( String( "\t...skipped..." ) );
startItem -= skipTop;
}
bool skipLast = false;
for( int k = startItem; k >= 0; k-- ) {
rfc_threadstacklevel *sl = rfc_thr_stacklevel( stack , k );
// extract short name
String moduleName = sl -> moduleName;
int from = moduleName.findLastAny( "/\\" );
int to = moduleName.findLast( '.' );
String moduleNameShort = moduleName;
if( from >= 0 && to >= 0 )
moduleNameShort = moduleNameShort.getMid( from + 1 , to - from - 1 );
if( !strcmp( moduleNameShort , "unknown" ) )
continue;
lines.add( String( "\t" ) + sl -> className +
"::" + sl -> functionName +
" (" + moduleNameShort +
", " + sl -> message + ")" );
// stop after main function
String functionName = sl -> functionName;
if( strcmp( functionName , "_main" ) == 0 ||
strcmp( functionName , "threadMainFunction" ) == 0 ||
strcmp( functionName , "runThread" ) == 0 ) {
if( k > 0 )
skipLast = true;
break;
}
}
if( skipLast )
lines.add( "\t...skipped..." );
for( int k = 0; k < lines.count(); k++ ) {
LogOutputMode mode = Logger::LogLine;
if( !printInplace )
if( k == 0 )
mode = Logger::LogStart;
else
if( k == lines.count() - 1 )
mode = Logger::LogStop;
log( lines.get( k ) , mode , Logger::LogLevelInfo );
}
}