mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 13:04:58 +00:00
Given how we are using this exclusion list, it makes more sense for it
to be a set. Not that speed will really be an issue here, but.... git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38178 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1d255a8da5
commit
4685a3e5a8
@ -3712,10 +3712,10 @@ bool Buffer::isExportable(string const & format) const
|
|||||||
vector<Format const *> Buffer::exportableFormats(bool only_viewable) const
|
vector<Format const *> Buffer::exportableFormats(bool only_viewable) const
|
||||||
{
|
{
|
||||||
vector<string> const backs = backends();
|
vector<string> const backs = backends();
|
||||||
vector<string> excludes;
|
set<string> excludes;
|
||||||
if (params().useNonTeXFonts) {
|
if (params().useNonTeXFonts) {
|
||||||
excludes.push_back("latex");
|
excludes.insert("latex");
|
||||||
excludes.push_back("pdflatex");
|
excludes.insert("pdflatex");
|
||||||
}
|
}
|
||||||
vector<Format const *> result =
|
vector<Format const *> result =
|
||||||
theConverters().getReachable(backs[0], only_viewable, true, excludes);
|
theConverters().getReachable(backs[0], only_viewable, true, excludes);
|
||||||
|
@ -691,16 +691,14 @@ Converters::getReachableTo(string const & target, bool const clear_visited)
|
|||||||
|
|
||||||
vector<Format const *> const
|
vector<Format const *> const
|
||||||
Converters::getReachable(string const & from, bool const only_viewable,
|
Converters::getReachable(string const & from, bool const only_viewable,
|
||||||
bool const clear_visited, vector<string> const & excludes)
|
bool const clear_visited, set<string> const & excludes)
|
||||||
{
|
{
|
||||||
vector<int> excluded_numbers(excludes.size());
|
set<int> excluded_numbers;;
|
||||||
|
|
||||||
vector<string>::const_iterator sit = excludes.begin();
|
set<string>::const_iterator sit = excludes.begin();
|
||||||
vector<string>::const_iterator const end = excludes.end();
|
set<string>::const_iterator const end = excludes.end();
|
||||||
vector<int>::iterator it = excluded_numbers.begin();
|
for (; sit != end; ++sit)
|
||||||
for ( ; sit != end; ++sit, ++it) {
|
excluded_numbers.insert(formats.getNumber(*sit));
|
||||||
*it = formats.getNumber(*sit);
|
|
||||||
}
|
|
||||||
|
|
||||||
vector<int> const & reachables =
|
vector<int> const & reachables =
|
||||||
G_.getReachable(formats.getNumber(from),
|
G_.getReachable(formats.getNumber(from),
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "OutputParams.h"
|
#include "OutputParams.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
@ -101,7 +102,7 @@ public:
|
|||||||
std::vector<Format const *> const
|
std::vector<Format const *> const
|
||||||
getReachable(std::string const & from, bool only_viewable,
|
getReachable(std::string const & from, bool only_viewable,
|
||||||
bool clear_visited,
|
bool clear_visited,
|
||||||
std::vector<std::string> const & excludes = std::vector<std::string>());
|
std::set<std::string> const & excludes = std::set<std::string>());
|
||||||
|
|
||||||
std::vector<Format const *> importableFormats();
|
std::vector<Format const *> importableFormats();
|
||||||
std::vector<Format const *> exportableFormats(bool only_viewable);
|
std::vector<Format const *> exportableFormats(bool only_viewable);
|
||||||
|
@ -83,7 +83,7 @@ Graph::EdgePath const
|
|||||||
|
|
||||||
Graph::EdgePath const
|
Graph::EdgePath const
|
||||||
Graph::getReachable(int from, bool only_viewable,
|
Graph::getReachable(int from, bool only_viewable,
|
||||||
bool clear_visited, vector<int> excludes)
|
bool clear_visited, set<int> excludes)
|
||||||
{
|
{
|
||||||
EdgePath result;
|
EdgePath result;
|
||||||
queue<int> Q;
|
queue<int> Q;
|
||||||
@ -111,7 +111,7 @@ Graph::EdgePath const
|
|||||||
int const cv = (*cit)->to;
|
int const cv = (*cit)->to;
|
||||||
if (!vertices_[cv].visited) {
|
if (!vertices_[cv].visited) {
|
||||||
vertices_[cv].visited = true;
|
vertices_[cv].visited = true;
|
||||||
if (find(excludes.begin(), excludes.end(), cv) == excludes.end())
|
if (excludes.find(cv) == excludes.end())
|
||||||
Q.push(cv);
|
Q.push(cv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
#include <set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
@ -33,7 +34,7 @@ public:
|
|||||||
EdgePath const getReachableTo(int to, bool clear_visited);
|
EdgePath const getReachableTo(int to, bool clear_visited);
|
||||||
/// \return a vector of the reachable vertices, avoiding all "excludes"
|
/// \return a vector of the reachable vertices, avoiding all "excludes"
|
||||||
EdgePath const getReachable(int from, bool only_viewable,
|
EdgePath const getReachable(int from, bool only_viewable,
|
||||||
bool clear_visited, std::vector<int> excludes = std::vector<int>());
|
bool clear_visited, std::set<int> excludes = std::set<int>());
|
||||||
/// can "from" be reached from "to"?
|
/// can "from" be reached from "to"?
|
||||||
bool isReachable(int from, int to);
|
bool isReachable(int from, int to);
|
||||||
/// find a path from "from" to "to". always returns one of the
|
/// find a path from "from" to "to". always returns one of the
|
||||||
|
Loading…
Reference in New Issue
Block a user