Make us satisfy concept checks

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9260 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2004-11-16 20:41:38 +00:00
parent 3c6f968676
commit 1f9d992ce0
29 changed files with 228 additions and 132 deletions

View File

@ -1,3 +1,8 @@
2004-11-16 Lars Gullik Bjonnes <larsbj@gullik.net>
* lyxinclude.m4 (enable_debug): Add support for stdlibc++ concept
checks on gcc >3.4.
2004-10-23 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* lyxinclude.m4 (LYX_VERSION_SUFFIX): set RPM_VERSION_SUFFIX even

View File

@ -220,7 +220,11 @@ if test x$GXX = xyes; then
esac
if test x$enable_debug = xyes ; then
case $gxx_version in
3.3*) CXXFLAGS="-g $CXXFLAGS"
AC_DEFINE(_GLIBCPP_CONCEPT_CHECKS, 1, [libstdc++ concept checking])
;;
3.4*|3.5*) CXXFLAGS="-g $CXXFLAGS"
AC_DEFINE(_GLIBCXX_CONCEPT_CHECKS, 1, [libstdc++ concept checking])
AC_DEFINE(_GLIBCXX_DEBUG, 1, [libstdc++ debug mode])
AC_DEFINE(_GLIBCXX_DEBUG_PEDANTIC, 1, [libstdc++ pedantic debug mode])
;;

View File

@ -1,3 +1,23 @@
2004-11-16 Lars Gullik Bjonnes <larsbj@gullik.net>
* pariterator.h: add typdefs for value_type, difference_type,
pointer and reference to satisfy concept checks. Also add default
constructor for same reason.
* pariterator.C (operator++): add post-increment operator to
satisfy concept checks.
* lyxtextclasslist.h: include lyxtextclass.h to satisfy concept
checks.
* RowList_fwd.h: include lyxrow.h to satisfy concept checks.
* ParagraphList_fwd.h: include paragraph.h to satisfy concept
checks. Also rename base_type to BaseType to follow naming
standard better.
* FloatList.h: include Floating.h to satisfy concept checks.
2004-11-15 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* lyxfunc.C (getStatus): when the origin of the request is menu or

View File

