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


C++ StrList类代码示例

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


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

示例1: vecContains

bool FileSystemManager::removeObject(Watchable *listener)
{
	int indx = vecContains(listenerList, listener);

	if (indx != -1)
	{
		StrList watchDirs = listener->getWatchDir();

		// Remove it from the directory watcher
		for (uint i = 0; i < watchDirs.size(); i++)
			dirWatcher.UnwatchDirectory((LPCTSTR) watchDirs[i].utf16());

		// Kill off any events that belong to this directory
		for (int i = 0; i < eventList.size(); i++)
		{
			if (eventList[i].obj == listener)
			{
				eventList.erase(eventList.begin() + i);
				i--;
			}
		}

		// Remove the watchable item from our own list
		listenerList.erase(listenerList.begin() + indx);
		return true;
	}

	return false;
}
开发者ID:DX94,项目名称:BumpTop,代码行数:29,代码来源:BT_FileSystemManager.cpp

示例2: error

void V3PreProcImp::openFile(FileLine* fl, V3InFilter* filterp, const string& filename) {
    // Open a new file, possibly overriding the current one which is active.
    V3File::addSrcDepend(filename);

    // Read a list<string> with the whole file.
    StrList wholefile;
    bool ok = filterp->readWholefile(filename, wholefile/*ref*/);
    if (!ok) {
	error("File not found: "+filename+"\n");
	return;
    }

    if (!m_preprocp->isEof()) {  // IE not the first file.
	// We allow the same include file twice, because occasionally it pops
	// up, with guards preventing a real recursion.
	if (m_lexp->m_streampStack.size()>V3PreProc::INCLUDE_DEPTH_MAX) {
	    error("Recursive inclusion of file: "+filename);
	    return;
	}
	// There's already a file active.  Push it to work on the new one.
	addLineComment(0);
    }

    // Create new stream structure
    m_lexp->scanNewFile(m_preprocp->fileline()->create(filename, 1));
    addLineComment(1); // Enter

    // Filter all DOS CR's en-mass.  This avoids bugs with lexing CRs in the wrong places.
    // This will also strip them from strings, but strings aren't supposed to be multi-line without a "\"
    for (StrList::iterator it=wholefile.begin(); it!=wholefile.end(); ++it) {
	// We don't end-loop at \0 as we allow and strip mid-string '\0's (for now).
	bool strip = false;
	const char* sp = it->data();
	const char* ep = sp + it->length();
	// Only process if needed, as saves extra string allocations
	for (const char* cp=sp; cp<ep; cp++) {
	    if (VL_UNLIKELY(*cp == '\r' || *cp == '\0')) {
		strip = true; break;
	    }
	}
	if (strip) {
	    string out;  out.reserve(it->length());
	    for (const char* cp=sp; cp<ep; cp++) {
		if (!(*cp == '\r' || *cp == '\0')) {
		    out += *cp;
		}
	    }
	    *it = out;
	}

	// Push the data to an internal buffer.
	m_lexp->scanBytesBack(*it);
	// Reclaim memory; the push saved the string contents for us
	*it = "";
    }
}
开发者ID:toddstrader,项目名称:verilator-integer-array,代码行数:56,代码来源:V3PreProc.cpp

示例3: getProcStatus

string PredefinedInspector::getProcStatus(const PropertyList& argList,
    string& contentType)
{
    contentType = "text/plain";

    StrList strList;
    if (strList.loadFromFile("/proc/self/status"))
        return strList.getText();
    else
        return "";
}
开发者ID:Elvins,项目名称:ise,代码行数:11,代码来源:ise_inspector.cpp

示例4: getBasicInfo

string PredefinedInspector::getBasicInfo(const PropertyList& argList,
    string& contentType)
{
    contentType = "text/plain";

    StrList strList;
    strList.add(formatString("path: %s", getAppExeName().c_str()));
    strList.add(formatString("pid: %d", ::getpid()));

    return strList.getText();
}
开发者ID:Elvins,项目名称:ise,代码行数:11,代码来源:ise_inspector.cpp

示例5: GetRedisCacheClient

void TripodClient::GetList(const std::string& key, StrList& value, int begin, int limit) {
  RedisCacheClientPtr client = GetRedisCacheClient();
  if (!client) {
    MCE_INFO("TripodClient::GetList() RedisCacheClient is NULL");
    return;
  }
  const StrList& list = client->GetList(key, begin, limit, namespaceId_, businessId_);
  if (!list.empty()) {
    value.insert(value.end(), list.begin(), list.end());
  }
}
开发者ID:bradenwu,项目名称:oce,代码行数:11,代码来源:TripodClient.cpp

示例6: onPowerSuspend

void FileSystemManager::onPowerSuspend()
{
	// unwatch all the directories
	for (int i = 0; i < listenerList.size(); ++i)
	{
		Watchable * w = listenerList[i];

		StrList watchDirs = w->getWatchDir();
		for (int j = 0; j < watchDirs.size(); j++)
			dirWatcher.UnwatchDirectory((LPCTSTR) watchDirs[j].utf16());
	}
}
开发者ID:DX94,项目名称:BumpTop,代码行数:12,代码来源:BT_FileSystemManager.cpp

