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


C++ STRING_LIST类代码示例

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


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

示例1: MakeCustomSummary

bool CMOOSRemoteLite::MakeCustomSummary()
{

    STRING_LIST sParams;
    if(m_MissionReader.GetConfiguration(GetAppName(),sParams))
    {
        STRING_LIST::iterator p;

        for(p = sParams.begin();p!=sParams.end();p++)
        {
            string sLine = *p;
            string sTok,sVal;
            m_MissionReader.GetTokenValPair(sLine,sTok,sVal);

            if(MOOSStrCmp(sTok,"CUSTOMSUMMARY"))
            {
                m_CustomSummaryList.push_front(sVal);

                AddMOOSVariable(sVal,sVal,"",0.2);
            }
        }
    }

    RegisterMOOSVariables();

    return true;
}
开发者ID:HSOFEUP,项目名称:MOOS-IvP-releases,代码行数:27,代码来源:MOOSRemoteLite.cpp

示例2: getChildsAttribute

Triggerconf::STRING_LIST Triggerconf::getChildsAttribute (DOMNode* root, string nodename, string attribute)
{
	STRING_LIST ret;
	
	if (root == NULL) {
		setError ("invalid root node");	
		return ret;
	}

	DOMNodeList* childs = root->getChildNodes ();
	if (childs == NULL) return ret;

	for (unsigned int i=0; i<childs->getLength (); i++) {
		
		DOMNode* child = childs->item (i);
		if (child == NULL || child->getNodeType () != DOMNode::ELEMENT_NODE) continue;

		const XMLCh* xnodename = child->getNodeName ();
		char* charname = XMLString::transcode (xnodename);
		
		if (nodename.compare (charname) == 0)
			ret.push_back (getAttributeValue (child, attribute));

		XMLString::release (&charname);

	} // for (unsigned int i=0; i<childs->getLength (); i++) 

	return ret;
}
开发者ID:freshbob,项目名称:worms-attack,代码行数:29,代码来源:triggerconf.cpp

示例3: tokenize

Triggerconf::STRING_LIST Triggerconf::tokenize (string path)
{
	STRING_LIST ret;
	
	int first = 0;
	int last = 0; 

	while (true) {

		last = (int) path.find (PATH_DELIMITER, first);
		
		if (last == (int)string::npos) {
			if (path.length () - first >= 1)
				ret.push_back (path.substr (first, path.length () - first));			
			break;
		}
		
		if (last-first >= 1)
			ret.push_back (path.substr (first, last-first));

		first = last + 1;
	}

	return ret;
}
开发者ID:freshbob,项目名称:worms-attack,代码行数:25,代码来源:triggerconf.cpp

示例4: OnPreIterate

bool CHelmApp::OnPreIterate()
{
    TASK_LIST::iterator p;

    STRING_LIST NewResources;
    STRING_LIST::iterator q;

    for(p = m_Tasks.begin();p!=m_Tasks.end();p++)
    {
        CMOOSBehaviour* pBehaviour = *p;

        if(pBehaviour->HasNewRegistration())
        {
            NewResources.clear();

            pBehaviour->GetRegistrations(NewResources);

            for(q = NewResources.begin();q!=NewResources.end();q++)
            {
                if(m_Comms.IsConnected())
                {
                    m_Comms.Register(*q,UPDATE_INTERVAL);
                }
            }
        }
    }

    return true;
}
开发者ID:alod83,项目名称:IS-MOOS,代码行数:29,代码来源:HelmApp.cpp

示例5: GetConfigurationAndPreserveSpace

