StringVector getDirListing(const std::string& dir)
 {
   StringVector tmpList = enumerateFiles(dir);
   // now filter the list to only keep dirs
   StringVector list;
   for (StringVector::iterator it = tmpList.begin(); it != tmpList.end(); ++it)
   {
     if (isDirectory(*it))
       list.push_back(*it);
   }
   return list;
 }
Esempio n. 2
0
	virtual void GetParams(Session& ses, const string & id) {
		ServerInstanceInfo inst(Name, id);
		TeamFortress2Config conf(inst);
		
		StringVector maps;
		GetMaps( inst, maps );
		ses.BuildSelect( maps.begin(), maps.end(), "map" );
		ses.NewNode( "map", inst.GetParam( "map" ) );
		BuildRegionsSelect( ses );

		conf.ConfToSes(ses);
	}
Esempio n. 3
0
    //-----------------------------------------------------------------------
    void CgProgram::buildArgs(void)
    {
        StringVector args;
        if (!mCompileArgs.empty())
            args = StringUtil::split(mCompileArgs);

        StringVector::const_iterator i;
        if (mSelectedCgProfile == CG_PROFILE_VS_1_1)
        {
            // Need the 'dcls' argument whenever we use this profile
            // otherwise compilation of the assembler will fail
            bool dclsFound = false;
            for (i = args.begin(); i != args.end(); ++i)
            {
                if (*i == "dcls")
                {
                    dclsFound = true;
                    break;
                }
            }
            if (!dclsFound)
            {
                args.push_back("-profileopts");
				args.push_back("dcls");
            }
        }
        // Now split args into that god-awful char** that Cg insists on
        freeCgArgs();
        mCgArguments = new char*[args.size() + 1];
        int index = 0;
        for (i = args.begin(); i != args.end(); ++i, ++index)
        {
            mCgArguments[index] = new char[i->length() + 1];
            strcpy(mCgArguments[index], i->c_str());
        }
        // Null terminate list
        mCgArguments[index] = 0;


    }