示例7: UpdateTagsFile

int UpdateTagsFile(const char* file)
{
  TagFileInfo *fi=NULL;
  int i;
  String filename=file;
  filename.ToLower();
  for(i=0;i<files.Count();i++)
  {
    if(files[i]->filename==filename)
    {
      fi=files[i];
      break;
    }
  }
  if(!fi)
  {
    struct stat st;
    if(stat(filename,&st)==-1)return 0;
    TagFileInfo tfi;
    tfi.filename=filename;
    tfi.modtm=st.st_mtime;
    if(!FindIdx(&tfi))return 0;
    if(Load(filename,"")!=1)return 0;
  }
  StrList sl;
  if(!CheckChangedFiles(filename,sl))return 0;
  if(sl.Count()==0)return 1;
  sl.SaveToFile("tags.changes");
  String cmd=config.exe+" ";
  String opt=config.opt;
  opt.Replace("-R","");
  RegExp re("/\\*(\\.\\S*)?/");
  SMatch m[4];
  int n=4;
  while(re.Search(opt,m,n))
  {
    opt.Delete(m[0].start,m[0].end-m[0].start);
  }
  cmd+=opt;
  cmd+=" -f tags.update -L tags.changes";
  //extern int Msg(const char* err);
  //Msg(cmd);
  if(!Execute(cmd))
  {
    remove("tags.changes");
    return 0;
  }
  MergeFiles(file,"tags.update");
  remove("tags.changes");
  remove("tags.update");
  Load(file,"");
  return 1;
}
开发者ID:Maximus5,项目名称:evil-programmers,代码行数:53,代码来源:tags.cpp

示例8: updateDirectory

void LocalPhotoFrameSource::updateDirectory(QDir dir, vector<PhotoFrameSourceItem>& items)
{
	// assume dir exists
	if (!empty(dir))
	{
		StrList dirListing = fsManager->getDirectoryContents(native(dir));
		for (int i = 0; i < dirListing.size(); ++i)
		{
			QFileInfo file(dirListing[i]);

			if (file.isSymLink()) {
				file = QFile(file.symLinkTarget());
			}

			if (file.isDir())
				// recurse into that directory
				updateDirectory(file.absoluteFilePath(), items);
			else
			{
				// XXX: we can do this smarter with watched directories?!

				// check if this is a valid image file
				QString filename = file.fileName();
				if (filename.size() > 4)
				{
					QString ext = fsManager->getFileExtension(filename);
					bool isValidImage = !ext.isEmpty() && GLOBAL(supportedExtensions).contains(ext + ".");
					if (isValidImage)
					{
						// check if we already have that item in the list
						vector<PhotoFrameSourceItem>::const_iterator itemIter = items.begin();
						vector<PhotoFrameSourceItem>::const_iterator endIter = items.end();
						bool exists = false;
						while (itemIter != endIter)
						{
							if ((*itemIter).getResourceId() == dirListing[i])
								exists = true;
							++itemIter;
						}

						// if not, add it to the list
						if (!exists)
						{
							PhotoFrameSourceItem item(dirListing[i]);
							item.setTexturePath(dirListing[i]);
							items.push_back(item);
						}
					}
				}
			}
		}
	}
}
开发者ID:DX94,项目名称:BumpTop,代码行数:53,代码来源:BT_LocalPhotoFrameSource.cpp

示例9: onPowerResume

void FileSystemManager::onPowerResume()
{
	// re-watch all the directories
	for (int i = 0; i < listenerList.size(); ++i)
	{
		Watchable * w = listenerList[i];

		uint changeFilter = FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_DIR_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_ATTRIBUTES;
		StrList watchDirs = w->getWatchDir();
		for (int j = 0; j < watchDirs.size(); j++)
			dirWatcher.WatchDirectory((LPCTSTR) watchDirs[j].utf16(), changeFilter, this);
	}
}
开发者ID:DX94,项目名称:BumpTop,代码行数:13,代码来源:BT_FileSystemManager.cpp

示例10: desiresCB

void EventsGenerator::desiresCB(const hbba_msgs::DesiresSet::ConstPtr& msg)
{
	typedef std::vector<std::string> StrVec;
	typedef std::list<std::string> StrList;
	typedef std::vector<hbba_msgs::Desire> DesVec;
	typedef std::map<std::string,std::string> TypeMap;
	const DesVec& desires = msg->desires;
	TypeMap typeMap;
	StrVec ids;
	ids.reserve(desires.size());
	for (DesVec::const_iterator d = desires.begin(); d != desires.end(); ++d)
	{
		ids.push_back(d->id);
		typeMap[d->id] = d->type;
	}

    // First, remove desires not in it the current desires set.
    StrList del;
    for (Model::const_iterator i = model_.begin(); i != model_.end(); ++i)
    {
        const std::string& id = i->first;
        if (std::find(ids.begin(), ids.end(), id) == ids.end())
            del.push_back(id);
    }
    for (StrList::const_iterator i = del.begin(); i != del.end(); ++i)
    {
        const std::string& id = *i;
	
        event(id, model_[id].type, hbba_msgs::Event::DES_OFF);
        if (model_[id].flags & FLAG_INT)
            event(id, model_[id].type, hbba_msgs::Event::INT_OFF);
        if (model_[id].flags & FLAG_EXP)
            event(id, model_[id].type, hbba_msgs::Event::EXP_OFF);

        model_.erase(id);
    }

	// Then, generate events for new desires.
	for (StrVec::const_iterator i = ids.begin(); i != ids.end(); ++i)
	{
		const std::string& id = *i;
		if (model_.find(id) == model_.end())
		{
			model_[id].flags = FLAG_NONE;
			model_[id].type = typeMap[id]; //set type in the model
			event(id, model_[id].type, hbba_msgs::Event::DES_ON);
		}
	}

}
开发者ID:francoisferland,项目名称:hbba_base,代码行数:50,代码来源:events_generator.cpp

