BindingList list;
listBindings(list, KeySequence(nullptr, nullptr), tag);
if (unbound) {
- LyXAction::const_iterator fit = lyxaction.func_begin();
- LyXAction::const_iterator const fen = lyxaction.func_end();
- for (; fit != fen; ++fit) {
- FuncCode action = fit->second;
+ for (auto const & name_code : lyxaction) {
+ FuncCode action = name_code.second;
bool has_action = false;
BindingList::const_iterator bit = list.begin();
BindingList::const_iterator const ben = list.end();
}
-LyXAction::const_iterator LyXAction::func_begin() const
+LyXAction::const_iterator LyXAction::begin() const
{
return lyx_func_map.begin();
}
-LyXAction::const_iterator LyXAction::func_end() const
+LyXAction::const_iterator LyXAction::end() const
{
return lyx_func_map.end();
}
typedef FuncMap::const_iterator const_iterator;
/// return an iterator to the start of the list of LFUNs
- const_iterator func_begin() const;
+ const_iterator begin() const;
/// return an iterator to one past the end of the list of LFUNs
- const_iterator func_end() const;
+ const_iterator end() const;
private:
/// noncopyable
#include "FuncRequest.h"
#include "Session.h"
-#include "support/lyxalgo.h"
#include "support/lstrings.h"
#include <QHBoxLayout>
GuiCommandBuffer::GuiCommandBuffer(GuiView * view)
: view_(view)
{
- transform(lyxaction.func_begin(), lyxaction.func_end(),
- back_inserter(commands_), firster());
+ for (auto const & name_code : lyxaction) {
+ commands_.push_back(name_code.first);
+ }
QPixmap qpup = getPixmap("images/", "up", "svgz,png");
QPixmap qpdown = getPixmap("images/", "down", "svgz,png");
}
-namespace {
-
-class prefix_p {
-public:
- string p;
- prefix_p(string const & s) : p(s) {}
- bool operator()(string const & s) const { return prefixIs(s, p); }
-};
-
-} // namespace
-
-
string const GuiCommandBuffer::historyUp()
{
if (history_pos_ == history_.begin())
GuiCommandBuffer::completions(string const & prefix, string & new_prefix)
{
vector<string> comp;
-
- lyx::copy_if(commands_.begin(), commands_.end(),
- back_inserter(comp), prefix_p(prefix));
+ for (auto const & cmd : commands_) {
+ if (prefixIs(cmd, prefix))
+ comp.push_back(cmd);
+ }
if (comp.empty()) {
new_prefix = prefix;
test += tmp[test.length()];
while (test.length() < tmp.length()) {
vector<string> vtmp;
- lyx::copy_if(comp.begin(), comp.end(),
- back_inserter(vtmp), prefix_p(test));
+ for (auto const & cmd : comp) {
+ if (prefixIs(cmd, test))
+ vtmp.push_back(cmd);
+ }
if (vtmp.size() != comp.size()) {
test.erase(test.length() - 1);
break;
#include "support/gettext.h"
#include "support/Length.h"
#include "support/lstrings.h"
-#include "support/lyxalgo.h"
#include "support/os.h"
#include "support/Package.h"
#include "support/PathChanger.h"
#include "support/filetools.h"
#include "support/gettext.h"
#include "support/lstrings.h"
-#include "support/lyxalgo.h"
#include "support/os.h"
#include "support/Package.h"
#include "support/gettext.h"
#include "support/lassert.h"
#include "support/lstrings.h" // contains
-#include "support/lyxalgo.h"
#include "support/mutex.h"
#include "support/ExceptionMessage.h"
case MENU_INFO:
case ICON_INFO: {
result.push_back(make_pair("custom", _("Custom")));
- LyXAction::const_iterator fit = lyxaction.func_begin();
- LyXAction::const_iterator const fen = lyxaction.func_end();
- for (; fit != fen; ++fit) {
- string const lfun = fit->first;
+ for (auto const & name_code : lyxaction) {
+ string const lfun = name_code.first;
if (!lfun.empty())
result.push_back(make_pair(lfun, from_ascii(lfun)));
}
#include "support/convert.h"
#include "support/gettext.h"
#include "support/lstrings.h"
-#include "support/lyxalgo.h"
using namespace std;
using namespace lyx::support;
#include "support/docstream.h"
#include "support/gettext.h"
#include "support/lassert.h"
-#include "support/lyxalgo.h"
#include <cstdlib>
#include "support/convert.h"
#include "support/debug.h"
#include "support/lstrings.h"
-#include "support/lyxalgo.h"
#include "support/textutils.h"
#include "support/gettext.h"
#ifndef LYX_ALGO_H
#define LYX_ALGO_H
-#include <utility>
-#include <iterator>
-#include <algorithm>
-
-
namespace lyx {
}
-struct firster {
- template <class P1, class P2>
- P1 operator()(std::pair<P1, P2> const & p) {
- return p.first;
- }
-};
-
-
-/**
- * copy elements in the given range to the output iterator
- * if the predicate evaluates as true
- */
-template <class InputIter, class OutputIter, class Func>
-OutputIter copy_if(InputIter first, InputIter last,
- OutputIter result, Func func)
-{
- for (; first != last; ++first) {
- if (func(*first)) {
- *result++ = *first;
- }
- }
- return result;
-}
-
-
-/// Remove all duplicate entries in c.
-template<class C>
-void eliminate_duplicates(C & c)
-{
- // It is a requirement that the container is sorted for
- // std::unique to work properly.
- std::sort(c.begin(), c.end());
- c.erase(std::unique(c.begin(), c.end()), c.end());
-}
-
-
} // namespace lyx
#endif // LYX_ALGO_H