EStatusCode Type1ToCFFEmbeddedFontWriter::WriteCharStrings(const StringVector& inSubsetGlyphIDs)
{
	/*
		1. build the charstrings data, looping the glyphs charstrings and writing a flattened
		   version of each charstring
		2. write the charstring index based on offsets inside the data (size should be according to the max)
		3. copy the data into the stream
	*/


	unsigned long* offsets = new unsigned long[inSubsetGlyphIDs.size() + 1];
	MyStringBuf charStringsData;
	OutputStringBufferStream charStringsDataWriteStream(&charStringsData);
	Type1ToType2Converter charStringConverter;
	StringVector::const_iterator itGlyphs = inSubsetGlyphIDs.begin();
	EStatusCode status = PDFHummus::eSuccess;

	do
	{
		unsigned short i=0;
		for(; itGlyphs != inSubsetGlyphIDs.end() && PDFHummus::eSuccess == status; ++itGlyphs,++i)
		{
			offsets[i] = (unsigned long)charStringsDataWriteStream.GetCurrentPosition();
			status = charStringConverter.WriteConvertedFontProgram(*itGlyphs,
																   &(mType1Input),
																   &charStringsDataWriteStream);
		}
		if(status != PDFHummus::eSuccess)
			break;

		offsets[i] = (unsigned long)charStringsDataWriteStream.GetCurrentPosition();

		charStringsData.pubseekoff(0,std::ios_base::beg);

		// write index section
		mCharStringPosition = mFontFileStream.GetCurrentPosition();
		Byte sizeOfOffset = GetMostCompressedOffsetSize(offsets[i] + 1);
		mPrimitivesWriter.WriteCard16((unsigned short)inSubsetGlyphIDs.size());
		mPrimitivesWriter.WriteOffSize(sizeOfOffset);
		mPrimitivesWriter.SetOffSize(sizeOfOffset);
		for(i=0;i<=inSubsetGlyphIDs.size();++i)
			mPrimitivesWriter.WriteOffset(offsets[i] + 1);

		// Write data
		InputStringBufferStream charStringsDataReadStream(&charStringsData);
		OutputStreamTraits streamCopier(&mFontFileStream);
		status = streamCopier.CopyToOutputStream(&charStringsDataReadStream);
	}while(false);

	delete[] offsets;
	return status;	
}
Esempio n. 5
0
// Break a contig into a lexicographically ordered set of kmers
StringVector MetAssemble::getLexicographicKmers(const std::string& contig) const
{
    StringVector out;
    for(size_t i = 0; i < contig.size() - m_parameters.kmer + 1; ++i)
    {
        std::string ks = contig.substr(i, m_parameters.kmer);
        std::string rs = reverseComplement(ks);
        out.push_back(ks < rs ? ks : rs);
    }

    std::sort(out.begin(), out.end());
    return out;
}
Esempio n. 6
0
	//---------------------------------------------------------------------
	void FreeImageCodec::startup(void)
	{
		FreeImage_Initialise(false);

		LogManager::getSingleton().logMessage(
			LML_NORMAL,
			"FreeImage version: " + String(FreeImage_GetVersion()));
		LogManager::getSingleton().logMessage(
			LML_NORMAL,
			FreeImage_GetCopyrightMessage());

		// Register codecs
		StringUtil::StrStreamType strExt;
		strExt << "Supported formats: ";
		bool first = true;
		for (int i = 0; i < FreeImage_GetFIFCount(); ++i)
		{

			// Skip DDS codec since FreeImage does not have the option 
			// to keep DXT data compressed, we'll use our own codec
			if ((FREE_IMAGE_FORMAT)i == FIF_DDS)
				continue;
			
			String exts(FreeImage_GetFIFExtensionList((FREE_IMAGE_FORMAT)i));
			if (!first)
			{
				strExt << ",";
			}
			first = false;
			strExt << exts;
			
			// Pull off individual formats (separated by comma by FI)
			StringVector extsVector = StringUtil::split(exts, ",");
			for (StringVector::iterator v = extsVector.begin(); v != extsVector.end(); ++v)
			{
				ImageCodec* codec = OGRE_NEW FreeImageCodec(*v, i);
				msCodecList.push_back(codec);
				Codec::registerCodec(codec);
			}
		}
		LogManager::getSingleton().logMessage(
			LML_NORMAL,
			strExt.str());

		// Set error handler
		FreeImage_SetOutputMessage(FreeImageErrorHandler);




	}
Esempio n. 7
0
/*-----------------------------------------------------------------------------
 | Initialize the RT Shader system.
 -----------------------------------------------------------------------------*/
