#include "qt_helpers.h"
#include "support/debug.h"
-#include "support/foreach.h"
#include <QCheckBox>
#include <QPushButton>
bool checkWidgets() const
{
bool valid = true;
- foreach (const CheckedLineEdit & w, checked_widgets_)
+ for (const CheckedLineEdit & w : checked_widgets_)
valid &= w.check();
return valid;
}
{
if (d->read_only_.empty())
return;
-
bool const enable = !policy().isReadOnly();
-
- foreach (QWidget * w, d->read_only_)
+ for(QWidget * w : d->read_only_)
setWidgetEnabled(w, enable);
}
#include "support/ExceptionMessage.h"
#include "support/FileName.h"
#include "support/filetools.h"
-#include "support/foreach.h"
#include "support/ForkedCalls.h"
#include "support/gettext.h"
#include "support/lassert.h"
QList<GuiView *> allViews = d->views_.values();
- // this foreach does not modify any buffer. It just collects info on local visibility of buffers
- // and on which buffer is active in each view.
+ // this for does not modify any buffer. It just collects info on local
+ // visibility of buffers and on which buffer is active in each view.
Buffer * const last = theBufferList().last();
- foreach (GuiView * view, allViews) {
- // all of the buffers might be locally hidden. That is, there is no active buffer.
+ for(GuiView * view : allViews) {
+ // all of the buffers might be locally hidden. That is, there is no
+ // active buffer.
if (!view || !view->currentBufferView())
activeBuffers[view] = 0;
else
}
// put things back to how they were (if possible).
- foreach (GuiView * view, allViews) {
+ for (GuiView * view : allViews) {
Buffer * originalBuf = activeBuffers[view];
// there might not have been an active buffer in this view or it might have been closed by the LFUN.
if (theBufferList().isLoaded(originalBuf))
theSession().lastOpened().clear();
QList<GuiView *> const views = d->views_.values();
- foreach (GuiView * view, views) {
+ for (GuiView * view : views) {
if (!view->closeScheduled())
return false;
}
return true;
QList<GuiView *> const views = d->views_.values();
- foreach (GuiView * view, views) {
+ for (GuiView * view : views) {
if (!view->prepareAllBuffersForLogout())
return false;
}
void GuiApplication::hideDialogs(string const & name, Inset * inset) const
{
QList<GuiView *> const views = d->views_.values();
- foreach (GuiView * view, views)
+ for (GuiView * view : views)
view->hideDialog(name, inset);
}
#include "insets/InsetBox.h"
#include "support/gettext.h"
-#include "support/foreach.h"
#include "support/lstrings.h"
#include <QComboBox>
#include "support/debug.h"
#include "support/FileName.h"
#include "support/filetools.h"
-#include "support/foreach.h"
#include "support/gettext.h"
#include "support/lassert.h"
#include "support/lstrings.h"
#include "FuncRequest.h"
#include "support/filetools.h"
-#include "support/foreach.h"
#include "support/FileName.h"
#include "qt_helpers.h"
data.sort();
fileListLW->clear();
- foreach (QString const & item, data)
+ for(QString const & item : data)
fileListLW->addItem(item);
activeStyle_ = type;
#include "qt_helpers.h"
#include "support/debug.h"
-#include "support/foreach.h"
#include "support/lassert.h"
#include <QAbstractButton>
// If the search string is empty we enable all the items
// otherwise we disable everything and then selectively
// re-enable matching items
- foreach (QTreeWidgetItem * tree_item, panel_map_) {
+ for (QTreeWidgetItem * tree_item : panel_map_) {
setTreeItemStatus(tree_item, enable_all);
}
- foreach (QTreeWidgetItem * tree_item, panel_map_) {
+ for (QTreeWidgetItem * tree_item : panel_map_) {
// Current widget
QWidget * pane_widget = widget_map_[tree_item];
if (pane_widget) {
// Loops on the list of children widgets (recursive)
QWidgetList children = pane_widget->findChildren<QWidget *>();
- foreach (QWidget * child_widget, children) {
+ for (QWidget * child_widget : children) {
bool widget_matches = false;
// Try to cast to the most common widgets and looks in it's content
#include "support/convert.h"
#include "support/debug.h"
-#include "support/foreach.h"
#include "support/gettext.h"
#include "support/lstrings.h"
#include "support/lyxalgo.h"
+++ /dev/null
-/**
- * \file foreach.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Matthias Ettrich
- *
- * Full author contact details are available in file CREDITS.
- *
- */
-
-#ifndef FOREACH_H
-#define FOREACH_H
-
-// Code stolen from Q_FOREACH, augmented to use a reference to the
-// original container instead of a copy. Copies are cheap (if not
-// mutated) for Qt's containers due to copy-on-write. The are less
-// cheap for Standard containers, that's why the modification.
-// Drawback is that we can't use temporary containers as they
-// will be destroyed before the loop is finished. So always write
-//
-// Container const & container = functionReturningTemporaryOrReference()
-// foreach (ContainerItem const & item, container) {
-// ...
-// }
-//
-// to extend the lifetime of the reference.
-
-#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL)
-
-/* make use of typeof-extension */
-template <typename T>
-class ForeachContainer {
-public:
- inline ForeachContainer(const T & t) : c(t), brk(0), i(c.begin()), e(c.end()) { }
- const T & c;
- int brk;
- typename T::const_iterator i, e;
-};
-
-#define foreach(variable, container) \
-for (ForeachContainer<__typeof__(container)> _container_(container); \
- !_container_.brk && _container_.i != _container_.e; \
- __extension__ ({ ++_container_.brk; ++_container_.i; })) \
- for (variable = *_container_.i;; __extension__ ({--_container_.brk; break;}))
-
-#else
-
-struct ForeachContainerBase {};
-
-template <typename T>
-class ForeachContainer : public ForeachContainerBase {
-public:
- inline ForeachContainer(const T& t): c(t), brk(0), i(c.begin()), e(c.end()){}
- const T & c;
- mutable int brk;
- mutable typename T::const_iterator i, e;
- inline bool condition() const { return (!brk++ && i != e); }
-};
-
-template <typename T> inline T *foreachPointer(const T &) { return 0; }
-
-template <typename T> inline ForeachContainer<T> foreachContainerNew(const T& t)
-{ return ForeachContainer<T>(t); }
-
-template <typename T>
-inline const ForeachContainer<T> *foreachContainer(const ForeachContainerBase *base, const T *)
-{ return static_cast<const ForeachContainer<T> *>(base); }
-
-#define foreach(variable, container) \
- for (const ForeachContainerBase &_container_ = foreachContainerNew(container); \
- foreachContainer(&_container_, true ? 0 : foreachPointer(container))->condition(); \
- ++foreachContainer(&_container_, true ? 0 : foreachPointer(container))->i) \
- for (variable = *foreachContainer(&_container_, true ? 0 : foreachPointer(container))->i; \
- foreachContainer(&_container_, true ? 0 : foreachPointer(container))->brk; \
- --foreachContainer(&_container_, true ? 0 : foreachPointer(container))->brk)
-#endif
-
-#endif // FOREACH_H
#include "Encoding.h"
#include "Parser.h"
-#include "support/foreach.h"
#include "support/lstrings.h"
#include "support/textutils.h"