bool CProcessConfigReader::GetConfigurationAndPreserveSpace(std::string sAppName, STRING_LIST &Params)
{
    Params.clear();

    int nBrackets = 0;
    Params.clear();

    Reset();

    std::string sKey = "PROCESSCONFIG="+sAppName;

    if(GoTo(sKey))
    {
        std::string sBracket = GetNextValidLine();
        if(sBracket.find("{")==0)
        {
            nBrackets++;
            while(!GetFile()->eof())
            {
                std::string sLine = GetNextValidLine();
                MOOSTrimWhiteSpace(sLine);

                if(sLine.find("}")!=0)
                {
                    std::string sVal(sLine);
                    std::string sTok = MOOSChomp(sVal, "=");
                    MOOSTrimWhiteSpace(sTok);
                    MOOSTrimWhiteSpace(sVal);

                    if (!sTok.empty())
                    {

                        if (!sVal.empty())
                        {
                            Params.push_back(sTok+"="+sVal);
                        }
                        else if(sLine.find("[")!=std::string::npos || sLine.find("]")!=std::string::npos)
                        {
                            Params.push_back(sLine);
                        }
                    }
                }
                else
                {
                    return true;
                }

                //quick error check - we don't allow nested { on single lines
                if(sLine.find("{")==0)
                {
                    MOOSTrace("CProcessConfigReader::GetConfiguration() missing \"}\" syntax error in mission file\n");
                }
            }
        }
    }


    return false;

}
开发者ID:nicolaje,项目名称:core-moos,代码行数:60,代码来源:ProcessConfigReader.cpp

示例6: Reset

///                               READ STRINGS
bool CProcessConfigReader::GetConfigurationParam(std::string sAppName,std::string sParam, std::string &sVal)
{
    Reset();

    //remember all names we were asked for....
    std::string sl = sParam;
    MOOSToLower(sl);
    m_Audit[sAppName].insert(sl);

    STRING_LIST sParams;

    if(GetConfigurationAndPreserveSpace( sAppName, sParams))
    {
        STRING_LIST::iterator p;
        for(p = sParams.begin(); p!=sParams.end(); p++)
        {
            std::string sTmp = *p;
            std::string sTok = MOOSChomp(sTmp,"=");
            MOOSTrimWhiteSpace(sTok);

            if (sTmp.empty())
                return false;

            if(MOOSStrCmp(sTok,sParam))
            {
                MOOSTrimWhiteSpace(sTmp);

                sVal=sTmp;
                return true;
            }
        }
    }
    return false;
}
开发者ID:nicolaje,项目名称:core-moos,代码行数:35,代码来源:ProcessConfigReader.cpp

示例7: OnProcessSummaryRequested

bool CMOOSDB::OnProcessSummaryRequested(CMOOSMsg &Msg, MOOSMSG_LIST &MsgTxList)
{
    DBVAR_MAP::iterator p;
    STRING_LIST::iterator q;
    STRING_LIST Clients;
    
    m_pCommServer->GetClientNames(Clients);

    for(q=Clients.begin();q!=Clients.end();q++)
    {
        string sWho = *q;
        
        string sPublished= "PUBLISHED=";
        string sSubscribed = "SUBSCRIBED=";
        
        for(p=m_VarMap.begin();p!=m_VarMap.end();p++)
        {
            CMOOSDBVar  & rVar = p->second;
            
            if(rVar.m_Writers.find(sWho)!=rVar.m_Writers.end())
            {
                if(!sPublished.empty())
                {
                    sPublished+=",";
                }
                sPublished+=rVar.m_sName;
                
            }
            
            if(rVar.m_Subscribers.find(sWho)!=rVar.m_Subscribers.end())
            {
                if(!sSubscribed.empty())
                {
                    sSubscribed+=",";
                }
                sSubscribed+=rVar.m_sName;
            }
        }
        
        
        CMOOSMsg MsgReply;
        
        MsgReply.m_nID        = Msg.m_nID;
        
        MsgReply.m_cMsgType   = MOOS_NOTIFY;
        MsgReply.m_cDataType  = MOOS_STRING;
        MsgReply.m_dfTime     = MOOSTime()-m_dfStartTime; //for display
        MsgReply.m_sSrc       = m_sDBName;
        MsgReply.m_sKey       = "PROC_SUMMARY";
        MsgReply.m_sVal       = sWho+":"+sSubscribed+","+sPublished;
        MsgReply.m_dfVal      = -1;
        
        
        MsgTxList.push_front(MsgReply);
    }
    
    return true;
    
}
开发者ID:HSOFEUP,项目名称:MOOS-IvP-releases,代码行数:59,代码来源:MOOSDB.cpp

