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


C++ PathList::begin方法代码示例

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


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

示例1: SetAutoLoadPaths

void ModuleSettings::SetAutoLoadPaths(const PathList& paths)
{
  PathList normalizedPaths;
  normalizedPaths.resize(paths.size());
  std::transform(paths.begin(), paths.end(), normalizedPaths.begin(), RemoveTrailingPathSeparator);

  US_UNUSED(ModuleSettingsPrivate::Lock(moduleSettingsPrivate()));
  moduleSettingsPrivate()->autoLoadPaths.clear();
  moduleSettingsPrivate()->autoLoadPaths.insert(normalizedPaths.begin(), normalizedPaths.end());
}
开发者ID:Cdebus,项目名称:MITK,代码行数:10,代码来源:usModuleSettings.cpp

示例2: fillBinaryPackagesList

void Path::fillBinaryPackagesList(std::vector<std::string>& pkglist)
{
    std::string header = "Packages from: ";
    header += path().getBinaryPackagesDir();
    pkglist.clear();
    pkglist.push_back(header);
    PathList pkgs = path().getBinaryPackages();
    std::sort(pkgs.begin(), pkgs.end());
    PathList::const_iterator itb = pkgs.begin();
    PathList::const_iterator ite = pkgs.end();
    for (; itb!=ite; itb++){
        pkglist.push_back(*itb);
    }
    return;
}
开发者ID:GG31,项目名称:vle,代码行数:15,代码来源:Path.cpp

示例3: findResourceDirs

PathList findResourceDirs(const fs::path& executable) {
	fs::path mapcrafter_dir = findExecutableMapcrafterDir(executable);
	PathList resources = {
		mapcrafter_dir.parent_path() / "share" / "mapcrafter",
		mapcrafter_dir / "data",
	};
	fs::path home = findHomeDir();
	if (!home.empty())
		resources.insert(resources.begin(), home / ".mapcrafter");

	for (PathList::iterator it = resources.begin(); it != resources.end(); ) {
		if (!fs::is_directory(*it))
			resources.erase(it);
		else
			++it;
	}
	return resources;
}
开发者ID:Fuitad,项目名称:mapcrafter,代码行数:18,代码来源:filesystem.cpp

示例4: removeGridPath

void DataManager::removeGridPath(int x, int y, PathVect* path) {
	PathList* objects = &GET_GRID_ITEM(grid,x,y).paths;
	for (PathList::iterator it = objects->begin(); it != objects->end(); it++) {
		if ((*it).second == path) {
			objects->erase(it);
			break;
		}
	}
}
开发者ID:cheesecakenl,项目名称:git-c-plusplus,代码行数:9,代码来源:DataManager.cpp

示例5: findLoggingConfigFiles

PathList findLoggingConfigFiles(const fs::path& executable) {
	fs::path mapcrafter_dir = findExecutableMapcrafterDir(findExecutablePath());
	PathList configs = {
		mapcrafter_dir.parent_path().parent_path() / "etc" / "mapcrafter" / "logging.conf",
		mapcrafter_dir / "logging.conf",
	};

	fs::path home = findHomeDir();
	if (!home.empty())
		configs.insert(configs.begin(), home / ".mapcrafter" / "logging.conf");

	for (PathList::iterator it = configs.begin(); it != configs.end(); ) {
		if (!fs::is_regular_file(*it))
			configs.erase(it);
		else
			++it;
	}
	return configs;
}
开发者ID:Fuitad,项目名称:mapcrafter,代码行数:19,代码来源:filesystem.cpp

示例6:

/* static private */
void
SharedPathsOp::clearEdges(PathList& edges)
{
  for (PathList::const_iterator
        i=edges.begin(), e=edges.end();
        i!=e; ++i)
  {
    delete *i;
  }
  edges.clear();
}
开发者ID:AvlWx2014,项目名称:basemap,代码行数:12,代码来源:SharedPathsOp.cpp

示例7: find_sys_include

 string find_sys_include(string includeName)
 {
     for(PathList::const_iterator i = includePaths.begin(); i != includePaths.end(); i++)
     {
         string path = *i + includeName;
         std::ifstream test(path.c_str(), std::ifstream::in);
         bool found = test.is_open();
         test.close();
         if(found) return *i;
     }
     return includeName;
 }
开发者ID:Nobody-7,项目名称:tcpppl_answers,代码行数:12,代码来源:ex04.cpp

