本文整理汇总了C++中StringList::get方法的典型用法代码示例。如果您正苦于以下问题:C++ StringList::get方法的具体用法?C++ StringList::get怎么用?C++ StringList::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringList
的用法示例。
在下文中一共展示了StringList::get方法的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: train
void train (const ssi_char_t *dir, const ssi_char_t *model) {
// load samples
StringList files;
FileTools::ReadFilesFromDir (files, dir, "*.wav");
SampleList samples;
samples.addUserName ("user");
for (ssi_size_t i = 0; i < files.size (); i++) {
ssi_stream_t *stream = new ssi_stream_t;
ssi_sample_t *sample = new ssi_sample_t;
const ssi_char_t *filename = files.get (i);
// parse class name
FilePath fp (files.get(i));
ssi_char_t *class_name = ssi_strcpy (fp.getName ());
for (ssi_size_t j = 0; j < strlen (class_name); j++) {
if (class_name[j] == '_') {
class_name[j] = '\0';
break;
}
}
ssi_size_t class_id = samples.addClassName (class_name);
delete[] class_name;
// read wave file
WavTools::ReadWavFile (filename, *stream);
// create sample
sample->class_id = class_id;
sample->num = 1;
sample->score = 1.0f;
sample->streams = new ssi_stream_t *[1];
sample->streams[0] = stream;
sample->time = 0;
sample->user_id = 0;
// add sample
samples.addSample (sample);
}
// extract features
SampleList samples_t;
EmoVoiceFeat *ev_feat = ssi_create (EmoVoiceFeat, "ev_feat", true);
ModelTools::TransformSampleList (samples, samples_t, *ev_feat);
// create model
IModel *bayes = ssi_create (NaiveBayes, "bayes", true);
Trainer trainer (bayes);
// evalulation
Evaluation eval;
eval.evalKFold (&trainer, samples_t, 10);
eval.print ();
// train & save
trainer.train (samples_t);
trainer.save (model);
}
示例3: 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 );
}
示例4: 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" );
}
示例5: 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 );
}
示例6: Error
void
DLModuleLoaderImpl::loadInSearchingPaths
( const StringList& searchingPaths
, const std::string& modulePath)
{
StringList::Type::const_iterator i = \
searchingPaths.get().begin();
for(; i != searchingPaths.get().end(); i++)
{
handle = openModule(getFullPath(*i, modulePath));
if(handle != 0)
{
return;
}
}
throw Error(::dlerror());
}
示例7: 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 );
}
示例8: 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 );
}
}
示例9: 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 );
}
示例10: 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 );
}
示例11: 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 );
}
}
}
示例12: 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 );
}
示例13: 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 );
}
示例14: 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 );
}
示例15: 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 );
}