示例8: GetRegistrations

bool COrbitTask::GetRegistrations(STRING_LIST &List)
{
    List.push_front("NAV_X");
    List.push_front("NAV_Y");
    List.push_front("NAV_YAW");

    //always call base class version
    CMOOSBehaviour::GetRegistrations(List);

    return true;
}
开发者ID:alod83,项目名称:IS-MOOS,代码行数:11,代码来源:OrbitTask.cpp

示例9: strlen

//-----------------------------------------------------------------------------
// Purpose: Parse the VSS history command and generate a list of files & versions
// Input  : *pFileName - 
// Output : STRING_LIST
//-----------------------------------------------------------------------------
STRING_LIST &ParseHistory( const char *pProjectName, const char *pFileName )
{
	int nameLen = strlen( pProjectName );
	STRING_LIST *list = new STRING_LIST;

	FILE *fp = fopen( pFileName, "r" );
	if ( fp )
	{
		char buf[1024];
		string currentFile;
		string project;
		int currentVersion;

		while ( !feof(fp) )
		{
			fgets( buf, 1024, fp );
			if ( !strncmp( buf, "*****", 5 ) )
			{
				char *pStr = buf + 7;
				strtok( pStr, " \n" );
				currentFile = pStr;
			}
			else if ( !strncmp( buf, "Version", 7 ) )
			{
				currentVersion = atoi( buf + 8 );
			}
			else if ( !strncmp( buf, "Checked in", 10 ) )
			{
				char *pStr = buf + 11;
				strtok( pStr, " \n" );

				if ( strncmp( pProjectName, pStr, nameLen ) )
				{
					project = pProjectName;
					pStr = StringSkipTo( pStr, '/' ); // skip $/
					pStr = StringSkipTo( pStr, '/' );	// skip xxx/
					project += "/";
					project += pStr;
				}
				else
				{
					project = pStr;
				}

				project += "/";
				project += currentFile;
				historyList tmp( project, currentVersion );
				list->push_back( tmp );
			}
		}
		fclose( fp );
	}
	return *list;
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:59,代码来源:sscode.cpp

示例10: SetUpSensorChannels

bool CMOOSNavEngine::SetUpSensorChannels(STRING_LIST  sParams,string sToken)
{

       
    //ok we need to load up rejection settings
    STRING_LIST::iterator p;
    
    for(p = sParams.begin();p!=sParams.end();p++)
    {
        string sLine = *p;
        if(sLine.find(sToken)!=string::npos)
        {
            MOOSRemoveChars(sLine," \t");
            MOOSChomp(sLine,"=");
            //LSQ_REJECTION = TheAvtrak : Reject = 3, History = 5,Fail = 0.001           
            CMOOSSensorChannel NewChannel;
            
            string sSensor =    MOOSChomp(sLine,":");
            string sHistory =    MOOSChomp(sLine,",");
            string sFail =        MOOSChomp(sLine,",");

            MOOSChomp(sHistory,"=");
            MOOSChomp(sFail,"=");

            
            if(sFail.empty() ||sHistory.empty())
            {
                MOOSTrace("error in %s line!\n",sToken.c_str());
                return false;
            }
            
            int nDepth = atoi(sHistory.c_str());
            if(nDepth>0)
            {
                NewChannel.SetHistoryDepth(nDepth);
            }
            

               double dfFail = atof(sFail.c_str());
            if(dfFail>0)
            {
                NewChannel.SetNoiseLimit(dfFail);
            }

            NewChannel.SetName(sSensor);

            m_SensorChannelMap[sSensor]=NewChannel;
            
        }       
    }

    return true;
}
开发者ID:alod83,项目名称:IS-MOOS,代码行数:53,代码来源:MOOSNavEngine.cpp

示例11: MakeCustomKeys

bool CMOOSRemoteLite::MakeCustomKeys()
{
    STRING_LIST sParams;

    if(m_MissionReader.GetConfiguration(GetAppName(),sParams))
    {
        STRING_LIST::iterator p;

        for(p = sParams.begin();p!=sParams.end();p++)
        {
            string sLine = *p;
            string sTok,sVal;
            m_MissionReader.GetTokenValPair(sLine,sTok,sVal);



            if(MOOSStrCmp(sTok,"CUSTOMKEY"))
            {

                MOOSRemoveChars(sVal," ");
                string sChar = MOOSChomp(sVal,":");
                string sKey = MOOSChomp(sVal,"@");
                MOOSRemoveChars(sVal,"\"");
                string sTx = MOOSChomp(sVal,"$");

                bool  bIsNumeric = MOOSIsNumeric(sTx);						
				bool bAskToConfirm = (sVal == "confirm");

                if(!sChar.empty())
                {

                    CCustomKey NewKey;
                    NewKey.m_cChar = sChar[0];
                    NewKey.m_sKey = sKey;
                    NewKey.m_sVal = sTx;
                    NewKey.bIsNumeric = bIsNumeric;
                    NewKey.bAskToConfirm = bAskToConfirm;

                    if(isdigit(NewKey.m_cChar))
                    {
                        m_CustomKeys[NewKey.m_cChar] = NewKey;
                    }
                    else
                    {
                        MOOSTrace("CMOOSRemote: can only bind custom keys to numeric characters!\n");
                    }
                }

            }
        }
    }
    return true;
}
开发者ID:HSOFEUP,项目名称:MOOS-IvP-releases,代码行数:53,代码来源:MOOSRemoteLite.cpp

示例12: reportConfigWarning

bool DeadManPost::OnStartUp()
{
  AppCastingMOOSApp::OnStartUp();

  STRING_LIST sParams;
  m_MissionReader.EnableVerbatimQuoting(false);
  if(!m_MissionReader.GetConfiguration(GetAppName(), sParams))
    reportConfigWarning("No config block found for " + GetAppName());

  STRING_LIST::iterator p;
  for(p=sParams.begin(); p!=sParams.end(); p++) {
    string orig  = *p;
    string line  = *p;
    string param = tolower(biteStringX(line, '='));
    string value = line;

    bool handled = false;
    if(param == "heartbeat_var") {
      if(!strContainsWhite(value)) {
	m_heart_var = value;
	handled = true;
      }
    }
    else if(param == "deadflag") {
      string varname = biteStringX(value, '=');
      string varval  = value;
      if(!strContainsWhite(varname) && (varval != "")) {
	VarDataPair pair(varname, varval, "auto");
	m_deadflags.push_back(pair);
	handled = true;
      }
    }
    else if(param == "post_policy") {
      string val = tolower(value);
      if((val=="once") || (val=="repeat") || (val=="reset")) {
	m_post_policy = val;
	handled = true;
      }
    }
    else if((param == "max_noheart") && isNumber(value)) {
      m_max_noheart = atof(value.c_str());
      handled = true;
    }
    else if(param == "active_at_start") 
      handled = setBooleanOnString(m_active_at_start, value);

    if(!handled)
      reportUnhandledConfigWarning(orig);
  }
  
  registerVariables();	
  return(true);
}
开发者ID:HSOFEUP,项目名称:MOOS-IvP-releases,代码行数:53,代码来源:DeadManPost.cpp

示例13: GetRegistrations

bool CLimitBox::GetRegistrations(STRING_LIST &List)
{
    List.push_front("NAV_DEPTH");
    List.push_front("NAV_X");
    List.push_front("NAV_Y");


    //always call base class version
    CMOOSBehaviour::GetRegistrations(List);

    return true;
}
开发者ID:alod83,项目名称:IS-MOOS,代码行数:12,代码来源:LimitBox.cpp

示例14: reportConfigWarning

bool SonarFilter::OnStartUp()
{
  AppCastingMOOSApp::OnStartUp();

  STRING_LIST sParams;
  m_MissionReader.EnableVerbatimQuoting(false);
  if(!m_MissionReader.GetConfiguration(GetAppName(), sParams))
    reportConfigWarning("No config block found for " + GetAppName());

  STRING_LIST::iterator p;
  for(p=sParams.begin(); p!=sParams.end(); p++) {
    string orig  = *p;
    string line  = *p;
    string param = toupper(biteStringX(line, '='));
    string value = line;

    bool handled = false;
    if(param == "FILTERLEN") {
      m_filter_len = atoi(value.c_str());
      handled = true;
    }
    else if(param == "STDEVLIMIT") {
      m_std_limit = atof(value.c_str());
      handled = true;
    } else if (param == "SIMSWATHANGLE") {
      // Convert the angle to radians
      m_sim_swath_angle = atof(value.c_str()) * M_PI / 180;
      handled = true;
    } else if (param == "SONARTYPE") {

    }

    if(!handled)
      reportUnhandledConfigWarning(orig);

  }

  AddMOOSVariable("X", "NAV_X", "", 0);
  AddMOOSVariable("Y", "NAV_Y", "", 0);
  AddMOOSVariable("Heading", "NAV_HEADING", "", 0);
  AddMOOSVariable("Depth", "SONAR_DEPTH_M", "", 0);
  AddMOOSVariable("Depth_Stbd", "SONAR_DEPTH_STBD_M", "", 0);
  AddMOOSVariable("Depth_Port", "SONAR_DEPTH_PORT_M", "", 0);
  AddMOOSVariable("SonarWidth", "SONAR_WIDTH", "", 0);
  AddMOOSVariable("Swath", "", "SWATH_WIDTH", 0);

  m_nadir_filter = StDevFilter(m_filter_len, m_std_limit, 1/GetAppFreq());
  m_port_filter = StDevFilter(m_filter_len, m_std_limit, 1/GetAppFreq());
  m_stbd_filter = StDevFilter(m_filter_len, m_std_limit, 1/GetAppFreq());

  registerVariables();
  return(true);
}
开发者ID:CCOMJHC,项目名称:moos-ivp-manda,代码行数:53,代码来源:SonarFilter.cpp

示例15: reportConfigWarning

bool HazardMgr::OnStartUp()
{
  AppCastingMOOSApp::OnStartUp();

  STRING_LIST sParams;
  m_MissionReader.EnableVerbatimQuoting(true);
  if(!m_MissionReader.GetConfiguration(GetAppName(), sParams))
    reportConfigWarning("No config block found for " + GetAppName());

  STRING_LIST::iterator p;
  for(p=sParams.begin(); p!=sParams.end(); p++) {
    string orig  = *p;
    string line  = *p;
    string param = tolower(biteStringX(line, '='));
    string value = line;

    bool handled = false;
    if((param == "swath_width") && isNumber(value)) {
      m_swath_width_desired = atof(value.c_str());
      handled = true;
    }
    else if(((param == "sensor_pd") || (param == "pd")) && isNumber(value)) {
      m_pd_desired = atof(value.c_str());
      handled = true;
    }
    else if(param == "report_name") {
      value = stripQuotes(value);
      m_report_name = value;
      handled = true;
    }
    else if(param == "region") {
      XYPolygon poly = string2Poly(value);
      if(poly.is_convex())
	m_search_region = poly;
      handled = true;
    }

    if(!handled)
      reportUnhandledConfigWarning(orig);
  }

  m_hazard_set.setSource(m_host_community);
  m_hazard_set.setName(m_report_name);
  m_hazard_set.setRegion(m_search_region);

  m_voted_hazard_set.setSource(m_host_community);
  m_voted_hazard_set.setName(m_report_name);
  m_voted_hazard_set.setRegion(m_search_region);

  registerVariables();
  return(true);
}
开发者ID:nicrip,项目名称:moos-ivp-rypkema,代码行数:52,代码来源:HazardMgr.cpp


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