示例8: SearchPathList

  PathName PathName::SearchPathList(const PathList &pathList) const {
    PathName fullFileName;
    
    for (PathList::const_iterator i = pathList.begin(); i != pathList.end(); ++i) {
      
      fullFileName = *i;
      fullFileName.Append(*this);
      if (fullFileName.IsFile())
	return fullFileName;
    }
    return fullFileName;
  }
开发者ID:blowekamp,项目名称:CXMLTestFramework,代码行数:12,代码来源:PathName.cpp

示例9: add_to_vector

// helps fill in the path matrix (see below)
void add_to_vector (PathList& previous_vector, wstring* to_add) {
  wstring string_rep = represent_path (to_add, 2);
  if (previous_vector.size() == 0) {
    previous_vector.push_back (string_rep);
  }
  else {
    PathList::iterator it;
    // if there is more than one possible path, add to all of them
    for (it=previous_vector.begin(); it != previous_vector.end(); it++) {
      it->append (string_rep);
    }
  }
}
开发者ID:anneCarlson,项目名称:Igbo,代码行数:14,代码来源:comparelists8.cpp

示例10: calculate_pair

// subroutine for adding a pair of words to our storage dictionary (see below)
int calculate_pair (TownWords& first_dict, TownWords& second_dict, PathMatches* distance_dict, ChangeMap2& word_matches, wstring first_word, wstring second_word) {
  Word first_split;
  Word second_split;
  wstring curr_char;
  for (int i=1; i <= first_word.length(); i+=2) {
    curr_char += first_word[i-1];
    if (first_word[i] == BD) {
      first_split.push_back(curr_char);
      curr_char.clear();
    }
  }
  first_split.push_back(curr_char);
  curr_char.clear();
  for (int j=1; j <= second_word.length(); j+=2) {
    curr_char += second_word[j-1];
    if (second_word[j] == BD) {
      second_split.push_back(curr_char);
      curr_char.clear();
    }
  }
  second_split.push_back(curr_char);
  curr_char.clear();
  PathList paths;
  PathList::iterator it1;
  int distance = edit_distance(first_split, second_split, paths);
  //word_matches[first_word][second_word] = paths;
  // adding everything takes up too much memory, unfortunately
  if (true/*first_dict.count(second_word) == 0 && second_dict.count(first_word) == 0*/) {
    if (distance <= MAX_DIST) {
      for (it1=paths.begin(); it1 != paths.end(); it1++) {
	if (distance_dict[distance].count(*it1) == 0) {
	  WordPairs newmap;
	  distance_dict[distance][*it1] = newmap;
	}
	if (distance_dict[distance][*it1].count(first_word) == 0) {
	  SecondWords newvector;
	  distance_dict[distance][*it1][first_word] = newvector;
	}
	distance_dict[distance][*it1][first_word].push_back(second_word);
      }
    }
  }
  return distance;
}
开发者ID:anneCarlson,项目名称:Igbo,代码行数:45,代码来源:comparelists8.cpp

示例11: findLoggingConfigFile

fs::path findLoggingConfigFile() {
	PathList configs = findLoggingConfigFiles(findExecutablePath());
	if (configs.size())
		return *configs.begin();
	return fs::path();
}
开发者ID:Fuitad,项目名称:mapcrafter,代码行数:6,代码来源:filesystem.cpp

示例12: findTextureDir

fs::path findTextureDir() {
	PathList textures = findTextureDirs(findExecutablePath());
	if (textures.size())
		return *textures.begin();
	return fs::path();
}
开发者ID:Fuitad,项目名称:mapcrafter,代码行数:6,代码来源:filesystem.cpp

示例13: edit_distance