bool OgreApp::initializeRTShaderSystem(SceneManager* sceneMgr)
{
    if (RTShader::ShaderGenerator::initialize())
    {
        mShaderGenerator = RTShader::ShaderGenerator::getSingletonPtr();
        
        mShaderGenerator->addSceneManager(sceneMgr);
        
        // Setup core libraries and shader cache path.
        StringVector groupVector = ResourceGroupManager::getSingleton().getResourceGroups();
        StringVector::iterator itGroup = groupVector.begin();
        StringVector::iterator itGroupEnd = groupVector.end();
        String shaderCoreLibsPath;
        String shaderCachePath;
        
        for (; itGroup != itGroupEnd; ++itGroup)
        {
            ResourceGroupManager::LocationList resLocationsList = ResourceGroupManager::getSingleton().getResourceLocationList(*itGroup);
            ResourceGroupManager::LocationList::iterator it = resLocationsList.begin();
            ResourceGroupManager::LocationList::iterator itEnd = resLocationsList.end();
            bool coreLibsFound = false;
            
            // Try to find the location of the core shader lib functions and use it
            // as shader cache path as well - this will reduce the number of generated files
            // when running from different directories.
            for (; it != itEnd; ++it)
            {
                if ((*it)->archive->getName().find("RTShaderLib") != String::npos)
                {
                    shaderCoreLibsPath = (*it)->archive->getName() + "/";
                    shaderCachePath = shaderCoreLibsPath;
                    coreLibsFound = true;
                    break;
                }
            }
            // Core libs path found in the current group.
            if (coreLibsFound)
                break;
        }
        
        // Core shader libs not found -> shader generating will fail.
        if (shaderCoreLibsPath.empty())
            return false;
        
        // Create and register the material manager listener.
        mMaterialMgrListener = new ShaderGeneratorTechniqueResolverListener(mShaderGenerator);
        MaterialManager::getSingleton().addListener(mMaterialMgrListener);
    }
    
    return true;
}
Esempio n. 8
0
int main ( )
{

	PME regex ( ", " );
	int i = regex.split ( "very, very2, tired" );

	for ( int j = 0; j < i; j++ ) {
		
		printf ( "%s\n", regex [ j ].c_str ( ) );

	}

	StringVector sv = regex.GetStringVector ( );
	
	for ( StringVector::iterator i = sv.begin ( );
		  i != sv.end ( );
		  i++ ) {

		printf ( "%s\n", i->c_str ( ) );

	}


	PME match ( "([a-z])([0-9])([A-Z])" );

	match.match ( "b2Z" );

	sv = match.GetStringVector ( );

	for ( StringVector::iterator i = sv.begin ( );
		  i != sv.end ( );
		  i++ ) {

		printf ( "%s\n", i->c_str ( ) );

	}

}
Esempio n. 9
0
 bool matches(const std::string& s) const {
   StringVector tokens;
   boost::split(tokens, s, boost::is_any_of(" "));
   
   StringVector::const_iterator it;
   for (it = tokens.begin(); it != tokens.end(); ++it) {
     if (!boost::icontains(title, *it) &&
         !boost::icontains(artist, *it) &&
         !boost::icontains(album, *it)) {
       return false;
     }
   }
   return true;
 }
Esempio n. 10
0
IpAddress::IpAddress(const char* ip_string)
{
    try
    {
        int counter = 0;
        StringVector vector = Helper::split(ip_string,  '.');
        for (StringVector::iterator itr = vector.begin(); itr != vector.end(); ++itr)
            part[counter++] = atoi((*itr).c_str());
    }
    catch (int /*e*/)
    {
        setNull();
    }
}
/*!
* Detect the character(s) that is used for marking a line as a comment line.
* If such a character is found, it is added to LineCommentStart vector.
* Since assembly code counter covers multiple assembly languages, there can be
* mulitple markers in the same program. 
* GNU Assembler, for instance, supports # and ; for comment lines
*
* \param fmap list of file lines
*
*/
void CAssemblyCounter::FindLineCommentMarker(filemap* fmap)
{
    StringVector markerChecklist;   // contains line comment markers that need to be checked/tested
    markerChecklist.push_back("#");
    markerChecklist.push_back(";");
    markerChecklist.push_back("|");

    LineCommentStart.clear();       // remove all existing values just in case it was set unintentionally

    /* Algorithm:
        1.	Read each line
            a.	For each comment marker, find position/index of the marker
                i.	If position is 0, a marker is found
                    1.	Save/add the marker: LineCommentStart.push_back()
                    2.	Remove the marker from the check list
                ii.	If position is > 0 && not last index && (position-1) is a space, a marker is found.
                    1.	Save/add the marker: LineCommentStart.push_back()
                    2.	Remove the marker from the check list
    */
    StringVector::iterator nextMarker;
    string line;
    size_t position;
    for (filemap::iterator fit = fmap->begin(); fit != fmap->end(); fit++)
    {
        line = fit->line;
        nextMarker = markerChecklist.begin();
        while (nextMarker != markerChecklist.end())
        {
            position = line.find(*nextMarker);
            if (position == string::npos)
            {
                nextMarker++;
                continue;
            }
            else if (position == 0)
            {
                LineCommentStart.push_back(*nextMarker);
                nextMarker = markerChecklist.erase(nextMarker);
            }
            else if (position > 0 && position != (line.length() - 1) && line.at(position - 1) == ' ')
            {
                LineCommentStart.push_back(*nextMarker);
                nextMarker = markerChecklist.erase(nextMarker);
            }
            else
                nextMarker++;
        }
    }
}
Esempio n. 12
0
  void ScriptsVectorController::directoryChanged(const QString &t_path)
  {
    StringVector extsToIgnore;
    extsToIgnore.push_back("osp");
    extsToIgnore.push_back("osp-journal");
    extsToIgnore.push_back("db");
    extsToIgnore.push_back("db-journal");
    StringVector::const_iterator extsToIgnoreBegin = extsToIgnore.begin();
    StringVector::const_iterator extsToIgnoreEnd = extsToIgnore.end();

    openstudio::path path = openstudio::toPath(t_path);

    if (!m_fswatcher->directories().contains(toQString(m_path))
        && boost::filesystem::exists(m_path))
    {
      m_fswatcher->addPath(openstudio::toQString(m_path));
    }

    if (!m_fswatcher->directories().contains(toQString(m_path.parent_path()))
        && boost::filesystem::exists(m_path.parent_path()))
    {
      m_fswatcher->addPath(openstudio::toQString(m_path.parent_path()));
    }

 
    if (path == m_path) {
      // ooh, it was us.
      QStringList files = QDir(openstudio::toQString(m_path)).entryList(QDir::Files, QDir::Name);

      std::vector<OSItemId> items;
      for (QStringList::const_iterator itr = files.begin();
           itr != files.end();
           ++itr)
      {
        openstudio::path filePath = openstudio::toPath(*itr);
        std::string ext = getFileExtension(filePath);
        if (std::find(extsToIgnoreBegin,extsToIgnoreEnd,ext) == extsToIgnoreEnd) {
          items.push_back(scriptToItemId(m_path / filePath));
        }
      }

      m_items = items;
      std::reverse(m_items.begin(), m_items.end());

      emit itemIds(m_items);
    } else {
      LOG(Debug, "No match for FS Path: " << openstudio::toString(path) << " " << openstudio::toString(m_path));
    }
  }
