void OgreApp::setCommandLine(const Ogre::String &commandLine) { String configFile; mCommandLine = commandLine; if(!commandLine.empty()) { // splits command line in a vector without spliting text between quotes StringVector quoteSplit = Ogre::StringUtil::split(commandLine, "\""); // if the first char was a quote, split() ignored it. if(commandLine[0] == '\"') quoteSplit.insert(quoteSplit.begin(), " "); // insert a space in the list to reflect the presence of the first quote // insert a space instead of an empty string because the next split() will ingore the space but not the empty string // split(" ")->{} / split("")->{""} for(unsigned int i = 0; i < quoteSplit.size(); i++) { if(i&1) // odd elements : between quotes { mCommandLineArgs.push_back(quoteSplit[i]); } else // even elements : outside quotes { StringVector spaceSplit = Ogre::StringUtil::split(quoteSplit[i]); mCommandLineArgs.insert(mCommandLineArgs.end(), spaceSplit.begin(), spaceSplit.end()); } } } }
/*! * Counts keywords in string. * * \param base string to search * \param container set of keywords * \param count number of keywords found * \param mode allowable leading/trailing character mode (1=exclude keywords surrounded by exclude characters, 2=include only keywords preceded by include1 characters and followed by include2 characters) * \param exclude list of characters that may not surround keywords found (if mode=1) * \param include1 list of characters that must precede keywords found (if mode=2) * \param include2 list of characters that must follow keywords found (if mode=2) * \param counter_container stores list of individual keyword counts (if specified) * \param casesensitive language is case sensitive? */ void CUtil::CountTally(const string &base, StringVector &container, unsigned int &count, int mode, const string &exclude, const string &include1, const string &include2, UIntVector* counter_container, bool casesensitive) { string::size_type idx; string base1; StringVector::iterator vit; UIntVector::iterator cit; unsigned int single_count = 0; base1 = " " + base + " "; if (counter_container) cit = counter_container->begin(); if (casesensitive == false) { base1 = CUtil::ToLower(base1); for (vit = container.begin(); vit != container.end(); vit++) (*vit) = CUtil::ToLower((*vit)); } if (mode == 1) { // exclude mode for (vit = container.begin(); vit != container.end(); vit++) { idx = base1.find((*vit)); while (idx != string::npos) { if ((exclude.find(base1[idx+((*vit).size())]) == string::npos) && (exclude.find(base1[idx-1]) == string::npos)) { count++; single_count++; } idx = base1.find((*vit), idx + ((*vit).size())); } if (counter_container) { (*cit) += single_count; single_count = 0; cit++; } } } else if (mode == 2) { // include mode for (vit = container.begin(); vit != container.end(); vit++) { idx = base1.find((*vit)); while (idx != string::npos) { if ((include1.find(base1[idx-1]) != string::npos) && (include2.find(base1[idx+((*vit).size())]) != string::npos)) count++; idx = base1.find((*vit), idx + ((*vit).size())); } } } }
std::vector<std::string> SimulationControl_Impl::annualSimulationEnvironmentPeriods() const { StringVector result; OptionalSqlFile oSqlFile = model().sqlFile(); if (oSqlFile && runSimulationforWeatherFileRunPeriods()) { RunPeriodVector runPeriods = this->runPeriods(); StringVector environmentPeriods = oSqlFile->availableEnvPeriods(); for (const RunPeriod& runPeriod : runPeriods) { if (runPeriod.isAnnual() && !runPeriod.isRepeated()) { std::string rpName = runPeriod.name().get(); StringVector::const_iterator it = std::find_if(environmentPeriods.begin(),environmentPeriods.end(),std::bind(istringEqual,rpName,std::placeholders::_1)); if (it != environmentPeriods.end()) { result.push_back(*it); } } } if (result.empty()) { // try environment name from WeatherFile OptionalWeatherFile oWeatherFile = model().getOptionalUniqueModelObject<WeatherFile>(); if (oWeatherFile) { OptionalString os = oWeatherFile->environmentName(); if (os) { std::string candidate = *os; StringVector::const_iterator it = std::find_if(environmentPeriods.begin(),environmentPeriods.end(),std::bind(istringEqual,candidate,std::placeholders::_1)); if (it != environmentPeriods.end()) { result.push_back(*it); } } } } } return result; }
bool TestLexer::doTest( ) { StringVector files = _getFileNames(); report( "Scanning the following files:\n " << hydrazine::toString( files.begin(), files.end(), "\n " ) ); for( StringVector::iterator fi = files.begin(); fi != files.end(); ++fi ) { ptxFile = *fi; if( !_testScan( ) ) { status << "For file " << ptxFile << ", Test Point 1 (Scan): Failed\n"; return false; } status << "For file " << ptxFile << ", Test Point 1 (Scan): Passed\n"; } return true; }
void FrameStoreInit::addXmlFrames(Miro::ConfigDocument& xmlConfig) { // get all frames defined in the config file xmlConfig.setSection("Frames"); typedef Miro::ConfigDocument::StringVector StringVector; StringVector frames = xmlConfig.getInstances("rapid::FrameRpyParameters"); // add all frames specified in RPY StringVector::iterator first, last = frames.end(); for (first = frames.begin(); first != last; ++first) { FrameRpyParameters frame; xmlConfig.getType("rapid::FrameRpyParameters", *first, frame); keyFrameSubstitute(frame.parent); addRpyFrame(keyFrameSubstitute(*first), frame); } // add all frames specified in Quaternios frames = xmlConfig.getInstances("rapid::FrameQParameters"); last = frames.end(); for (first = frames.begin(); first != last; ++first) { FrameQParameters frame; xmlConfig.getType("rapid::FrameQParameters", *first, frame); keyFrameSubstitute(frame.parent); addQFrame(keyFrameSubstitute(*first), frame); } }
EStatusCode Type1ToCFFEmbeddedFontWriter::AddDependentGlyphs(StringVector& ioSubsetGlyphIDs) { EStatusCode status = PDFHummus::eSuccess; StringSet glyphsSet; StringVector::iterator it = ioSubsetGlyphIDs.begin(); bool hasCompositeGlyphs = false; for(;it != ioSubsetGlyphIDs.end() && PDFHummus::eSuccess == status; ++it) { bool localHasCompositeGlyphs; status = AddComponentGlyphs(*it,glyphsSet,localHasCompositeGlyphs); hasCompositeGlyphs |= localHasCompositeGlyphs; } if(hasCompositeGlyphs) { StringSet::iterator itNewGlyphs; for(it = ioSubsetGlyphIDs.begin();it != ioSubsetGlyphIDs.end(); ++it) glyphsSet.insert(*it); ioSubsetGlyphIDs.clear(); for(itNewGlyphs = glyphsSet.begin(); itNewGlyphs != glyphsSet.end(); ++itNewGlyphs) ioSubsetGlyphIDs.push_back(*itNewGlyphs); sort(ioSubsetGlyphIDs.begin(),ioSubsetGlyphIDs.end()); } return status; }
ModuleLinkerPass::StringVector ModuleLinkerPass::getAllSymbolsUsedByKernel( const std::string& kernelName) const { StringSet usedSymbols; usedSymbols.insert(kernelName); StringVector unprocessedSymbols = getAllSymbolsUsedByThisKernel( kernelName, _linkedModule); while(!unprocessedSymbols.empty()) { StringVector newSymbols; for(auto symbol = unprocessedSymbols.begin(); symbol != unprocessedSymbols.end(); ++symbol) { if(!usedSymbols.insert(*symbol).second) continue; if(!isKernelSymbol(_linkedModule, *symbol)) continue; StringVector kernelSymbols = getAllSymbolsUsedByThisKernel( *symbol, _linkedModule); newSymbols.insert(newSymbols.end(), kernelSymbols.begin(), kernelSymbols.end()); } unprocessedSymbols = std::move(newSymbols); } return StringVector(usedSymbols.begin(), usedSymbols.end()); }
int RuleMap::shouldFilterByShortcut(const Url & mainURL,const Url & url,FilterType t) { int iRet = 0; StringVector shortcuts; collectShortcuts(url.GetString(), shortcuts); this->m_ShortcutFilterRules.prepareStartFind(); for (StringVector::iterator it = shortcuts.begin(); it != shortcuts.end(); ++it) { iRet = m_ShortcutWhiteRules.doFilter(mainURL, *it, url, t); if (iRet != 0) return 0; } for (FilterRuleVector::iterator it = this->m_UnshortcutWhiteRules.begin(); it != this->m_UnshortcutWhiteRules.end(); ++it) { iRet = (*it)->shouldFilter(mainURL, url, t); if (iRet != 0) return 0; } for (StringVector::iterator it = shortcuts.begin(); it != shortcuts.end(); ++it) { iRet = this->m_ShortcutFilterRules.doFilter(mainURL, *it, url, t); if (iRet != 0) return iRet; } for (FilterRuleVector::iterator it = this->m_UnshortcutFilterRules.begin(); it != this->m_UnshortcutFilterRules.end(); ++it) { iRet = (*it)->shouldFilter(mainURL, url, t); if (iRet != 0) return iRet; } return iRet; }
void CDirectoryManagerBase::AppendFileArray(const std::string& path, const std::string& fileExt, StringVector& fileArray)const { std::string filter = path + "*" + fileExt; StringVector tmp = WBSF::GetFilesList(filter, m_nameType); fileArray.insert(fileArray.begin(), tmp.begin(), tmp.end()); }
/*! * 1.Function Description: * Changes a given string to have a sorted list of File Extensions with related Language names (1 file Extension per line) * * 2.Parameters: * eachLangCounters IN reference to struct holding pointers to Language specific parser classes * extensionsAndLangs IN/OUT reference to string to hold file Extensions and related Language names * * 3.Creation Time And Owner: * Version 2015.12 */ void GetExtensionsAndLanguages( CounterForEachLangType & eachLangCounters, string & extensionsAndLangs, bool & multipleLangs ) { CounterForEachLangType::iterator iter = eachLangCounters.begin(); CounterForEachLangType::iterator end = eachLangCounters.end(); StringVector extensions; string oneLine; for ( ; iter != end; iter++ ) { if ( iter->second->language_name == "UNDEF" ) continue; // skip 1st placeholder and Web as User can't change them StringVector::iterator itExt = iter->second->file_extension.begin(); for ( ; itExt != iter->second->file_extension.end(); itExt++ ) { oneLine = *itExt + " " + iter->second->language_name; extensions.push_back( oneLine ); } } sort( extensions.begin(), extensions.end() ); multipleLangs = false; string temp, tempLang, previousExtension, previousLang; StringVector::iterator itExt = extensions.begin(); for ( ; itExt != extensions.end(); itExt++ ) { temp = *itExt; unsigned int position = temp.find_first_of(" "); if ( position == (unsigned int)string::npos ) { // A really strange ERROR happened userIF->AddError( "Error: GetExtensionsAndLanguages created wrong string", false, 1, 1 ); break; } tempLang = temp.substr( position ); temp = temp.substr( 0, position ); if ( previousExtension.compare( temp ) == 0 ) { multipleLangs = true; // MORE than 1 Language uses the same File Extension ! char buf[512]; #ifdef _MSC_VER // Use more Secure C library API sprintf_s( buf, sizeof( buf ), #else // Use older less Secure C library API sprintf( buf, #endif "Warning: %s file extension is assigned to both %s and %s but only 1 language will be used.", temp.c_str(), previousLang.c_str(), tempLang.c_str() ); string err = buf; userIF->AddError( err, false, 1, 1 ); } previousExtension = temp; previousLang = tempLang; extensionsAndLangs += *itExt + "\n"; }
StringVector Component::path() const { StringVector ret; if (hasParent()) { StringVector b = parent()->path(); ret.insert(ret.begin(), b.begin(), b.end()); } ret.push_back(name()); return ret; }
String ForeignKeyConstraint::joinedLocalColumnNames(const String& sep) const { StringVector v = localColumnNames(); std::stringstream ss; for (StringVectorConstIterator i = v.begin(); i != v.end(); ++i) { if (i != v.begin()) { ss << sep; } ss << (*i); } return ss.str(); }
String Component::pathString(const String& sep) const { String ret; StringVector p = path(); for (StringVectorConstIterator i = p.begin(); i != p.end(); ++i) { if (i != p.begin()) { ret += sep; } ret += (*i); } return ret; }
TEST(Checksum, UUIDs) { StringVector checksums; for (unsigned i = 0, n = 1000; i < n; ++i) { checksums.push_back(checksum(toString(createUUID()))); } auto itStart = checksums.begin(); ++itStart; for (auto it = checksums.begin(), itEnd = checksums.end(); itStart != itEnd; ++it, ++itStart) { EXPECT_TRUE(std::find(itStart,itEnd,*it) == itEnd); } }
void get_same_encoding_C_locale (const std::string &lname, const std::string &cname, StringVector &libc_locales) { // get the aliases for both name and codeset StringVector la; StringVector ca; get_lname_aliases (lname, la); get_cname_aliases (cname, ca); // find all the installed C library locales that are equivalent // to the locale named by `lname' and that use the encoding given // by `cname' char* locname = get_installed_locales (); for (; *locname; locname += std::strlen (locname) + 1) { bool match_found = false; typedef StringVector::iterator Iterator; // iterate through the aliases and see if any one of them // starts with the same sequence for (Iterator it = la.begin (); it != la.end (); ++it) { if (0 != ci_pre_compare (locname, (*it).c_str ())) continue; // this is a good match, test to see if the encodings match if (0 == std::setlocale (LC_CTYPE, locname)) continue; const char* const cs = nl_langinfo (CODESET); // compare the codeset to the aliases for (Iterator it1 = ca.begin (); it1 != ca.end (); ++it1) { if (0 != ci_compare (cs, (*it1).c_str ())) continue; // found a match and save it libc_locales.push_back (std::string (locname)); match_found = true; } if (match_found) break; } } }
static void writeReport ( const SearchCompareParams& params, const vector <SearchResults*>& searchResults ) { bool remove = params.getRemove (); bool multisample = params.getMultiSample (); string reportHomologousProteins = params.getReportHomologousProteins (); string reportType = params.getReportType (); char format = params.getSaveFormat (); bool quanProteinFlag = PPProteinHitQuanInfo::getQuan (); StringVector idList = searchResults [0]->getIDList (); StringVector idFilterList = params.getIDFilterList (); sort ( idFilterList.begin (), idFilterList.end () ); StringVector idUsedList; if ( !idFilterList.empty () && multisample ) set_intersection ( idList.begin (), idList.end (), idFilterList.begin (), idFilterList.end (), back_inserter ( idUsedList ) ); else idUsedList = idList; sort ( idUsedList.begin (), idUsedList.end (), sortIDs () ); if ( reportType == "Calibration" ) { for ( StringVectorSizeType i = 0 ; i < idUsedList.size () ; i++ ) { SearchResultsPeptideReport srpr ( searchResults, idUsedList [i] ); printAbortFunctions ( cout ); srpr.printHTMLCalibration ( cout ); } } else { vector <SearchResultsReport*> srr; for ( StringVectorSizeType i = 0 ; i < idUsedList.size () ; i++ ) { if ( reportType == "Protein" ) { if ( quanProteinFlag ) { srr.push_back ( new SearchResultsPeptideReport ( searchResults, remove, params.getAccessionNumbers (), params.getSortType (), params.getSortType2 (), params.getReportHitsType (), reportHomologousProteins, idUsedList [i] ) ); } else { srr.push_back ( new SearchResultsProteinReport ( searchResults, remove, params.getAccessionNumbers (), params.getReportHitsType (), reportHomologousProteins, idUsedList [i] ) ); } } else if ( reportType == "Peptide" || reportType == "Modifications" || sresXLinks ) { srr.push_back ( new SearchResultsPeptideReport ( searchResults, remove, params.getAccessionNumbers (), params.getSortType (), params.getSortType2 (), params.getReportHitsType (), reportHomologousProteins, idUsedList [i] ) ); } else if ( sresTime ) { srr.push_back ( new SearchResultsPeptideReport ( searchResults, remove, params.getAccessionNumbers (), params.getSortType (), params.getSortType2 (), params.getUnmatchedSpectra (), params.getReportHitsType (), reportHomologousProteins, idUsedList [i], format != 'P' && format != 'F' && format != 'V' ) ); } else ErrorHandler::genError ()->error ( "Invalid report type.\n" ); } printAbortFunctions ( cout ); ujm->deletePreviousMessage ( cout ); doReport ( cout, params, idUsedList, srr ); for ( std::vector <SearchResultsReport*>::size_type j = 0 ; j < srr.size () ; j++ ) delete srr [j]; } }
void Session::debugEntity(Entity* e) { std::cout << "Entity:" << std::endl; InsertVisitor iv; e->visit(&iv); StringVector pnv = e->propertyNames(); for (StringVectorConstIterator i = pnv.begin(); i != pnv.end(); ++i) { Property p = e->property(*i); std::cout << "\t" << p << std::endl; } std::cout << "INSERT Visitor: " << std::endl << "\t" << iv.query()->sql() << std::endl; StringVector valueKeys = iv.query()->keys(); for (StringVector::const_iterator i = valueKeys.begin(); i != valueKeys.end(); ++i) { std::cout << "\t\t" << *i << ": " << iv.query()->value(*i) << std::endl; } }
void LoadBof(void) { char file_load_path[MAX_PATH+FILENAME_MAX]; char file_copy_path[MAX_PATH+FILENAME_MAX]; int files_loaded = 0; sprintf(file_load_path,"%s%s",ConfigStr(PATH_BOF),BOF_SPEC); StringVector files; if (FindMatchingFiles(file_load_path, &files)) { for (StringVector::iterator it = files.begin(); it != files.end(); ++it) { sprintf(file_load_path,"%s%s",ConfigStr(PATH_BOF), it->c_str()); sprintf(file_copy_path,"%s%s",ConfigStr(PATH_MEMMAP), it->c_str()); if (BlakMoveFile(file_load_path,file_copy_path)) files_loaded++; } } /* if (!files.empty()) dprintf("LoadBof moved in %i of %i found new .bof files\n",files_loaded,files.size()); */ //dprintf("starting to load bof files\n"); files_loaded = 0; sprintf(file_load_path,"%s%s",ConfigStr(PATH_MEMMAP),BOF_SPEC); if (FindMatchingFiles(file_load_path, &files)) { for (StringVector::iterator it = files.begin(); it != files.end(); ++it) { sprintf(file_load_path,"%s%s",ConfigStr(PATH_MEMMAP), it->c_str()); if (LoadBofName(file_load_path)) files_loaded++; else eprintf("LoadAllBofs can't load %s\n", it->c_str()); } } SetClassesSuperPtr(); SetClassVariables(); SetMessagesPropagate(); dprintf("LoadBof loaded %i of %i found .bof files\n",files_loaded,files.size()); }
void Cache<T>::garbageCollect() { if (!conf.cacheEnabled) return; time_t now = GameWindow::instance().time(); typedef std::vector<std::string> StringVector; StringVector dead; for (CacheMapIter it = map.begin(); it != map.end(); it++) { const std::string& name = it->first; CacheEntry& cache = it->second; bool unused = !cache.resource || cache.resource.unique(); if (!unused) continue; if (cache.lastUsed == IN_USE_NOW) { cache.lastUsed = now; // Log::info("Cache", name + ": unused"); } else if (now > cache.lastUsed + conf.cacheTTL*1000) { dead.push_back(name); Log::info("Cache", name + ": purged"); } } for (StringVector::iterator it = dead.begin(); it != dead.end(); it++) map.erase(*it); }
void timeSeriesGeneralTests(SqlFile& file, const SqlFileTimeSeriesQueryVector& allQueries) { // list of time series from vector should be same as all available from file StringSet tsNames = timeSeriesNames(allQueries); StringVector tsNamesFromFile = file.availableTimeSeries(); StringSet tsSetFromFile(tsNamesFromFile.begin(),tsNamesFromFile.end()); EXPECT_TRUE(tsNames == tsSetFromFile); }
void environmentPeriodGeneralTests(SqlFile& file, const SqlFileTimeSeriesQueryVector& allQueries) { // list of unique periods from vector should match that from file StringSet envPeriodsFromVector = environmentPeriods(allQueries); StringVector envPeriodsFromFile = file.availableEnvPeriods(); StringSet envSetFromFile(envPeriodsFromFile.begin(),envPeriodsFromFile.end()); EXPECT_TRUE(envSetFromFile == envPeriodsFromVector); }
//----------------------------------------------------------------------- void OldMaterialReader::parseLayerAttrib( const String& line, MaterialPtr& pMat, TextureUnitState* pLayer) { StringVector vecparams; // Split params on space vecparams = StringUtil::split(line, " \t"); StringVector::iterator params = vecparams.begin(); // Look up first param (command setting) StringUtil::toLowerCase(params[0]); LayerAttribParserList::iterator iparsers = mLayerAttribParsers.find(params[0]); if (iparsers == mLayerAttribParsers.end()) { // BAD command. BAD! LogManager::getSingleton().logMessage("Bad texture layer attribute line: '" + line + "' in " + pMat->getName() + ", unknown command '" + params[0] + "'"); } else { // Use parser if (params[0] != "texture" && params[0] != "cubic_texture" && params[0] != "anim_texture") { // Lower case all params if not texture for( size_t p = 1; p < vecparams.size(); ++p ) StringUtil::toLowerCase(params[p]); } iparsers->second(params, (unsigned int)vecparams.size(), pMat, pLayer); } }
/** * Replaces the command history list. */ void LineEditor::setHistory(const StringVector & history) { struct decodeSpaces { static std::string doit(const std::string &input) { std::string output = input; std::string::size_type pos = 0; while ((pos = output.find("\\s", pos)) != std::string::npos) { output.replace(pos, 2, " "); ++pos; } pos = 0; while ((pos = output.find("\\c", pos)) != std::string::npos) { output.replace(pos, 2, "\\"); ++pos; } return output; } }; this->history_.resize(history.size()); std::reverse_copy(history.begin(), history.end(), this->history_.begin()); std::transform( this->history_.begin(), this->history_.end(), this->history_.begin(), &decodeSpaces::doit); this->historyShown_ = -1; }
ERMsg CEnvCanGribForecast::OpenDatasets(CCallback& callback) { ERMsg msg; StringVector filesList = GetFilesList(GetOutputFilePath("*"));//don't put extensionbea cause of the 2.5km trouble callback.PushTask("load gribs files (" + ToString(filesList.size()) + ")", filesList.size()); for (StringVector::const_iterator it = filesList.begin(); it != filesList.end() && msg; it++) { if (IsEqual(GetFileExtension(*it), ".grib2")) { size_t hhh = Gethhh(*it); ASSERT(hhh <= 52); size_t vv = GetVariable(*it); ASSERT(vv != NOT_INIT); msg += m_datasets[hhh][vv].OpenInputImage(*it); msg += callback.StepIt(); } } //msg += m_datasets[0][0].OpenInputImage("E:/Travaux/Install/DemoBioSIM/Update/EnvCan/Forecast/HRDPS/CMC_hrdps_continental_DPT_TGL_2_ps2.5km_2016050806_P000-00.grib2"); callback.PopTask(); if (msg) { m_geo2gribs.Set(PRJ_WGS_84, m_datasets[0][0].GetPrjID()); msg += m_geo2gribs.Create(); } return msg; }
void KML_Geometry::parseCoords( xml_node<>* node, KMLContext& cx ) { xml_node<>* coords = node->first_node("coordinates", 0, false); if ( coords ) { StringVector tuples; StringTokenizer( coords->value(), tuples, " \n", "", false, true ); for( StringVector::const_iterator s=tuples.begin(); s != tuples.end(); ++s ) { StringVector parts; StringTokenizer( *s, parts, ",", "", false, true ); if ( parts.size() >= 2 ) { osg::Vec3d point; point.x() = as<double>( parts[0], 0.0 ); point.y() = as<double>( parts[1], 0.0 ); if ( parts.size() >= 3 ) { point.z() = as<double>( parts[2], 0.0 ); } _geom->push_back(point); } } } }
// Get all positions (vertices) from XMarkerList PositionsVector getAllPositionsFromXMarkerList(const ml::XMarkerList positionsList, const std::string allowedPositionTypes, double pointSize) { PositionsVector result; PositionStruct newPosition; StringVector allowedPositionTypesVector = stringSplit(allowedPositionTypes, ",", false); size_t positionsListLength = positionsList.size(); for (int i = 0; i < positionsListLength; i++) { ml::XMarker thisPosition = positionsList[i]; // If thisPoint is of allowed type if ( ("all" == allowedPositionTypes) || ( std::find(allowedPositionTypesVector.begin(), allowedPositionTypesVector.end(), intToString(thisPosition.type)) != allowedPositionTypesVector.end() ) ) { newPosition.position.x = thisPosition.x(); newPosition.position.y = thisPosition.y(); newPosition.position.z = thisPosition.z(); newPosition.color = Vector3(0); // Not defined by XMarkerList newPosition.alpha = 1; // Not defined by XMarkerList newPosition.size = pointSize; result.push_back(newPosition); } } return result; }
extern void print_strvec(const StringVector &vec){ for( StrVecIter it=vec.begin() ; it!=vec.end() ; it++ ){ std::cout << *it; if(it+1!=vec.end()) std::cout << "/"; } std::cout << std::endl; }
void ContentModule::initializeTextures() const { String resourceGroup = isCommon() ? ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME : getId(); StringVector texLocations = getTextureLocations(); for(StringVector::iterator iter = texLocations.begin(); iter != texLocations.end(); iter++) { String location = *iter; if (location.find(".zip") != String::npos) { ResourceGroupManager::getSingleton().addResourceLocation( getDirectory() + "/materials/" + location, "Zip", resourceGroup); } else { ResourceGroupManager::getSingleton().addResourceLocation( getDirectory() + "/materials/" + location, "FileSystem", resourceGroup); } } addSearchPath(getDirectory()+"/materials", resourceGroup); }
void ConfigCenter::printConfigData(std::ostream& s) const { StringVector v; for(StringValueVector::size_type i = 0;i < m_stringValues.size();i++) v.push_back(m_stringValues[i].pathToString() + " = \"" + (*m_stringValues[i].value) + "\""); for(StringListValueVector::size_type i = 0;i < m_stringListValues.size();i++) { std::string k = m_stringListValues[i].pathToString() + " ="; const StringVector& values = *m_stringListValues[i].value; for(StringVector::size_type j = 0;j < values.size();j++) { k += " \"" + values[j] + "\""; if (j + 1 < values.size()) k += ","; } v.push_back(k); } for(BooleanValueVector::size_type i = 0;i < m_booleanValues.size();i++) v.push_back(m_booleanValues[i].pathToString() + " = " + ((*m_booleanValues[i].value)?"yes":"no")); for(UIntValueVector::size_type i = 0;i < m_uintValues.size();i++) { std::ostringstream ss; ss << m_uintValues[i].pathToString() << " = " << (*m_uintValues[i].value); v.push_back(ss.str()); } std::sort(v.begin(), v.end()); for(StringVector::size_type i = 0;i < v.size();i++) s << v[i] << std::endl; }
/* * LoadRsc: Loads the RESOURCE_RSC_SPEC files (.rsc or .rsb). */ void LoadRsc(void) { char file_load_path[MAX_PATH+FILENAME_MAX]; char *filespec = ConfigStr(RESOURCE_RSC_SPEC); char *filepath = ConfigStr(PATH_RSC); int files_loaded = 0; sprintf(file_load_path, "%s%s", filepath, filespec); StringVector files; if (FindMatchingFiles(file_load_path, &files)) { for (StringVector::iterator it = files.begin(); it != files.end(); ++it) { sprintf(file_load_path, "%s%s", filepath, it->c_str()); if (RscFileLoad(file_load_path, EachLoadRsc)) { if (stricmp(filespec, "*.rsb") == 0) LoadRSBHash(file_load_path); files_loaded++; } else eprintf("LoadRsc error loading %s\n", it->c_str()); } } dprintf("LoadRsc loaded %i of %i found %s files\n", files_loaded, files.size(), filespec); }