示例11: splitString

// Example: /category/command?arg1=value&arg2=value
bool IseServerInspector::parseCommandUrl(const HttpRequest& request,
    string& category, string& command, PropertyList& argList)
{
    bool result = false;
    string url = request.getUrl();
    string argStr;
    StrList strList;

    if (!url.empty() && url[0] == '/')
        url.erase(0, 1);

    // find the splitter char ('?')
    string::size_type argPos = url.find('?');
    bool hasArgs = (argPos != string::npos);
    if (hasArgs)
    {
        argStr = url.substr(argPos + 1);
        url.erase(argPos);
    }

    // parse the string before the '?'
    splitString(url, '/', strList, true);
    if (strList.getCount() >= 2)
    {
        category = strList[0];
        command = strList[1];
        result = true;
    }

    // parse the args
    if (result)
    {
        argList.clear();
        splitString(argStr, '&', strList, true);
        for (int i = 0; i < strList.getCount(); ++i)
        {
            StrList parts;
            splitString(strList[i], '=', parts, true);
            if (parts.getCount() == 2 && !parts[0].empty())
            {
                argList.add(parts[0], parts[1]);
            }
        }
    }

    return result;
}
开发者ID:Elvins,项目名称:ise,代码行数:48,代码来源:ise_inspector.cpp

示例12: VarList

Variable::Variable( const StrList &lst )
{
    if( lst.getSize() == 1 )
    {
        eType = typeString;
        uVal.sVal = new Bu::String( lst.first() );
    }
    else
    {
        eType = typeList;
        uVal.lVal = new VarList();
        for( StrList::const_iterator i = lst.begin(); i; i++ )
        {
            uVal.lVal->append( Variable( *i ) );
        }
    }
}
开发者ID:IngwiePhoenix,项目名称:IceTea_old,代码行数:17,代码来源:variable.cpp

示例13: FindParts

void FindParts(const char* file, const char* part,StrList& dst)
{
  String filename=file;
  filename.ToLower();
  dst.Clean();
  StrList tmp;
  int i;
  for(i=0;i<files.Count();i++)
  {
    if(files[i]->mainaload ||
       files[i]->isLoadBase(filename))
    {
      FindPartsInFile(files[i],part,tmp);
    }
  }
  if(tmp.Count()==0)return;
  tmp.Sort(dst);
  i=1;
  String *s=&dst[0];
  while(i<dst.Count())
  {
    if(dst[i]==*s)
    {
      dst.Delete();
    }else
    {
      s=&dst[i];
      i++;
      if(i==dst.Count())break;
    }
  }
}
开发者ID:Maximus5,项目名称:evil-programmers,代码行数:32,代码来源:tags.cpp

示例14: getFields

//-----------------------------------------------------------------------------
// 描述: 取得当前记录中某个字段的数据
// 参数:
//   name - 字段名
//-----------------------------------------------------------------------------
DbField* DbDataSet::getFields(const string& name)
{
    int index = dbFieldDefList_.indexOfName(name);

    if (index >= 0)
        return getFields(index);
    else
    {
        StrList fieldNames;
        dbFieldDefList_.getFieldNameList(fieldNames);
        string fieldNameList = fieldNames.getCommaText();

        string errMsg = formatString(SEM_FIELD_NAME_ERROR, name.c_str(), fieldNameList.c_str());
        iseThrowDbException(errMsg.c_str());
    }

    return NULL;
}
开发者ID:Elvins,项目名称:ise,代码行数:23,代码来源:ise_database.cpp

示例15: split_str_to_items

void ProductRankerTestFixture::convertMerchantId_(
    const std::string& merchantList,
    PropValueIdList& idList)
{
    typedef std::vector<std::string> StrList;
    StrList strList;
    split_str_to_items(merchantList, strList);

    for (StrList::const_iterator it = strList.begin(); it != strList.end(); ++it)
    {
        merchant_id_t merchantId = 0;
        std::vector<izenelib::util::UString> path;
        path.push_back(izenelib::util::UString(*it, ENCODING_TYPE));

        merchantId = merchantValueTable_.insertPropValueId(path);
        idList.push_back(merchantId);
    }
}
开发者ID:Hadoyy,项目名称:sf1r-lite,代码行数:18,代码来源:ProductRankerTestFixture.cpp


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