Esempio n. 13
0
bool XMLElement::SetStringVector(const StringVector& value)
{
    if (!RemoveChildren("string"))
        return false;

    for (auto i = value.begin(); i != value.end(); ++i)
    {
        XMLElement stringElem = CreateChild("string");
        if (!stringElem)
            return false;
        stringElem.SetAttribute("value", *i);
    }

    return true;
}
Esempio n. 14
0
    //-----------------------------------------------------------------------
    String StringConverter::toString(const StringVector& val)
    {
        StringStream stream;
        StringVector::const_iterator i, iend, ibegin;
        ibegin = val.begin();
        iend = val.end();
        for (i = ibegin; i != iend; ++i)
        {
            if (i != ibegin)
                stream << " ";

            stream << *i; 
        }
        return stream.str();
    }
Esempio n. 15
0
void ModuleLinkerPass::deleteAllSymbolsExceptThese(
	const StringVector& symbolsToKeep)
{
	StringSet keptSymbols(symbolsToKeep.begin(), symbolsToKeep.end());
	
	auto symbols = getAllSymbols(_linkedModule);
	
	for(auto symbol = symbols.begin();
		symbol != symbols.end(); ++symbol)
	{
		if(keptSymbols.count(*symbol) != 0) continue;
		
		removeSymbol(_linkedModule, *symbol);
	}
}
Esempio n. 16
0
void InitThesList (const CThesaurus* Thes, string ConceptStr,	StringVector& Vec)
{
	Vec.clear();
	vector<int> LowerTermins;
	Thes->QueryLowerTermins(ConceptStr.c_str(), morphRussian, LowerTermins);
	long Count = LowerTermins.size();
	for (long i=0; i <Count; i++)
	{
			const CInnerTermin& T = Thes->m_Termins[LowerTermins[i]];
			string TerminStr =  T.m_TerminStr;
			EngRusMakeUpper(TerminStr);
			Vec.push_back(TerminStr);
	};
	sort(Vec.begin(),Vec.end());
};
Esempio n. 17
0
static StringVector getOptimizations(const std::string& optimizationList)
{
	StringVector passes = hydrazine::split(optimizationList, ",");
	StringVector splitPasses;
	
	splitPasses.reserve(passes.size());
	
	for(hydrazine::StringVector::iterator pass = passes.begin(); 
		pass != passes.end(); ++pass)
	{
		splitPasses.push_back(hydrazine::strip(*pass, " "));
	}
	
	return splitPasses;
}
Esempio n. 18
0
void CachedResourceLoader::garbageCollectDocumentResources()
{
    typedef Vector<String, 10> StringVector;
    StringVector resourcesToDelete;

    for (DocumentResourceMap::iterator it = m_documentResources.begin(); it != m_documentResources.end(); ++it) {
        if (it->value->hasOneHandle()) {
            resourcesToDelete.append(it->key);
            it->value->setOwningCachedResourceLoader(0);
        }
    }

    for (StringVector::const_iterator it = resourcesToDelete.begin(); it != resourcesToDelete.end(); ++it)
        m_documentResources.remove(*it);
}
Esempio n. 19
0
inline int FindKey(StringVector colNameList, String item)
{
  int index = -1;
  int found = 0;
  for (Rcpp::StringVector::iterator it = colNameList.begin(); it != colNameList.end(); ++it)
  {
    if (*it == item)
    {
      index = found;
      break;
    }
    ++found;
  }

  return index;
}
Esempio n. 20
0
StringVector PME::GetStringVector ( ) 
{
	
	StringVector oStringVector;

	for ( int nCurrentMatch = 0;
		  nCurrentMatch < nMatches;
		  nCurrentMatch++ ) {

		oStringVector.insert ( oStringVector.end ( ), (*this)[nCurrentMatch] );

	}

	return oStringVector;

}
Esempio n. 21
0
	void ConsoleBackend::addText(std::string text, size_t level) {
		// split the text on newlines, to aid line counting
		StringVector lines = StringUtil::split(text, "\r\n");

		StringVector::iterator it = lines.begin();

		for (;it != lines.end(); it++) {
			mMessages.push_back(std::make_pair(level, *it));
		}

		// if the size is greater the mTextHistory, remove till sufficient
		while (mMessages.size() > mTextHistory)
			mMessages.pop_front();

		mChanged = true;
	}