@ -12,12 +12,12 @@
#ifndef FLOATLIST_H
#define FLOATLIST_H
#include "Floating.h"
#include <map>
#include <string>
class Floating;
///
class FloatList {
public:

View File

@ -12,21 +12,21 @@
#ifndef PARAGRAPH_LIST_FWD_H
#define PARAGRAPH_LIST_FWD_H
#include <vector>
#include "paragraph.h"
class Paragraph;
#include <vector>
class ParagraphList : public std::vector<Paragraph>
{
public:
///
typedef std::vector<Paragraph> base_type;
typedef std::vector<Paragraph> BaseType;
///
ParagraphList();
///
template <class Iter>
ParagraphList(Iter beg, Iter end)
: base_type(beg, end)
: BaseType(beg, end)
{}
};

View File

@ -12,9 +12,9 @@
#ifndef ROW_LIST_FWD_H
#define ROW_LIST_FWD_H
#include <vector>
#include "lyxrow.h"
class Row;
#include <vector>
typedef std::vector<Row> RowList;

View File

@ -1,3 +1,23 @@
2004-11-16 Lars Gullik Bjonnes <larsbj@gullik.net>
* Layoutengine.[Ch]: Break up circular dependency between Box and
BoxList with the use of boost::shared_ptr. Modify to fit
* XFormsMenubar.[Ch]: modify to fit
* XFormsToolbar.[Ch]: modify to fit
* XFormsView.[Ch]: modify to fit
* XMiniBuffer.[Ch]: modify to fit
* XWorkArea.[Ch]: modify to fit
* LayoutEngine.C (show): use std::for_each
(hide): ditto
* FormPreferences.h: include xforms_helpers.h to satisfy concept
checks.
* FormCharacter.h: include LColor.h to satisfy concept checks.
* FormCharacter.C: do no include LColor.h
2004-11-15 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* XFormsView.C (hasFocus): new method, always returns true for now

View File

@ -20,8 +20,6 @@
#include "controllers/frnt_lang.h"
#include "controllers/helper_funcs.h"
#include "LColor.h"
#include "support/lstrings.h"
#include "lyx_forms.h"

View File

@ -16,7 +16,7 @@
#include "FormDialogView.h"
#include "ControlCharacter.h" // for ControlCharacter enum
struct LColor_color;
#include "LColor.h"
namespace lyx {
namespace frontend {

View File

@ -16,6 +16,7 @@
#include "FormDialogView.h"
#include "lyx_forms.h"
#include "xforms_helpers.h"
#include <boost/scoped_ptr.hpp>
@ -49,9 +50,7 @@ struct FD_preferences_screen_fonts;
struct FD_preferences_spelloptions;
class FormColorpicker;
class NamedColor;
class RGBColor;
class XformsColor;
/** This class provides an XForms implementation of the FormPreferences Dialog.
* The preferences dialog allows users to set/save their preferences.

View File

@ -24,8 +24,14 @@
#include "LayoutEngine.h"
#include "lyx_forms.h"
#include <boost/assert.hpp>
#include <boost/assert.hpp>
#include <boost/bind.hpp>
using boost::bind;
using boost::shared_ptr;
using std::for_each;
namespace lyx {
namespace frontend {
@ -49,9 +55,9 @@ void BoxList::clear()
}
Box & BoxList::push_back(Box const & box)
shared_ptr<Box> BoxList::push_back(Box const & box)
{
data_.push_back(box);
data_.push_back(shared_ptr<Box>(new Box(box)));
return data_.back();
}
@ -176,7 +182,7 @@ bool Box::expandable() const
BoxList::const_iterator it = children_.begin();
BoxList::const_iterator const end = children_.end();
for (; it != end; ++it) {
if (it->visible() && it->packing() == Expand)
if ((*it)->visible() && (*it)->packing() == Expand)
return true;
}
@ -211,10 +217,8 @@ void Box::show()
visible_ = true;
BoxList::iterator it = children_.begin();
BoxList::iterator const end = children_.end();
for (; it != end; ++it)
it->show();
for_each(children_.begin(), children_.end(),
bind(&Box::show, _1));
}
@ -222,10 +226,8 @@ void Box::hide()
{
visible_ = false;
BoxList::iterator it = children_.begin();
BoxList::iterator const end = children_.end();
for (; it != end; ++it)
it->hide();
for_each(children_.begin(), children_.end(),
bind(&Box::hide, _1));
}
@ -280,12 +282,12 @@ void Box::shrinkMetrics()
BoxList::iterator it = children_.begin();
BoxList::iterator const end = children_.end();
for (; it != end; ++it) {
if (!it->visible())
if (!(*it)->visible())
continue;
it->shrinkMetrics();
dimension_t child_width = it->width();
dimension_t child_height = it->height();
(*it)->shrinkMetrics();
dimension_t child_width = (*it)->width();
dimension_t child_height = (*it)->height();
if (orientation_ == Horizontal) {
width += child_width;
@ -326,12 +328,12 @@ void Box::expandHbox(dimension_t x_in, dimension_t y_in,
BoxList::const_iterator cit = children_.begin();
BoxList::const_iterator const cend = children_.end();
for (; cit != cend; ++cit) {
if (cit->visible()) {
if ((*cit)->visible()) {
nvisible_children += 1;
if (cit->expandable())
if ((*cit)->expandable())
nexpanded_children += 1;
else
w_fixed += cit->width();
w_fixed += (*cit)->width();
}
}
@ -352,11 +354,11 @@ void Box::expandHbox(dimension_t x_in, dimension_t y_in,
BoxList::iterator it = children_.begin();
BoxList::iterator const end = children_.end();
for (; it != end; ++it) {
if (!it->visible())
if (!(*it)->visible())
continue;
dimension_t w_child = it->width();
if (it->expandable()) {
dimension_t w_child = (*it)->width();
if ((*it)->expandable()) {
if (nexpanded_children == 1)
w_child = std::max(w_child, width);
else
@ -366,7 +368,7 @@ void Box::expandHbox(dimension_t x_in, dimension_t y_in,
width -= w_child;
}
it->expandMetrics(x_child, y_child, w_child, h_child);
(*it)->expandMetrics(x_child, y_child, w_child, h_child);
x_child += w_child;
}
}
@ -382,12 +384,12 @@ void Box::expandVbox(dimension_t x_in, dimension_t y_in,
BoxList::const_iterator cit = children_.begin();
BoxList::const_iterator const cend = children_.end();
for (; cit != cend; ++cit) {
if (cit->visible()) {
if ((*cit)->visible()) {
nvisible_children += 1;
if (cit->expandable())
if ((*cit)->expandable())
nexpanded_children += 1;
else
h_fixed += cit->height();
h_fixed += (*cit)->height();
}
}
@ -408,11 +410,11 @@ void Box::expandVbox(dimension_t x_in, dimension_t y_in,
BoxList::iterator it = children_.begin();
BoxList::iterator const end = children_.end();
for (; it != end; ++it) {
if (!it->visible())
if (!(*it)->visible())
continue;
dimension_t h_child = it->height();
if (it->expandable()) {
dimension_t h_child = (*it)->height();
if ((*it)->expandable()) {
if (nexpanded_children == 1)
h_child = std::max(h_child, height);
else
@ -421,17 +423,17 @@ void Box::expandVbox(dimension_t x_in, dimension_t y_in,
height -= h_child;
}
it->expandMetrics(x_child, y_child, w_child, h_child);
(*it)->expandMetrics(x_child, y_child, w_child, h_child);
y_child += h_child;
}
}
Box & WidgetMap::add(FL_OBJECT * ob, BoxList & container,
shared_ptr<Box> WidgetMap::add(FL_OBJECT * ob, BoxList & container,
dimension_t min_w, dimension_t min_h)
{
Box & box = container.push_back(Box(min_w, min_h));
widgets_[ob] = &box;
shared_ptr<Box> box = container.push_back(Box(min_w, min_h));
widgets_[ob] = box;
return box;
}
@ -458,16 +460,17 @@ void WidgetMap::updateMetrics() const
}
Box & embed(FL_OBJECT * ob, BoxList & container, WidgetMap & widgets, int bw)
shared_ptr<Box>
embed(FL_OBJECT * ob, BoxList & container, WidgetMap & widgets, int bw)
{
container.push_back(Box(0, bw));
Box & middle = container.push_back(Box(0, 0));
middle.set(Box::Horizontal);
shared_ptr<Box> middle = container.push_back(Box(0, 0));
middle->set(Box::Horizontal);
container.push_back(Box(0, bw));
middle.children().push_back(Box(bw, 0));
Box & center = widgets.add(ob, middle.children(), 0, 0);
middle.children().push_back(Box(bw, 0));
middle->children().push_back(Box(bw, 0));
shared_ptr<Box> center = widgets.add(ob, middle->children(), 0, 0);
middle->children().push_back(Box(bw, 0));
return center;
}

View File

@ -15,6 +15,9 @@
#define LAYOUT_ENGINE_H
#include "forms_fwd.h"
#include <boost/shared_ptr.hpp>
#include <list>
#include <map>
@ -25,7 +28,7 @@ class Box;
class BoxList {
public:
typedef std::list<Box> Container;
typedef std::list<boost::shared_ptr<Box> > Container;
typedef Container::size_type size_type;
typedef Container::iterator iterator;
typedef Container::const_iterator const_iterator;
@ -34,7 +37,7 @@ public:
size_type size() const;
void clear();
Box & push_back(Box const &);
boost::shared_ptr<Box> push_back(Box const &);
iterator begin();
iterator end();
@ -167,12 +170,13 @@ public:
typedef Box::dimension_t dimension_t;
/// \returns the just-added Box.
Box & add(FL_OBJECT * widget, BoxList & container,
boost::shared_ptr<Box>
add(FL_OBJECT * widget, BoxList & container,
dimension_t min_w, dimension_t min_h);
void updateMetrics() const;
private:
typedef std::map<FL_OBJECT *, Box *> DataMap;
typedef std::map<FL_OBJECT *, boost::shared_ptr<Box> > DataMap;
DataMap widgets_;
};
@ -181,7 +185,8 @@ private:
* Thereafter, hand control of its metrics to \c widgets.
* \returns the Box containing \c ob.
*/
Box & embed(FL_OBJECT * ob, BoxList & container, WidgetMap & widgets, int bw);
boost::shared_ptr<Box>
embed(FL_OBJECT * ob, BoxList & container, WidgetMap & widgets, int bw);
} // namespace frontend
} // namespace lyx

View File

@ -27,6 +27,8 @@
#include "lyx_forms.h"
using boost::shared_ptr;
using std::distance;
using std::endl;
using std::for_each;
@ -88,8 +90,7 @@ extern "C" {
XFormsMenubar::XFormsMenubar(LyXView * view, MenuBackend const & mb)
: owner_(static_cast<XFormsView*>(view)),
menubackend_(&mb),
menubar_(0)
menubackend_(&mb)
{
owner_->metricsUpdated.connect(boost::bind(&WidgetMap::updateMetrics,
&widgets_));
@ -105,24 +106,24 @@ XFormsMenubar::~XFormsMenubar()
void XFormsMenubar::makeMenubar(Menu const & menu)
{
// Draw a frame around the whole.
BoxList & boxlist = owner_->getBox(XFormsView::Top).children();
BoxList & boxlist = owner_->getBox(XFormsView::Top)->children();
FL_OBJECT * frame = fl_add_frame(FL_UP_FRAME, 0, 0, 0, 0, "");
fl_set_object_resize(frame, FL_RESIZE_ALL);
fl_set_object_gravity(frame, NorthWestGravity, NorthEastGravity);
menubar_ = &widgets_.add(frame, boxlist, 0, mheight);
menubar_ = widgets_.add(frame, boxlist, 0, mheight);
// The menubar contains three vertically-aligned Boxes,
// the center one of which is to contain the buttons,
// aligned horizontally.
// The other two provide some visual padding.
menubar_->children().push_back(Box(0, yloc));
Box & menubar_center = menubar_->children().push_back(Box(0,0));
menubar_center.set(Box::Horizontal);
shared_ptr<Box> menubar_center = menubar_->children().push_back(Box(0,0));
menubar_center->set(Box::Horizontal);
menubar_->children().push_back(Box(0, yloc));
BoxList & menubar_buttons = menubar_center.children();
BoxList & menubar_buttons = menubar_center->children();
// Add the buttons.
Menu::const_iterator i = menu.begin();

View File

@ -72,7 +72,7 @@ private:
///
MenuBackend const * menubackend_;
///
Box * menubar_;
boost::shared_ptr<Box> menubar_;
///
WidgetMap widgets_;
///

View File

@ -38,6 +38,8 @@
#include <sstream>
#include <vector>
using boost::shared_ptr;
using std::distance;
using std::endl;
using std::string;
@ -200,14 +202,13 @@ namespace frontend {
XFormsToolbar::XFormsToolbar(ToolbarBackend::Toolbar const & tbb,
LyXView & o)
: toolbar_(0),
toolbar_buttons_(0),
: toolbar_buttons_(0),
owner_(static_cast<XFormsView &>(o)),
tooltip_(new Tooltips)
{
position_ = getPosition(tbb.flags);
BoxList & boxlist = owner_.getBox(position_).children();
toolbar_ = &boxlist.push_back(Box(0,0));
BoxList & boxlist = owner_.getBox(position_)->children();
toolbar_ = boxlist.push_back(Box(0,0));
// If the toolbar is horizontal, then it contains three
// vertically-aligned Boxes,the center one of which is to
@ -235,9 +236,9 @@ XFormsToolbar::XFormsToolbar(ToolbarBackend::Toolbar const & tbb,
toolbar_->children().push_back(Box(padding, padding));
Box & toolbar_center = toolbar_->children().push_back(Box(0,0));
toolbar_center.set(toolbar_orientation);
toolbar_buttons_ = &toolbar_center.children();
shared_ptr<Box> toolbar_center = toolbar_->children().push_back(Box(0,0));
toolbar_center->set(toolbar_orientation);
toolbar_buttons_ = &toolbar_center->children();
toolbar_->children().push_back(Box(padding, padding));
@ -249,7 +250,6 @@ XFormsToolbar::XFormsToolbar(ToolbarBackend::Toolbar const & tbb,
ToolbarBackend::item_iterator end = tbb.items.end();
for (; it != end; ++it)
add(it->first, it->second);
}

View File

@ -97,7 +97,7 @@ public:
///
XFormsView::Position position_;
///
Box * toolbar_;
boost::shared_ptr<Box> toolbar_;
///
BoxList * toolbar_buttons_;
///

View File

@ -27,6 +27,8 @@
#include <boost/bind.hpp>
using boost::shared_ptr;
using std::abs;
using std::endl;
using std::string;
@ -69,22 +71,22 @@ XFormsView::XFormsView(int width, int height)
int const air = 2;
// Logical layout of the boxes making up the LyX window.
Box & top = window_.children().push_back(Box(0,0));
Box & middle = window_.children().push_back(Box(0,0));
middle.set(Box::Horizontal);
Box & bottom = window_.children().push_back(Box(0,0));
shared_ptr<Box> top = window_.children().push_back(Box(0,0));
shared_ptr<Box> middle = window_.children().push_back(Box(0,0));
middle->set(Box::Horizontal);
shared_ptr<Box> bottom = window_.children().push_back(Box(0,0));
Box & left = middle.children().push_back(Box(air,0));
Box & center = middle.children().push_back(Box(0,0));
center.set(Box::Expand);
Box & right = middle.children().push_back(Box(air,0));
shared_ptr<Box> left = middle->children().push_back(Box(air,0));
shared_ptr<Box> center = middle->children().push_back(Box(0,0));
center->set(Box::Expand);
shared_ptr<Box> right = middle->children().push_back(Box(air,0));
// Define accessors to the various boxes.
box_map_[Top] = &top;
box_map_[Bottom] = &bottom;
box_map_[Left] = &left;
box_map_[Center] = &center;
box_map_[Right] = &right;
box_map_[Top] = top;
box_map_[Bottom] = bottom;
box_map_[Left] = left;
box_map_[Center] = center;
box_map_[Right] = right;
// Define the XForms components making up the window.
// Each uses the layout engine defined above to control its
@ -145,11 +147,11 @@ XFormsView::~XFormsView()
}
Box & XFormsView::getBox(Position pos) const
shared_ptr<Box> XFormsView::getBox(Position pos) const
{
std::map<Position, Box *>::const_iterator it = box_map_.find(pos);
BoxMap::const_iterator it = box_map_.find(pos);
BOOST_ASSERT(it != box_map_.end());
return *it->second;
return it->second;
}

View File

@ -48,7 +48,7 @@ public:
~XFormsView();
/// Accessor to the appropriate layout Box.
Box & getBox(Position pos) const;
boost::shared_ptr<Box> getBox(Position pos) const;
/**
* show - display the top-level window
@ -96,8 +96,10 @@ private:
/// The top-most box of the layout engine containing all other boxes.
Box window_;
typedef std::map<Position, boost::shared_ptr<Box> > BoxMap;
// Accessors to the various Boxes.
std::map<Position, Box *> box_map_;
BoxMap box_map_;
/// the minibuffer
boost::scoped_ptr<XMiniBuffer> minibuffer_;

View File

@ -25,6 +25,8 @@
#include <boost/bind.hpp>
using boost::shared_ptr;
using std::vector;
using std::string;
@ -53,11 +55,11 @@ XMiniBuffer::XMiniBuffer(XFormsView & owner,
// 2 pixel deep frame.
int const air = 2;
BoxList & boxlist = owner.getBox(XFormsView::Bottom).children();
minibuffer_ = &boxlist.push_back(Box(0,0));
Box & center = embed(input_, minibuffer_->children(), widgets_, air);
center.set(Box::Expand);
center.setMinimumDimensions(0, 25);
BoxList & boxlist = owner.getBox(XFormsView::Bottom)->children();
minibuffer_ = boxlist.push_back(Box(0,0));
shared_ptr<Box> center = embed(input_, minibuffer_->children(), widgets_, air);
center->set(Box::Expand);
center->setMinimumDimensions(0, 25);
owner.metricsUpdated.connect(boost::bind(&WidgetMap::updateMetrics,
&widgets_));

View File

@ -109,7 +109,7 @@ private:
/// are we showing an informational temporary message ?
bool info_shown_;
///
Box * minibuffer_;
boost::shared_ptr<Box> minibuffer_;
///
WidgetMap widgets_;
};

View File

@ -24,6 +24,8 @@
#include <boost/bind.hpp>
using boost::shared_ptr;
using std::abs;
using std::dec;
using std::endl;
@ -147,17 +149,17 @@ XWorkArea::XWorkArea(LyXView & owner, int w, int h)
// Hand control of the layout of these widgets to the
// Layout Engine.
XFormsView & xview = dynamic_cast<XFormsView &>(owner);
BoxList & boxlist = xview.getBox(XFormsView::Center).children();
BoxList & boxlist = xview.getBox(XFormsView::Center)->children();
wa_box_ = &boxlist.push_back(Box(0,0));
wa_box_ = boxlist.push_back(Box(0,0));
wa_box_->set(Box::Horizontal);
Box & frame_box = widgets_.add(frame, wa_box_->children(), 0, 0);
frame_box.set(Box::Expand);
shared_ptr<Box> frame_box = widgets_.add(frame, wa_box_->children(), 0, 0);
frame_box->set(Box::Expand);
int const bw = int(abs(fl_get_border_width()));
Box & wa_box = embed(work_area, frame_box.children(), widgets_, bw);
wa_box.set(Box::Expand);
shared_ptr<Box> wa_box = embed(work_area, frame_box->children(), widgets_, bw);
wa_box->set(Box::Expand);
widgets_.add(scrollbar, wa_box_->children(), 17, 0);

View File

@ -88,7 +88,7 @@ private:
/// the current document's height (for scrollbar)
int doc_height_;
///
Box * wa_box_;
boost::shared_ptr<Box> wa_box_;
///
WidgetMap widgets_;
};

View File

@ -12,6 +12,8 @@
#ifndef LYXTEXTCLASSLIST_H
#define LYXTEXTCLASSLIST_H
#include "lyxtextclass.h"
#include "support/types.h"
#include <boost/utility.hpp>
@ -19,7 +21,6 @@
#include <string>
#include <vector>
class LyXTextClass;
class LyXLayout;
/// Reads the style files

View File

@ -1,3 +1,7 @@
2004-11-16 Lars Gullik Bjonnes <larsbj@gullik.net>
* math_inset.h: include math_data.h to satisfy concept checks.
2004-11-15 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* math_hullinset.C (getStatus): typo in lfun argument

View File

@ -13,6 +13,8 @@
#ifndef MATH_INSET_H
#define MATH_INSET_H
#include "math_data.h"
#include "insets/insetbase.h"
#include <string>
@ -52,9 +54,6 @@ class MathUnknownInset;
class RefInset;
class MathArray;
class MathAtom;
class NormalStream;
class OctaveStream;
class MapleStream;

View File

@ -53,6 +53,18 @@ ParIterator & ParIterator::operator++()
}
ParIterator ParIterator::operator++(int)
{
ParIterator tmp(*this);
forwardPar();
return tmp;
}
#if 0
// Unused member functions. Also having this makes ParIterator not be
// an forward iterator anymore. So unless we change that, this function
// should not be compiled/used. (Lgb)
ParIterator & ParIterator::operator--()
{
#ifdef WITH_WARNINGS
@ -61,6 +73,7 @@ ParIterator & ParIterator::operator--()
// DocIterator::backwardPar();
return *this;
}
#endif
Paragraph & ParIterator::operator*() const

View File

@ -31,6 +31,17 @@ class ParIterator : public std::iterator<std::forward_iterator_tag, Paragraph>,
public DocIterator
{
public:
typedef std::iterator<std::forward_iterator_tag, Paragraph> StdIt;
typedef StdIt::value_type value_type;
typedef StdIt::difference_type difference_type;
typedef StdIt::pointer pointer;
typedef StdIt::reference reference;
///
ParIterator() : DocIterator() {}
///
ParIterator(InsetBase &, lyx::par_type pit);
///
@ -43,7 +54,9 @@ public:
///
ParIterator & operator++();
///
ParIterator & operator--();
ParIterator operator++(int);
/// See comment in pariterator.C
//ParIterator & operator--();
///
Paragraph & operator*() const;
///

View File

@ -1,3 +1,10 @@
2004-11-16 Lars Gullik Bjonnes <larsbj@gullik.net>
* forkedcontr.C (find_pid): simplify and also make pass concept
checks.
(handleCompletedProcesses): make sure that we do not slice the
object and satisfy concept checks.
2004-11-09 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* filetools.[Ch] (getFormatFromContents): don't guess format from

View File

@ -225,17 +225,13 @@ void ForkedcallsController::addCall(ForkedProcess const & newcall)
}
ForkedcallsController::iterator ForkedcallsController::find_pid(pid_t pid)
ForkedcallsController::iterator
ForkedcallsController::find_pid(pid_t pid)
{
typedef boost::indirect_iterator<ListType::iterator> iterator;
iterator begin = boost::make_indirect_iterator(forkedCalls.begin());
iterator end = boost::make_indirect_iterator(forkedCalls.end());
iterator it = find_if(begin, end,
return find_if(forkedCalls.begin(), forkedCalls.end(),
bind(equal_to<pid_t>(),
bind(&Forkedcall::pid, _1),
pid));
return it.base();
}
@ -278,17 +274,17 @@ void ForkedcallsController::handleCompletedProcesses()
// Eg, child was run in blocking mode
continue;
ForkedProcess & child = *it->get();
ListType::value_type child = (*it);
bool remove_it = false;
if (WIFEXITED(store.status)) {
// Ok, the return value goes into retval.
child.setRetValue(WEXITSTATUS(store.status));
child->setRetValue(WEXITSTATUS(store.status));
remove_it = true;
} else if (WIFSIGNALED(store.status)) {
// Child died, so pretend it returned 1
child.setRetValue(1);
child->setRetValue(1);
remove_it = true;
} else if (WIFSTOPPED(store.status)) {
@ -299,15 +295,15 @@ void ForkedcallsController::handleCompletedProcesses()
} else {
lyxerr << "LyX: Something rotten happened while "
"waiting for child " << store.pid << endl;
<< "waiting for child " << store.pid << endl;
// Child died, so pretend it returned 1
child.setRetValue(1);
child->setRetValue(1);
remove_it = true;
}
if (remove_it) {
child.emitSignal();
child->emitSignal();
forkedCalls.erase(it);
}
}