// calculates the edit distance between two words and tracks the differences
int edit_distance (Word first, Word second, PathList& paths) {
  int first_length = first.size() + 1;
  int second_length = second.size() + 1;
  Word::iterator it1 = first.begin();
  Word::iterator it2 = second.begin();
  int distance_matrix [first_length][second_length];
  PathList path_matrix [first_length][second_length];
  wstring charstring[2];
  bool match;
  distance_matrix[0][0] = 0;
  PathList newvector;
  newvector.push_back(L"");
  path_matrix[0][0] = newvector;
  // fill in the top and left edges of the matrix (i.e. one string is empty)
  for (int i=1; i != first_length; i++) {
    path_matrix[i][0] = path_matrix[i-1][0];
    distance_matrix[i][0] = i;
    charstring[0] = *(it1++);
    charstring[1] = NULL_CHAR;
    add_to_vector (path_matrix[i][0], charstring);
  }
  for (int j=1; j != second_length; j++) {
    path_matrix[0][j] = path_matrix[0][j-1];
    distance_matrix[0][j] = j;
    charstring[0] = NULL_CHAR;
    charstring[1] = *(it2++);
    add_to_vector (path_matrix[0][j], charstring);
  }
  it1 = first.begin();
  for (int i=1; i != first_length; i++) {
    it2 = second.begin();
    for (int j=1; j != second_length; j++) {
      int deletion = distance_matrix[i-1][j] + 1;
      int insertion = distance_matrix[i][j-1] + 1;
      int substitution = distance_matrix[i-1][j-1];
      match = true;
      if (*it1 != *it2) {
	substitution++;
        match = false;
      }
      int minimum_distance = min(deletion, min(insertion, substitution));
      distance_matrix[i][j] = minimum_distance;
      PathList* currcell = &path_matrix[i][j];
      PathList::iterator it;
      // add the changes to the current cell of the path matrix here
      if (minimum_distance == deletion) {
        PathList delcell = path_matrix[i-1][j];
        charstring[0] = *it1;
        charstring[1] = NULL_CHAR;
        add_to_vector (delcell, charstring);
	for (it=delcell.begin(); it != delcell.end(); it++)
	  currcell->push_back (*it);
      }
      if (minimum_distance == insertion) {
        PathList inscell = path_matrix[i][j-1];
        charstring[0] = NULL_CHAR;
        charstring[1] = *it2;
        add_to_vector (inscell, charstring);
	for (it=inscell.begin(); it != inscell.end(); it++)
	  currcell->push_back (*it);
      }
      if (minimum_distance == substitution) {
        PathList subcell = path_matrix[i-1][j-1];
	// if the letters are identical, no need to track that
        if (!match) {
          charstring[0] = *it1;
          charstring[1] = *it2;
          add_to_vector (subcell, charstring);
        }
	for (it=subcell.begin(); it != subcell.end(); it++)
	  currcell->push_back (*it);
      }
      it2++;
    }
    it1++;
  }
  paths = path_matrix[first_length-1][second_length-1];
  return distance_matrix[first_length-1][second_length-1];
}
开发者ID:anneCarlson,项目名称:Igbo,代码行数:80,代码来源:comparelists8.cpp

示例14: writeShortPath

/**
 * @brief ShortPathWriter::writeShortPath - Save exist short path in open file
 * @param fp - open file pointer
 * @param pathIt - Iterator on exist short path
 * @param options - some options (PRINT_INDENTS)
 */
void ShortPathWriter::writeShortPath(FILE* fp, RootPathList::iterator pathIt,
                                     cuint options)
{
    unsigned parentId = pathIt->first;
    ShortPathElem* pathElem = pathIt->second->getNodes();
    PathList* pathList = pathElem->getPathList();
    if (pathList == nullptr)
    {
        return;
    }

    unsigned nodeId;
    float weight;
    bool isFirst = true;
    std::deque <PathListItPair> pathStack;
    unsigned currentIndent = 1;

    bool printIndents = options & (unsigned) Option::PRINT_INDENTS;


    pathStack.push_front( PathListItPair(pathList->begin(), pathList->end()) );

    fprintf(fp, "%u(", parentId);
    if (printIndents)
    {
        fputc('\n', fp);
    }
    while (pathStack.size())
    {
        auto pathIt  = pathStack.front().first;
        auto pathEnd = pathStack.front().second;
        if (pathIt == pathEnd)
        {
            pathStack.pop_front();
            --currentIndent;
            if (printIndents)
            {
                for(unsigned i = 0u; i < currentIndent; ++i)
                {
                    fputc('\t', fp);
                }
                fputs(")\n", fp);
            }
            else
            {
                fputc(')', fp);
            }
            continue;
        }
        nodeId = pathIt->first;
        pathElem = pathIt->second;
        pathList = pathElem->getPathList();

        if (printIndents)
        {
            for(unsigned i = 0u; i < currentIndent; ++i)
            {
                fputc('\t', fp);
            }
        }
        else if (!isFirst)
        {
            fputc(' ', fp);
        }
        else {
            isFirst = false;
        }
        weight = pathElem->getWeight();

        fprintf(fp, "%u[%g]", nodeId, weight);

        ++(pathStack.front().first);

        if (pathList && pathList->size())
        {
            fputc('(', fp);
            // Move to next elem

            // go to next child
            pathStack.push_front( PathListItPair(pathList->begin(),
                                                 pathList->end()) );
            isFirst = true;
            ++currentIndent;
        }
        if (printIndents)
        {
            fputc('\n', fp);
        }
    }
}
开发者ID:Savelyev-Aleksey,项目名称:Compact-graph,代码行数:96,代码来源:ShortPathWriter.cpp


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