예제 #1
0
void CountryInfoGetter::ForEachCountry(string const & prefix, ToDo && toDo) const
{
  for (auto const & country : m_countries)
  {
    if (strings::StartsWith(country.m_name, prefix.c_str()))
      toDo(country);
  }
}
예제 #2
0
 template <class ToDo> static void ForEachOffset(ModelReaderPtr reader, ToDo && toDo)
 {
   VarRecordReader<ModelReaderPtr, &VarRecordSizeReaderVarint> recordReader(reader, 256);
   recordReader.ForEachRecord([&] (uint32_t pos, char const * /*data*/, uint32_t /*size*/)
   {
     toDo(pos);
   });
 }
예제 #3
0
  template <class ToDo> void ForEach(ToDo && toDo) const
  {
    uint32_t index = 0;
    m_recordReader.ForEachRecord([&](uint32_t pos, char const * data, uint32_t /*size*/) {
      FeatureType ft(&m_loadInfo, data);

      // We can't properly set MwmId here, because FeaturesVector
      // works with FileContainerR, not with MwmId/MwmHandle/MwmValue.
      // But it's OK to set at least feature's index, because it can
      // be used later for Metadata loading.
      ft.SetID(FeatureID(MwmSet::MwmId(), index));
      toDo(ft, m_table ? index++ : pos);
    });
  }
예제 #4
0
void applyToList(GenericList *lst, void (* toDo) (void *))
{

	if(lst==NULL) 
	{
		printf("Error: tried to call applyToAll on null list");
		return;
	}
	if(toDo==NULL)
	{
		printf("Error: tried to call applyToAll with null function pointer passed");
		return;
	}

	ListNode* index=lst->head;
	while(index!=NULL)
	{
		//toDo function must be indempotent and not change the values, for example print
		toDo(index->data);
		index=index->next;
	}

}