Esempio n. 22
0
void OSDoubleEdit::bind(model::ModelObject& modelObject,
                          const char* property,
                          const boost::optional<std::string>& isDefaultedProperty,
                          const boost::optional<std::string>& isAutosizedProperty,
                          const boost::optional<std::string>& isAutocalculatedProperty)
{
  m_modelObject = modelObject;
  m_property = property;
  m_isDefaultedProperty = isDefaultedProperty;
  m_isAutosizedProperty = isAutosizedProperty;
  m_isAutocalculatedProperty = isAutocalculatedProperty;

  // only let one of autosize/autocalculate
  if (isAutosizedProperty && isAutocalculatedProperty) {
    LOG_AND_THROW("A field can only be autosized or autocalculated, it cannot be both.");
  }

  // check for attribute existence
  StringVector attributeNames = modelObject.attributeNames();
  StringVector::const_iterator anb(attributeNames.begin()),ane(attributeNames.end());
  BOOST_ASSERT(std::find(anb,ane,m_property) != ane);
  if (m_isDefaultedProperty) {
    BOOST_ASSERT(std::find(anb,ane,*m_isDefaultedProperty) != ane);
  }
  if (m_isAutosizedProperty) {
    BOOST_ASSERT(std::find(anb,ane,*m_isAutosizedProperty) != ane);
  }
  if (m_isAutocalculatedProperty) {
    BOOST_ASSERT(std::find(anb,ane,*m_isAutocalculatedProperty) != ane);
  }

  setEnabled(true);

  bool isConnected = false;
  isConnected = connect( this, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()) );
  BOOST_ASSERT(isConnected);

  isConnected = connect( m_modelObject->getImpl<openstudio::model::detail::ModelObject_Impl>().get(),SIGNAL(onChange()),
                         this,SLOT(onModelObjectChange()) );
  BOOST_ASSERT(isConnected);

  isConnected = connect( m_modelObject->getImpl<openstudio::model::detail::ModelObject_Impl>().get(),SIGNAL(onRemoveFromWorkspace(Handle)),
                         this,SLOT(onModelObjectRemove(Handle)) );
  BOOST_ASSERT(isConnected);

  refreshTextAndLabel();
}
Esempio n. 23
0
void calculateMetric(CSelectionData *selectionData, const std::string &name, rapidjson::Document &results)
{
    ITestSuiteMetricPlugin *metric = kernel.getTestSuiteMetricPluginManager().getPlugin(name);

    StringVector dependencies = metric->getDependency();
    for (StringVector::iterator it = dependencies.begin(); it != dependencies.end(); it++) {
        if (metricsCalculated.find(*it) == metricsCalculated.end()) {
            calculateMetric(selectionData, *it, results);
        }
    }

    (std::cerr << "[INFO] Calculating metrics: " << metric->getName() << " ...").flush();
    metric->init(selectionData, &clusterList, revision);
    metric->calculate(results);
    metricsCalculated.insert(name);
    (std::cerr << " done." << std::endl).flush();
}
Esempio n. 24
0
void MeshCombiner::consoleMeshCombiner()
{
    StringVector vec = m_MeshCombinerConfig->getMultiSetting( "Mesh" );
    if( vec.empty() )
        return;

    MergeMesh* mm = new MergeMesh();
    SkeletonPtr skel = SkeletonPtr();

    for( StringVector::iterator it = vec.begin();
            it != vec.end(); ++it )
    {
        log( "Loading: " + *it );
        try
        {
            MeshPtr mesh = MeshManager::getSingleton().load(
                               *it, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME );

            if( !mesh.isNull() )
                mm->addMesh( mesh );
        }
        catch( ... )
        {
        }
    }

    // save
    MeshPtr mesh = mm->bake();

    MeshSerializer* meshSerializer = new MeshSerializer();
    meshSerializer->exportMesh( mesh.getPointer(), "./media/merged.mesh" );

    MeshManager::getSingleton().remove( mesh->getHandle() );

    // try to load...
    mesh = MeshManager::getSingleton().load(
               "merged.mesh", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME );

    SceneManager* sm = Root::getSingleton().createSceneManager( ST_GENERIC );

    // try to place...
    sm->getRootSceneNode()->attachObject( sm->createEntity( "test", "merged.mesh" ) );

    delete meshSerializer;
    delete mm;
}
Esempio n. 25
0
// Garbage collecting m_documentResources is a workaround for the
// CachedResourceHandles on the RHS being strong references. Ideally this
// would be a weak map, however CachedResourceHandles perform additional
// bookkeeping on CachedResources, so instead pseudo-GC them -- when the
// reference count reaches 1, m_documentResources is the only reference, so
// remove it from the map.
void CachedResourceLoader::garbageCollectDocumentResourcesTimerFired(Timer<CachedResourceLoader>* timer)
{
    ASSERT_UNUSED(timer, timer == &m_garbageCollectDocumentResourcesTimer);

    typedef Vector<String, 10> StringVector;
    StringVector resourcesToDelete;

    for (DocumentResourceMap::iterator it = m_documentResources.begin(); it != m_documentResources.end(); ++it) {
        if (it->second->hasOneHandle()) {
            resourcesToDelete.append(it->first);
            it->second->setOwningCachedResourceLoader(0);
        }
    }

    for (StringVector::const_iterator it = resourcesToDelete.begin(); it != resourcesToDelete.end(); ++it)
        m_documentResources.remove(*it);
}
void reportingFrequencyGeneralTests(SqlFile& file, const SqlFileTimeSeriesQueryVector& allQueries) {
  // list of reporting frequencies from file should match .valueDescriptions() from vector
  StringSet rfStrs;
  for (const std::string& envPeriod : file.availableEnvPeriods()) {
    StringVector rfStrsForEnv = file.availableReportingFrequencies(envPeriod);
    rfStrs.insert(rfStrsForEnv.begin(),rfStrsForEnv.end());
  }
  ReportingFrequencySet rfSetFromVector = reportingFrequencies(allQueries);
  StringSet rfStrsFromVector;
  for (const ReportingFrequency& rf : rfSetFromVector) {
    rfStrsFromVector.insert(rf.valueDescription());
  }
  EXPECT_TRUE(rfStrs.size() >= rfStrsFromVector.size());
  for (const std::string& rfStr : rfStrsFromVector) {
    EXPECT_TRUE(rfStrs.find(rfStr) != rfStrs.end());
  }
}
Esempio n. 27
0
TEST_F(IddFixture, IddFile_EpGroups) {
  StringVector groups = epIddFile.groups();
  EXPECT_TRUE(groups.size() > 0);
  EXPECT_EQ("",groups[0]);
  std::stringstream ss;
  // uniqueness
  for (StringVector::const_iterator it = groups.begin(), itEnd = groups.end(); it != itEnd; ++it) {
    auto loc = std::find_if(it+1,itEnd,std::bind(istringEqual,*it,std::placeholders::_1));
    EXPECT_TRUE(loc == itEnd);
    if (loc != itEnd) {
      LOG(Debug,"The group name '" << *it << "' is repeated in epIddFile.");
    }
    ss << "  " << *it << std::endl;
  }
  // log groups
  LOG(Info,"The current EnergyPlus IddFile contains the following " << groups.size()
      << " object groups, including the first, unnamed group: " << std::endl << ss.str());
}
void CertificateChain::DisplaySigningChain(const StringVector& aSigningChain)
	{
	if(aSigningChain.size())
		{
		std::vector<std::string>::const_iterator chainIter = aSigningChain.begin();	
		do
			{
			cout << "Issued By : " << (*chainIter) << endl;
			++chainIter;
			cout << "Issued To : " << (*chainIter) << endl;
			++chainIter;
			cout << "Valid From : " << (*chainIter) << endl;
			++chainIter;
			cout << "Valid To : " << (*chainIter) << endl << endl;
			++chainIter;
			}while(chainIter != aSigningChain.end());	
		}
	}
