mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
Remove a couple more functors from PrevewLoader.
This commit is contained in:
parent
1e904625b2
commit
47973dc2b4
@ -124,14 +124,10 @@ void setAscentFractions(vector<double> & ascent_fractions,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class FindFirst
|
std::function <bool (SnippetPair const &)> FindFirst(string const & comp)
|
||||||
{
|
{
|
||||||
public:
|
return [comp](SnippetPair const & sp) { return sp.first == comp; };
|
||||||
FindFirst(string const & comp) : comp_(comp) {}
|
}
|
||||||
bool operator()(SnippetPair const & sp) const { return sp.first == comp_; }
|
|
||||||
private:
|
|
||||||
string const comp_;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/// Store info on a currently executing, forked process.
|
/// Store info on a currently executing, forked process.
|
||||||
@ -146,14 +142,14 @@ public:
|
|||||||
/// Remove any files left lying around and kill the forked process.
|
/// Remove any files left lying around and kill the forked process.
|
||||||
void stop() const;
|
void stop() const;
|
||||||
|
|
||||||
///
|
|
||||||
pid_t pid;
|
|
||||||
///
|
///
|
||||||
string command;
|
string command;
|
||||||
///
|
///
|
||||||
FileName metrics_file;
|
FileName metrics_file;
|
||||||
///
|
///
|
||||||
BitmapFile snippets;
|
BitmapFile snippets;
|
||||||
|
///
|
||||||
|
pid_t pid;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef map<pid_t, InProgress> InProgressProcesses;
|
typedef map<pid_t, InProgress> InProgressProcesses;
|
||||||
@ -322,35 +318,25 @@ Buffer const & PreviewLoader::buffer() const
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class IncrementedFileName {
|
std::function<SnippetPair (string const &)> IncrementedFileName
|
||||||
public:
|
(string const & to_format, string const & filename_base)
|
||||||
IncrementedFileName(string const & to_format,
|
|
||||||
string const & filename_base)
|
|
||||||
: to_format_(to_format), base_(filename_base), counter_(1)
|
|
||||||
{}
|
|
||||||
|
|
||||||
SnippetPair const operator()(string const & snippet)
|
|
||||||
{
|
{
|
||||||
|
return [to_format, filename_base](string const & snippet)
|
||||||
|
{
|
||||||
|
static int counter_ = 1;
|
||||||
ostringstream os;
|
ostringstream os;
|
||||||
os << base_ << counter_++ << '.' << to_format_;
|
os << filename_base << counter_++ << '.' << to_format;
|
||||||
string const file = os.str();
|
string const file = os.str();
|
||||||
|
|
||||||
return make_pair(snippet, FileName(file));
|
return make_pair(snippet, FileName(file));
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
string const & to_format_;
|
|
||||||
string const & base_;
|
|
||||||
int counter_;
|
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
InProgress::InProgress(string const & filename_base,
|
InProgress::InProgress(string const & filename_base,
|
||||||
PendingSnippets const & pending,
|
PendingSnippets const & pending,
|
||||||
string const & to_format)
|
string const & to_format)
|
||||||
: pid(0),
|
: metrics_file(filename_base + ".metrics"),
|
||||||
metrics_file(filename_base + ".metrics"),
|
snippets(pending.size()), pid(0)
|
||||||
snippets(pending.size())
|
|
||||||
{
|
{
|
||||||
PendingSnippets::const_iterator pit = pending.begin();
|
PendingSnippets::const_iterator pit = pending.begin();
|
||||||
PendingSnippets::const_iterator pend = pending.end();
|
PendingSnippets::const_iterator pend = pending.end();
|
||||||
|
Loading…
Reference in New Issue
Block a user