当前位置: 首页>>代码示例>>C++>>正文


C++ StringList类代码示例

本文整理汇总了C++中StringList的典型用法代码示例。如果您正苦于以下问题:C++ StringList类的具体用法?C++ StringList怎么用?C++ StringList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了StringList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AppendList

void StringList::AppendList(StringList strings) {
  size_t len = strings.GetSize();

  for (size_t i = 0; i < len; ++i)
    m_strings.push_back(strings.GetStringAtIndex(i));
}
开发者ID:kraj,项目名称:lldb,代码行数:6,代码来源:StringList.cpp

示例2: writeDefines

void CodeBlocksProvider::writeDefines(const StringList &defines, std::ofstream &output) const {
	for (StringList::const_iterator i = defines.begin(); i != defines.end(); ++i)
		output << "\t\t\t\t\t<Add option=\"-D" << *i << "\" />\n";
}
开发者ID:St0rmcrow,项目名称:scummvm,代码行数:4,代码来源:codeblocks.cpp

示例3: main

int main(){
    LDAPConstraints* cons=new LDAPConstraints;
    LDAPControlSet* ctrls=new LDAPControlSet;
    ctrls->add(LDAPCtrl(LDAP_CONTROL_MANAGEDSAIT));
    cons->setServerControls(ctrls);
    LDAPConnection *lc=new LDAPConnection("localhost",9009);
    lc->setConstraints(cons);
    std::cout << "----------------------doing bind...." << std::endl;
    try{
        lc->bind("cn=Manager,o=Organisation,c=DE" , "secret",cons);
        std::cout << lc->getHost() << std::endl;    
        bool result = lc->compare("cn=Manager,o=Organisation,c=DE", 
                LDAPAttribute("cn","Manaer"));
        std::cout << "Compare: " << result << std::endl;
    
        LDAPAttributeList* attrs=new LDAPAttributeList();
        StringList values;
        StringList s2;
        values.add("top");
        values.add("Person");
        attrs->addAttribute(LDAPAttribute("objectClass",values));
        attrs->addAttribute(LDAPAttribute("cn","Peter"));
        attrs->addAttribute(LDAPAttribute("sn","Peter,hallo"));
        LDAPEntry* entry=new LDAPEntry(
                "cn=Peter , o=Organisation, c=DE", attrs);    
//        lc->add(entry);
        
//        lc->del("ou=Groups,o=Organisation,c=DE");

        LDAPSearchResults* entries = lc->search("o=Organisation,c=DE",
                LDAPConnection::SEARCH_ONE);
        if (entries != 0){
            LDAPEntry* entry = entries->getNext();
            if(entry != 0){
                std::cout << *(entry) << std::endl;
            }
            while(entry){
                try{
                    entry = entries->getNext();
                    if(entry != 0){
                        std::cout << *(entry) << std::endl;
                    }
                    delete entry;
                }catch(LDAPReferralException e){
                    std::cout << "Caught Referral" << std::endl;
                }
            }
        }
        
        lc->unbind();
        delete lc;
   }catch (LDAPException &e){
        std::cout << "-------------- caught Exception ---------"<< std::endl;
        std::cout << e << std::endl;
    }

    /*
    std::cout << "--------------------starting search" << std::endl;
    LDAPAttributeList* attrs=new LDAPAttributeList();
    StringList values;
    values.add("top");
    values.add("organizationalUnit");
    attrs->addAttribute(LDAPAttribute("objectClass",values));
    attrs->addAttribute(LDAPAttribute("ou","Groups"));
    LDAPEntry* entry=new LDAPEntry(
            "ou=Groups, o=Organisation, c=DE", attrs);    

    LDAPAttribute newattr("description");
    LDAPModification::mod_op op = LDAPModification::OP_DELETE;
    LDAPModList *mod=new LDAPModList();
    mod->addModification(LDAPModification(newattr,op));
    LDAPMessageQueue* q=0;
    try{
        q=lc->search("o=Organisation,c=de",LDAPAsynConnection::SEARCH_SUB,
         "objectClass=*",StringList());
//        q=lc->add(entry);
//        q=lc->modify("cn=Manager,o=Organisation,c=DE",
//                mod);
        LDAPMsg *res=q->getNext();
        bool cont=true;
        while( cont  ) {
            switch(res->getMessageType()){
                LDAPSearchResult *res2;
                const LDAPEntry *entry;
                case LDAP_RES_SEARCH_ENTRY :
                    res2= (LDAPSearchResult*)res;
                    entry=  res2->getEntry();
                    std::cout << "Entry:            " << *entry << std::endl; 
                    delete res;
                    res=q->getNext();
                break;
                case LDAP_RES_SEARCH_REFERENCE :
                    std::cout << "Reference:         "  << std::endl;
                    delete res;
                    res=q->getNext();
                break;
                default :
                    std::cout << ( *(LDAPResult*) res) << std::endl;
                    delete res;
                    std::cout  << "-----------------search done" << std::endl;
//.........这里部分代码省略.........
开发者ID:cptaffe,项目名称:openldap,代码行数:101,代码来源:main.cpp

示例4: add

StringList::StringList( const StringList & rhs )
{
    for( const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter )
        add( (*iter)->c_str(), (*iter)->len() );
}
开发者ID:DSpeichert,项目名称:OpenLiteSpeed,代码行数:5,代码来源:stringlist.cpp

示例5: SetArtist

bool CTagLoaderTagLib::ParseID3v2Tag(ID3v2::Tag *id3v2, EmbeddedArt *art, CMusicInfoTag& tag)
{
  //  tag.SetURL(strFile);
  if (!id3v2) return false;

  ID3v2::AttachedPictureFrame *pictures[3] = {};
  const ID3v2::FrameListMap& frameListMap = id3v2->frameListMap();
  for (ID3v2::FrameListMap::ConstIterator it = frameListMap.begin(); it != frameListMap.end(); ++it)
  {
    if      (it->first == "TPE1")   SetArtist(tag, GetID3v2StringList(it->second));
    else if (it->first == "TALB")   tag.SetAlbum(it->second.front()->toString().to8Bit(true));
    else if (it->first == "TPE2")   SetAlbumArtist(tag, GetID3v2StringList(it->second));
    else if (it->first == "TIT2")   tag.SetTitle(it->second.front()->toString().to8Bit(true));
    else if (it->first == "TCON")   SetGenre(tag, GetID3v2StringList(it->second));
    else if (it->first == "TRCK")   tag.SetTrackNumber(strtol(it->second.front()->toString().toCString(true), NULL, 10));
    else if (it->first == "TPOS")   tag.SetPartOfSet(strtol(it->second.front()->toString().toCString(true), NULL, 10));
    else if (it->first == "TYER")   tag.SetYear(strtol(it->second.front()->toString().toCString(true), NULL, 10));
    else if (it->first == "TCMP")   tag.SetCompilation((strtol(it->second.front()->toString().toCString(true), NULL, 10) == 0) ? false : true);
    else if (it->first == "TENC")   {} // EncodedBy
    else if (it->first == "TCOP")   {} // Copyright message
    else if (it->first == "TDRC")   tag.SetYear(strtol(it->second.front()->toString().toCString(true), NULL, 10));
    else if (it->first == "TDRL")   tag.SetYear(strtol(it->second.front()->toString().toCString(true), NULL, 10));
    else if (it->first == "TDTG")   {} // Tagging time
    else if (it->first == "TLAN")   {} // Languages
    else if (it->first == "USLT")
      // Loop through any lyrics frames. Could there be multiple frames, how to choose?
      for (ID3v2::FrameList::ConstIterator lt = it->second.begin(); lt != it->second.end(); ++lt)
      {
        ID3v2::UnsynchronizedLyricsFrame *lyricsFrame = dynamic_cast<ID3v2::UnsynchronizedLyricsFrame *> (*lt);
        if (lyricsFrame)           
          tag.SetLyrics(lyricsFrame->text().to8Bit(true));
      }
    else if (it->first == "COMM")
      // Loop through and look for the main (no description) comment
      for (ID3v2::FrameList::ConstIterator ct = it->second.begin(); ct != it->second.end(); ++ct)
      {
        ID3v2::CommentsFrame *commentsFrame = dynamic_cast<ID3v2::CommentsFrame *> (*ct);
        if (commentsFrame && commentsFrame->description().isEmpty())
          tag.SetComment(commentsFrame->text().to8Bit(true));
      }
    else if (it->first == "TXXX")
      // Loop through and process the UserTextIdentificationFrames
      for (ID3v2::FrameList::ConstIterator ut = it->second.begin(); ut != it->second.end(); ++ut)
      {
        ID3v2::UserTextIdentificationFrame *frame = dynamic_cast<ID3v2::UserTextIdentificationFrame *> (*ut);
        if (!frame) continue;
        
        // First field is the same as the description
        StringList stringList = frame->fieldList(); 
        stringList.erase(stringList.begin());
        if      (frame->description() == "MusicBrainz Artist Id")       tag.SetMusicBrainzArtistID(StringListToVectorString(stringList));
        else if (frame->description() == "MusicBrainz Album Id")        tag.SetMusicBrainzAlbumID(stringList.front().to8Bit(true));
        else if (frame->description() == "MusicBrainz Album Artist Id") tag.SetMusicBrainzAlbumArtistID(StringListToVectorString(stringList));
        else if (frame->description() == "replaygain_track_gain")       tag.SetReplayGainTrackGain((int)(atof(stringList.front().toCString(true)) * 100 + 0.5));
        else if (frame->description() == "replaygain_album_gain")       tag.SetReplayGainAlbumGain((int)(atof(stringList.front().toCString(true)) * 100 + 0.5));
        else if (frame->description() == "replaygain_track_peak")       tag.SetReplayGainTrackPeak((float)atof(stringList.front().toCString(true)));
        else if (frame->description() == "replaygain_album_peak")       tag.SetReplayGainAlbumPeak((float)atof(stringList.front().toCString(true)));
        else if (frame->description() == "ALBUMARTIST")                 SetAlbumArtist(tag, StringListToVectorString(stringList));
        else if (frame->description() == "ALBUM ARTIST")                SetAlbumArtist(tag, StringListToVectorString(stringList));
        else if (g_advancedSettings.m_logLevel == LOG_LEVEL_MAX)
          CLog::Log(LOGDEBUG, "unrecognized user text tag detected: TXXX:%s", frame->description().toCString(true));
      }
    else if (it->first == "UFID")
      // Loop through any UFID frames and set them
      for (ID3v2::FrameList::ConstIterator ut = it->second.begin(); ut != it->second.end(); ++ut)
      {
        ID3v2::UniqueFileIdentifierFrame *ufid = reinterpret_cast<ID3v2::UniqueFileIdentifierFrame*> (*ut);
        if (ufid->owner() == "http://musicbrainz.org")
        {
          // MusicBrainz pads with a \0, but the spec requires binary, be cautious
          char cUfid[64];
          int max_size = std::min((int)ufid->identifier().size(), 63);
          strncpy(cUfid, ufid->identifier().data(), max_size);
          cUfid[max_size] = '\0';
          tag.SetMusicBrainzTrackID(cUfid);
        }
      }
    else if (it->first == "APIC")
      // Loop through all pictures and store the frame pointers for the picture types we want
      for (ID3v2::FrameList::ConstIterator pi = it->second.begin(); pi != it->second.end(); ++pi)
      {
        ID3v2::AttachedPictureFrame *pictureFrame = dynamic_cast<ID3v2::AttachedPictureFrame *> (*pi);
        if (!pictureFrame) continue;
        
        if      (pictureFrame->type() == ID3v2::AttachedPictureFrame::FrontCover) pictures[0] = pictureFrame;
        else if (pictureFrame->type() == ID3v2::AttachedPictureFrame::Other)      pictures[1] = pictureFrame;
        else if (pi == it->second.begin())                                        pictures[2] = pictureFrame;
      }
    else if (it->first == "POPM")
      // Loop through and process ratings
      for (ID3v2::FrameList::ConstIterator ct = it->second.begin(); ct != it->second.end(); ++ct)
      {
        ID3v2::PopularimeterFrame *popFrame = dynamic_cast<ID3v2::PopularimeterFrame *> (*ct);
        if (!popFrame) continue;
        
        // @xbmc.org ratings trump others (of course)
        if      (popFrame->email() == "[email protected]")
          tag.SetRating(popFrame->rating() / 51 + '0');
        else if (tag.GetRating() == '0')
        {
//.........这里部分代码省略.........
开发者ID:MoiTempete,项目名称:xbmc,代码行数:101,代码来源:TagLoaderTagLib.cpp

示例6: NEW_TMP_FILE

	p.setValue("item3", 7.6);
	p.setValue("doublelist", ListUtils::create<double>("1.22,2.33,4.55"));
	p.setValue("doublelist2", ListUtils::create<double>(""));
	p.setValue("doublelist3", ListUtils::create<double>("1.4"));
	//store
	String filename;
	NEW_TMP_FILE(filename);
	paramFile.store(filename,p);
	//load
	Param p2;
	paramFile.load(filename,p2);

	TEST_EQUAL(p2.size(),12);

	TEST_EQUAL(p2.getValue("stringlist").valueType(), DataValue::STRING_LIST)
	StringList list = p2.getValue("stringlist");
	TEST_EQUAL(list.size(),3)
	TEST_EQUAL(list[0],"a")
	TEST_EQUAL(list[1],"bb")
	TEST_EQUAL(list[2],"ccc")

	TEST_EQUAL(p2.getValue("stringlist2").valueType(), DataValue::STRING_LIST)
	list = p2.getValue("stringlist2");
	TEST_EQUAL(list.size(),0)

	TEST_EQUAL(p2.getValue("stringlist").valueType(), DataValue::STRING_LIST)
	list = p2.getValue("stringlist3");
	TEST_EQUAL(list.size(),1)
	TEST_EQUAL(list[0],"1")

	TEST_EQUAL(p2.getValue("intlist").valueType(), DataValue::INT_LIST)
开发者ID:chahuistle,项目名称:OpenMS,代码行数:31,代码来源:ParamXMLFile_test.cpp

示例7: ParsePropertyValues

bool PropertySpecification::ParsePropertyValues(StringList& values_list, const String& values, bool split_values) const
{
	String value;

	enum ParseState { VALUE, VALUE_PARENTHESIS, VALUE_QUOTE };
	ParseState state = VALUE;
	int open_parentheses = 0;

	size_t character_index = 0;
	char previous_character = 0;
	while (character_index < values.Length())
	{
		char character = values[character_index];
		character_index++;

		switch (state)
		{
			case VALUE:
			{
				if (character == ';')
				{
					value = StringUtilities::StripWhitespace(value);
					if (value.Length() > 0)
					{
						values_list.push_back(value);
						value.Clear();
					}
				}
				else if (StringUtilities::IsWhitespace(character))
				{
					if (split_values)
					{
						value = StringUtilities::StripWhitespace(value);
						if (value.Length() > 0)
						{
							values_list.push_back(value);
							value.Clear();
						}
					}
					else
						value.Append(character);
				}
				else if (character == '"')
				{
					if (split_values)
					{
						value = StringUtilities::StripWhitespace(value);
						if (value.Length() > 0)
						{
							values_list.push_back(value);
							value.Clear();
						}
						state = VALUE_QUOTE;
					}
					else
					{
						value.Append(' ');
						state = VALUE_QUOTE;
					}
				}
				else if (character == '(')
				{
					open_parentheses = 1;
					value.Append(character);
					state = VALUE_PARENTHESIS;
				}
				else
				{
					value.Append(character);
				}
			}
			break;

			case VALUE_PARENTHESIS:
			{
				if (previous_character == '/')
				{
					if (character == ')' || character == '(')
						value.Append(character);
					else
					{
						value.Append('/');
						value.Append(character);
					}
				}
				else
				{
					if (character == '(')
					{
						open_parentheses++;
						value.Append(character);
					}
					else if (character == ')')
					{
						open_parentheses--;
						value.Append(character);
						if (open_parentheses == 0)
							state = VALUE;
					}
					else if (character != '/')
//.........这里部分代码省略.........
开发者ID:BlueMustache,项目名称:Unvanquished,代码行数:101,代码来源:PropertySpecification.cpp

示例8: ASSERT

EC2Resource::BatchStatusResult EC2Resource::StartBatchStatus() {
    ASSERT( status_gahp );

    // m_checkSpotNext starts out false
    if( ! m_checkSpotNext ) {
        StringList returnStatus;
        std::string errorCode;
        int rc = status_gahp->ec2_vm_status_all( resourceName,
                    m_public_key_file, m_private_key_file,
                    returnStatus, errorCode );

        if( rc == GAHPCLIENT_COMMAND_PENDING ) { return BSR_PENDING; }
    
        if( rc != 0 ) {
            std::string errorString = status_gahp->getErrorString();
            dprintf( D_ALWAYS, "Error doing batched EC2 status query: %s: %s.\n",
                     errorCode.c_str(), errorString.c_str() );
            return BSR_ERROR;
        }

        //
        // We have to let a job know if we can't find a status report for it.
        //
        List<EC2Job> myJobs;
        EC2Job * nextJob = NULL;
		BaseJob *nextBaseJob = NULL;
		registeredJobs.Rewind();
		while ( (nextBaseJob = registeredJobs.Next()) ) {
			nextJob = dynamic_cast< EC2Job * >( nextBaseJob );
			ASSERT( nextJob );
			if ( !nextJob->m_client_token.empty() ) {
				myJobs.Append( nextJob );
			}
		}

        returnStatus.rewind();
        ASSERT( returnStatus.number() % 6 == 0 );
        for( int i = 0; i < returnStatus.number(); i += 6 ) {
            std::string instanceID = returnStatus.next();
            std::string status = returnStatus.next();
            std::string clientToken = returnStatus.next();
            std::string keyName = returnStatus.next();
            std::string stateReasonCode = returnStatus.next();
            std::string publicDNSName = returnStatus.next();

            // Efficiency suggests we look via the instance ID first,
            // and then try to look things up via the client token
            // (or, for GT #3682, via the keypair ID).

            // We can't use BaseJob::JobsByRemoteId because OpenStack doesn't
            // include the client token in its status responses, and therefore
            // we can't always fully reconstruct the remoteJobID used as the key.
            EC2Job * job = NULL;
            rc = jobsByInstanceID.lookup( HashKey( instanceID.c_str() ), job );
            if( rc == 0 ) {
                ASSERT( job );
        
                dprintf( D_FULLDEBUG, "Found job object for '%s', updating status ('%s').\n", instanceID.c_str(), status.c_str() );
                job->StatusUpdate( instanceID.c_str(), status.c_str(),
                                   stateReasonCode.c_str(), publicDNSName.c_str() );
                myJobs.Delete( job );
                continue;
            }

            // If we got a client token, use that to look up the job.  We
            // don't use the instance ID because we may discover it in
            // this function.  Since we need instance ID -based dispatch
            // code for OpenStack anyway, we'll just use it, rather than
            // trying the remoteJobID with the instance ID if we don't
            // find it using only the client token.
            if( ! clientToken.empty() && clientToken != "NULL" ) {
                std::string remoteJobID;
                formatstr( remoteJobID, "ec2 %s %s", resourceName, clientToken.c_str() );
                
                BaseJob * tmp = NULL;
                rc = BaseJob::JobsByRemoteId.lookup( HashKey( remoteJobID.c_str() ), tmp );
                
                if( rc == 0 ) {
                    ASSERT( tmp );
                    EC2Job * job = dynamic_cast< EC2Job * >( tmp );
                    if( job == NULL ) {
                        EXCEPT( "Found non-EC2Job identified by '%s'.", remoteJobID.c_str() );
                    }
                    
                    dprintf( D_FULLDEBUG, "Found job object via client token for '%s', updating status ('%s').\n", instanceID.c_str(), status.c_str() );
                    job->StatusUpdate( instanceID.c_str(), status.c_str(),
                                       stateReasonCode.c_str(), publicDNSName.c_str() );
                    myJobs.Delete( job );
                    continue;
                }
            }
            
			// Some servers (OpenStack, Eucalyptus) silently ignore client
			// tokens. So we need to use the ssh keypair to find jobs that
			// were submitted but which we don't have an instance ID for.
			//
			// TODO This code should be made more efficient. We can
			//   do something better than a linear scan through all
			//   jobs for each status result. Ideally, we'd parse the
			//   ssh keypair name and if it looks like one we generated,
//.........这里部分代码省略.........
开发者ID:AmesianX,项目名称:htcondor,代码行数:101,代码来源:ec2resource.cpp

示例9: toLower

 void StringListUtils::toLower(StringList & sl)
 {
   std::for_each(sl.begin(), sl.end(), boost::mem_fn(&String::toLower));
 }
开发者ID:BioITer,项目名称:OpenMS,代码行数:4,代码来源:StringListUtils.C

示例10: START_TEST

using namespace OpenMS;
using namespace std;

///////////////////////////

START_TEST(StringList, "$Id$")

/////////////////////////////////////////////////////////////

START_SECTION((static StringList fromQStringList(const QStringList &rhs)))
{
  QStringList q_str_list;
  q_str_list << "First Element" << "Second Element" << "Third Element";

  StringList str_list = StringListUtils::fromQStringList(q_str_list);
  TEST_EQUAL((int)str_list.size(), q_str_list.size())
  ABORT_IF((int)str_list.size() != q_str_list.size())
  for(Size i = 0 ; i < str_list.size() ; ++i)
  {
    TEST_EQUAL(str_list[i], String(q_str_list[(int)i]))
  }
}
END_SECTION


START_SECTION((static void toUpper(StringList &sl)))
{
	StringList list = ListUtils::create<String>("yes,no");
	StringListUtils::toUpper(list);
	TEST_EQUAL(list[0],"YES")
开发者ID:chahuistle,项目名称:OpenMS,代码行数:30,代码来源:StringListUtils_test.cpp

示例11: SetSourceOrder

 virtual void SetSourceOrder(StringList &sourceNames)
 {
     StringList* order = new StringList();
     order->CopyList(sourceNames);
     PostMessage(hwndMain, OBS_SETSOURCEORDER, 0, (LPARAM) order);
 }
开发者ID:Aslai,项目名称:OBS,代码行数:6,代码来源:API.cpp

示例12: ProteinIdentification

  void
  PepNovoOutfile::load(
    const std::string & result_filename,
    vector<PeptideIdentification> & peptide_identifications,
    ProteinIdentification & protein_identification,
    const double & score_threshold,
    const IndexPosMappingType & index_to_precursor,
    const map<String, String> & pnovo_modkey_to_mod_id
    )
  {
    // generally used variables
    StringList substrings;
    map<String, Int> columns;
    PeptideHit peptide_hit;

    String
      line,
      score_type = "PepNovo",
      version = "unknown",
      identifier,
      filename,
      sequence,
      sequence_with_mods;

    DateTime datetime = DateTime::now();     // there's no date given from PepNovo
    protein_identification.setDateTime(datetime);

    peptide_identifications.clear();
    PeptideIdentification peptide_identification;
    protein_identification = ProteinIdentification();

    // open the result
    ifstream result_file(result_filename.c_str());
    if (!result_file)
    {
      throw Exception::FileNotFound(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, result_filename);
    }

    Size line_number(0);     // used to report in which line an error occurred
    Size id_count(0);        // number of IDs seen (not necessarily the ones finally returned)

    getSearchEngineAndVersion(result_filename, protein_identification);
    //if information could not be retrieved from the outfile use defaults
    if (protein_identification.getSearchEngineVersion().empty())
    {
      protein_identification.setSearchEngine("PepNovo");
      protein_identification.setSearchEngineVersion(version);
    }
    identifier = protein_identification.getSearchEngine() + "_" + datetime.getDate();
    protein_identification.setIdentifier(identifier);

    map<String, String> mod_mask_map;
    const vector<String> & mods = protein_identification.getSearchParameters().variable_modifications;
    for (vector<String>::const_iterator mod_it = mods.begin(); mod_it != mods.end(); ++mod_it)
    {
      if (mod_it->empty())
        continue;
      //cout<<*mod_it<<endl;
      if (pnovo_modkey_to_mod_id.find(*mod_it) != pnovo_modkey_to_mod_id.end())
      {
        //cout<<keys_to_id.find(*mod_it)->second<<endl;
        ResidueModification tmp_mod = ModificationsDB::getInstance()->getModification(pnovo_modkey_to_mod_id.find(*mod_it)->second);
        if (mod_it->prefix(1) == "^" || mod_it->prefix(1) == "$")
        {
          mod_mask_map[*mod_it] = "(" + tmp_mod.getId() + ")";
        }
        else
        {
          mod_mask_map[*mod_it] = String(tmp_mod.getOrigin()) + "(" + tmp_mod.getId() + ")";
        }
      }
      else
      {
        if (mod_it->prefix(1) != "^" && mod_it->prefix(1) != "$")
        {
          mod_mask_map[*mod_it] = mod_it->prefix(1) + "[" + mod_it->substr(1) + "]";
          //cout<<mod_mask_map[*mod_it]<<endl;
        }
        else
        {
          mod_mask_map[*mod_it] = "[" + *mod_it + "]";
          //cout<<mod_mask_map[*mod_it]<<endl;
        }
      }
    }


    Size index;
    while (getline(result_file, line))
    {
      if (!line.empty() && (line[line.length() - 1] < 33)) line.resize(line.length() - 1); // remove weird EOL character
      line.trim();
      ++line_number;
      if (line.hasPrefix(">> "))         // >> 1 /home/shared/pepnovo/4611_raw_ms2_picked.mzXML.1001.2.dta
      {
        ++id_count;
        if (!peptide_identification.empty() && !peptide_identification.getHits().empty())
        {
          peptide_identifications.push_back(peptide_identification);
        }
//.........这里部分代码省略.........
开发者ID:OpenMS,项目名称:OpenMS,代码行数:101,代码来源:PepNovoOutfile.cpp

示例13: fprintf

// creates a page based on user input -- either displays data from
//   form or presents a form for users to submit data.
ResponseCode FormTester::HandleRequest ( HttpRequest * ipoHttpRequest,
        HttpResponse * ipoHttpResponse )
{
    char psHtml[ 5000 ];


    // if we got data from the user, show it
    if ( ipoHttpRequest->oFormValueMap [ "user" ].sBody.length ( ) ||
            ipoHttpRequest->oFormValueMap [ "existinguser" ].sBody.length ( ) ) {

        std::string sName;

        sName = ipoHttpRequest->oFormValueMap [ "existinguser" ].sBody;
        if ( ipoHttpRequest->oFormValueMap [ "user" ].sBody.length() ) {
            sName = ipoHttpRequest->oFormValueMap [ "user" ].sBody;
        }

        fprintf ( stderr, "Got name of %s\n", sName.c_str ( ) );

        char * psHtml = new char [ 5000 ];
        sprintf ( psHtml, "<html><head><title>StringList</title></head>\n<body>Hi %s</body></html>", sName.c_str ( ) );
        oNameList.push_back ( sName );

        ipoHttpResponse->SetBody( psHtml, strlen( psHtml ) );
        return HTTPRESPONSECODE_200_OK;

    } else {

        // otherwise, present the form to the user to fill in
        fprintf ( stderr, "Got no form data\n" );

        // create the options for the dropdown box
        char * psOptions;
        if ( oNameList.size ( ) > 0 )
            psOptions = new char [ oNameList.size ( ) * 200 ];
        else
            psOptions = new char [1];

        psOptions [ 0 ] = '\0';

        for ( StringList::iterator oCurrentName = oNameList.begin();
                oCurrentName != oNameList.end ( );
                oCurrentName++ ) {

            char psOption [ 200 ];
            sprintf ( psOption, "<option>%s\n",
                      oCurrentName->substr ( 0, 150 ).c_str ( ) );
            strcat ( psOptions, psOption );

        }

        sprintf ( psHtml, "<html><head><title>StringList</title></head> <body>Please log in<P> <form action = \"/\" method=GET> User name: <input type = text  name = user><BR> <select name = existinguser width = 20> %s </select> <input type = submit> </form>\n",
                  psOptions );

        delete[] psOptions;

        ipoHttpResponse->SetBody( psHtml, strlen( psHtml ) );
        return HTTPRESPONSECODE_200_OK;

    }

}
开发者ID:F420,项目名称:mtasa-blue,代码行数:64,代码来源:ehs_formtest.cpp

示例14: schedd

int
CondorQ::fetchQueueFromHostAndProcessV2(const char *host,
					const char *constraint,
					StringList &attrs,
					condor_q_process_func process_func,
					void * process_func_data,
					int connect_timeout,
					CondorError *errstack)
{
	classad::ClassAdParser parser;
	classad::ExprTree *expr = NULL;
	parser.ParseExpression(constraint, expr);
	if (!expr) return Q_INVALID_REQUIREMENTS;

	classad::ExprList *projList = new classad::ExprList();
	if (!projList) return Q_INTERNAL_ERROR;
	attrs.rewind();
	const char *attr;
	while ((attr = attrs.next())) {
		classad::Value value; value.SetStringValue(attr);
		classad::ExprTree *entry = classad::Literal::MakeLiteral(value);
		if (!entry) return Q_INTERNAL_ERROR;
		projList->push_back(entry);
	}
	classad::ClassAd ad;
	ad.Insert(ATTR_REQUIREMENTS, expr);
	classad::ExprTree *projTree = static_cast<classad::ExprTree*>(projList);
	ad.Insert(ATTR_PROJECTION, projTree);

	DCSchedd schedd(host);
	Sock* sock;
	if (!(sock = schedd.startCommand(QUERY_JOB_ADS, Stream::reli_sock, connect_timeout, errstack))) return Q_SCHEDD_COMMUNICATION_ERROR;

	classad_shared_ptr<Sock> sock_sentry(sock);

	if (!putClassAd(sock, ad) || !sock->end_of_message()) return Q_SCHEDD_COMMUNICATION_ERROR;
	dprintf(D_FULLDEBUG, "Sent classad to schedd\n");

	do {
		classad_shared_ptr<compat_classad::ClassAd> ad(new ClassAd());
		if (!getClassAd(sock, *ad.get())) return Q_SCHEDD_COMMUNICATION_ERROR;
		if (!sock->end_of_message()) return Q_SCHEDD_COMMUNICATION_ERROR;
		dprintf(D_FULLDEBUG, "Got classad from schedd.\n");
		long long intVal;
		if (ad->EvaluateAttrInt(ATTR_OWNER, intVal) && (intVal == 0))
		{ // Last ad.
			sock->close();
			dprintf(D_FULLDEBUG, "Ad was last one from schedd.\n");
			std::string errorMsg;
			if (ad->EvaluateAttrInt(ATTR_ERROR_CODE, intVal) && intVal && ad->EvaluateAttrString(ATTR_ERROR_STRING, errorMsg))
			{
				if (errstack) errstack->push("TOOL", intVal, errorMsg.c_str());
				return Q_REMOTE_ERROR;
			}
			break;
		}
		(*process_func) (process_func_data, ad);
	} while (true);

	return 0;
}
开发者ID:AmesianX,项目名称:htcondor,代码行数:61,代码来源:condor_q.cpp

示例15: main_

  ExitCodes main_(int, const char**)
  {
    ExitCodes ret = checkParameters_();
    if (ret != EXECUTION_OK) return ret;

    MapAlignmentAlgorithmSpectrumAlignment algorithm;
    Param algo_params = getParam_().copy("algorithm:", true);
    algorithm.setParameters(algo_params);
    algorithm.setLogType(log_type_);

    StringList ins = getStringList_("in");
    StringList outs = getStringList_("out");
    StringList trafos = getStringList_("trafo_out");
    Param model_params = getParam_().copy("model:", true);
    String model_type = model_params.getValue("type");
    model_params = model_params.copy(model_type + ":", true);
    std::vector<TransformationDescription> transformations;

    //-------------------------------------------------------------
    // perform peak alignment
    //-------------------------------------------------------------
    ProgressLogger progresslogger;
    progresslogger.setLogType(log_type_);

    // load input
    std::vector<MSExperiment<> > peak_maps(ins.size());
    MzMLFile f;
    f.setLogType(log_type_);
    progresslogger.startProgress(0, ins.size(), "loading input files");
    for (Size i = 0; i < ins.size(); ++i)
    {
      progresslogger.setProgress(i);
      f.load(ins[i], peak_maps[i]);
    }
    progresslogger.endProgress();

    // try to align
    algorithm.align(peak_maps, transformations);
    if (model_type != "none")
    {
      for (vector<TransformationDescription>::iterator it = 
             transformations.begin(); it != transformations.end(); ++it)
      {
        it->fitModel(model_type, model_params);
      }
    }

    // write output
    progresslogger.startProgress(0, outs.size(), "applying RT transformations and writing output files");
    for (Size i = 0; i < outs.size(); ++i)
    {
      progresslogger.setProgress(i);

      MapAlignmentTransformer::transformRetentionTimes(peak_maps[i], 
                                                       transformations[i]);
      // annotate output with data processing info
      addDataProcessing_(peak_maps[i], 
                         getProcessingInfo_(DataProcessing::ALIGNMENT));

      f.store(outs[i], peak_maps[i]);
    }
    progresslogger.endProgress();

    if (!trafos.empty())
    {
      TransformationXMLFile trafo_file;
      for (Size i = 0; i < transformations.size(); ++i)
      {
        trafo_file.store(trafos[i], transformations[i]);
      }
    }

    return EXECUTION_OK;
  }
开发者ID:chahuistle,项目名称:OpenMS,代码行数:74,代码来源:MapAlignerSpectrum.cpp


注:本文中的StringList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。