Esempio n. 29
0
void ConfigCenter::loadFromDir(const std::string& path)
{
  logMsg(LOG_DEBUG, "config:reading config file fragments from \'%s\'", path.c_str());
  StringVector files;
  Directory::Iterator::Ptr it = Directory::enumerate(path);
  while(it->moveNext())
    {
      const std::string fileName = it->fullPath();
      if (File::isDir(fileName) || (!File::isRegFile(fileName) && !File::isSymLink(path)))//FIXME:Check exact symlink behaviour;
	continue;
      if (fileName.length() < 5 || fileName.substr(fileName.length() - 5) != ".conf")
	continue;
      files.push_back(fileName);
    }
  std::sort(files.begin(), files.end());
  for(StringVector::size_type i = 0;i < files.size();i++)
    loadFromFile(files[i]);
}
Esempio n. 30
0
bool TestOptimizations::doTest()
{
	typedef std::deque<unsigned int> TestSet;
	
	StringVector testVector = enumerateTests(getPTXFiles(path),
		getOptimizations(optimizations));
	
	status << " Enumerated " << testVector.size() << " tests\n";
	
	TestSet tests;
	
	for(auto test = testVector.begin(); test != testVector.end(); ++test)
	{
		tests.push_back(std::distance(testVector.begin(), test));
	}
	
	hydrazine::Timer timer;
	timer.start();
	
	unsigned int count = 0;
	
	for(unsigned int i = 0, e = tests.size(); i != e; ++i)
	{
		if(timer.seconds() > timeLimit) break;
		
		unsigned int index = random() % tests.size();
	
		TestSet::iterator testPosition = tests.begin() + index;
	
		std::string test = testVector[*testPosition];
	
		status << " Running test '" << test << "'\n";
	
		if(!runTest(test)) return false;
	
		tests.erase(testPosition);
	
		++count;
	}
	
	status << "Finished running " << count << " tests...\n";
	
	return true;
}