mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-18 21:45:24 +00:00
optionally allow to exclude certain formats, by name, from the converter graph
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38166 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1f897752fb
commit
1a0852630a
@ -695,6 +695,43 @@ Converters::getReachable(string const & from, bool const only_viewable,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vector<Format const *> const
|
||||||
|
Converters::getReachable(string const & from, bool const only_viewable,
|
||||||
|
bool const clear_visited, string const & exclude)
|
||||||
|
{
|
||||||
|
vector<int> const & reachables =
|
||||||
|
G_.getReachable(formats.getNumber(from),
|
||||||
|
only_viewable,
|
||||||
|
clear_visited,
|
||||||
|
formats.getNumber(exclude));
|
||||||
|
|
||||||
|
return intToFormat(reachables);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vector<Format const *> const
|
||||||
|
Converters::getReachable(string const & from, bool const only_viewable,
|
||||||
|
bool const clear_visited, vector<string> const & excludes)
|
||||||
|
{
|
||||||
|
vector<int> excluded_numbers(excludes.size());
|
||||||
|
|
||||||
|
vector<string>::const_iterator sit = excludes.begin();
|
||||||
|
vector<string>::const_iterator const end = excludes.end();
|
||||||
|
vector<int>::iterator it = excluded_numbers.begin();
|
||||||
|
for ( ; sit != end; ++sit, ++it) {
|
||||||
|
*it = formats.getNumber(*sit);
|
||||||
|
}
|
||||||
|
|
||||||
|
vector<int> const & reachables =
|
||||||
|
G_.getReachable(formats.getNumber(from),
|
||||||
|
only_viewable,
|
||||||
|
clear_visited,
|
||||||
|
excluded_numbers);
|
||||||
|
|
||||||
|
return intToFormat(reachables);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Converters::isReachable(string const & from, string const & to)
|
bool Converters::isReachable(string const & from, string const & to)
|
||||||
{
|
{
|
||||||
return G_.isReachable(formats.getNumber(from),
|
return G_.isReachable(formats.getNumber(from),
|
||||||
|
@ -98,6 +98,12 @@ 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<Format const *> const
|
||||||
|
getReachable(std::string const & from, bool only_viewable,
|
||||||
|
bool clear_visited, std::string const & exclude);
|
||||||
|
std::vector<Format const *> const
|
||||||
|
getReachable(std::string const & from, bool only_viewable,
|
||||||
|
bool clear_visited, std::vector<std::string> const & excludes);
|
||||||
|
|
||||||
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)
|
bool clear_visited, vector<int> excludes)
|
||||||
{
|
{
|
||||||
EdgePath result;
|
EdgePath result;
|
||||||
queue<int> Q;
|
queue<int> Q;
|
||||||
@ -111,6 +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())
|
||||||
Q.push(cv);
|
Q.push(cv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,6 +121,25 @@ Graph::EdgePath const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Graph::EdgePath const
|
||||||
|
Graph::getReachable(int from, bool only_viewable,
|
||||||
|
bool clear_visited, int exclude)
|
||||||
|
{
|
||||||
|
vector<int> excludes;
|
||||||
|
excludes.push_back(exclude);
|
||||||
|
return getReachable(from, only_viewable, clear_visited, excludes);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Graph::EdgePath const
|
||||||
|
Graph::getReachable(int from, bool only_viewable,
|
||||||
|
bool clear_visited)
|
||||||
|
{
|
||||||
|
vector<int> excludes;
|
||||||
|
return getReachable(from, only_viewable, clear_visited, excludes);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Graph::isReachable(int from, int to)
|
bool Graph::isReachable(int from, int to)
|
||||||
{
|
{
|
||||||
if (from == to)
|
if (from == to)
|
||||||
|
@ -34,6 +34,12 @@ public:
|
|||||||
/// \return a vector of the vertices that can be reached from "from"
|
/// \return a vector of the vertices that can be reached from "from"
|
||||||
EdgePath const
|
EdgePath const
|
||||||
getReachable(int from, bool only_viewable, bool clear_visited);
|
getReachable(int from, bool only_viewable, bool clear_visited);
|
||||||
|
/// \return a vector of the reachable vertices, avoiding "exclude"
|
||||||
|
EdgePath const getReachable(int from, bool only_viewable,
|
||||||
|
bool clear_visited, int exclude);
|
||||||
|
/// \return a vector of the reachable vertices, avoiding all "excludes"
|
||||||
|
EdgePath const getReachable(int from, bool only_viewable,
|
||||||
|
bool clear_visited, std::vector<int> excludes);
|
||||||
/// 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…
x
Reference in New Issue
Block a user