Using "using namespace std" with msvc10 makes also std::tr1::bind visible and generates conflicts with boost::bind.

Solution: don't use boost::bind for msvc10 (could also be extended  to several GCC versions)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34257 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Peter Kümmel 2010-04-22 11:16:58 +00:00
parent 566a95224e
commit 61b2bd5e7f
28 changed files with 106 additions and 61 deletions

View File

@ -102,7 +102,7 @@
#include "support/textutils.h"
#include "support/types.h"
#include <boost/bind.hpp>
#include "support/bind.h"
#include <boost/shared_ptr.hpp>
#include <algorithm>
@ -1656,7 +1656,7 @@ void Buffer::validate(LaTeXFeatures & features) const
updateMacros();
for_each(paragraphs().begin(), paragraphs().end(),
boost::bind(&Paragraph::validate, _1, boost::ref(features)));
bind(&Paragraph::validate, _1, boost::ref(features)));
if (lyxerr.debugging(Debug::LATEX)) {
features.showStruct();

View File

@ -32,12 +32,12 @@
#include "support/Package.h"
#include "support/lassert.h"
#include <boost/bind.hpp>
#include "support/bind.h"
#include <algorithm>
#include <functional>
using boost::bind;
using namespace std;
using namespace lyx::support;
@ -142,7 +142,7 @@ FileNameList const & BufferList::fileNames() const
nvec.clear();
transform(bstore.begin(), bstore.end(),
back_inserter(nvec),
boost::bind(&Buffer::fileName, _1));
bind(&Buffer::fileName, _1));
return nvec;
}

View File

@ -49,7 +49,7 @@
#include "mathed/MathData.h"
#include "mathed/MathMacro.h"
#include <boost/bind.hpp>
#include "support/bind.h"
#include <sstream>
#include <limits>
@ -1281,7 +1281,7 @@ void Cursor::plainInsert(MathAtom const & t)
void Cursor::insert(docstring const & str)
{
for_each(str.begin(), str.end(),
boost::bind(static_cast<void(Cursor::*)(char_type)>
bind(static_cast<void(Cursor::*)(char_type)>
(&Cursor::insert), this, _1));
}

View File

@ -27,7 +27,7 @@
#include "support/lassert.h"
#include "support/lstrings.h"
#include <boost/bind.hpp>
#include "support/bind.h"
#include <boost/regex.hpp>
#include <fstream>
@ -37,7 +37,7 @@ using namespace lyx::support;
namespace lyx {
using boost::bind;
using boost::regex;
using boost::smatch;

View File

@ -62,7 +62,7 @@
#include "support/Path.h"
#include "support/Systemcall.h"
#include <boost/bind.hpp>
#include "support/bind.h"
#include <boost/scoped_ptr.hpp>
#include <algorithm>
@ -484,7 +484,7 @@ bool LyX::loadFiles()
ErrorList const & el = buf->errorList("Parse");
if (!el.empty())
for_each(el.begin(), el.end(),
boost::bind(&LyX::printError, this, _1));
bind(&LyX::printError, this, _1));
}
else {
pimpl_->buffer_list_.release(buf);

View File

@ -47,7 +47,7 @@
#include "support/lstrings.h"
#include "support/textutils.h"
#include <boost/bind.hpp>
#include "support/bind.h"
#include <boost/crc.hpp>
#include <algorithm>

View File

@ -55,7 +55,7 @@
#include "support/lstrings.h"
#include "support/os.h"
#include <boost/bind.hpp>
#include "support/bind.h"
#ifdef _WIN32
#include <QCoreApplication>
@ -840,7 +840,7 @@ int LyXComm::startPipe(string const & file, bool write)
if (!write) {
theApp()->registerSocketCallback(fd,
boost::bind(&LyXComm::read_ready, this));
bind(&LyXComm::read_ready, this));
}
return fd;

View File

@ -28,7 +28,7 @@
#include "support/FileName.h"
#include "support/socktools.h"
#include <boost/bind.hpp>
#include "support/bind.h"
#include <cerrno>
#include <ostream>
@ -64,7 +64,7 @@ ServerSocket::ServerSocket(FileName const & addr)
theApp()->registerSocketCallback(
fd_,
boost::bind(&ServerSocket::serverCallback, this)
bind(&ServerSocket::serverCallback, this)
);
LYXERR(Debug::LYXSERVER, "lyx: New server socket "
@ -115,7 +115,7 @@ void ServerSocket::serverCallback()
shared_ptr<LyXDataSocket>(new LyXDataSocket(client_fd));
theApp()->registerSocketCallback(
client_fd,
boost::bind(&ServerSocket::dataCallback,
bind(&ServerSocket::dataCallback,
this, client_fd)
);
}

View File

@ -124,7 +124,7 @@
#include <objidl.h>
#endif // Q_WS_WIN
#include <boost/bind.hpp>
#include "support/bind.h"
#include <boost/crc.hpp>
#include <exception>

View File

@ -118,7 +118,7 @@
#include <QtConcurrentRun>
#endif
#include <boost/bind.hpp>
#include "support/bind.h"
#include <sstream>
@ -393,7 +393,7 @@ GuiView::GuiView(int id)
// Start autosave timer
if (lyxrc.autosave) {
d.autosave_timeout_.timeout.connect(boost::bind(&GuiView::autoSave, this));
d.autosave_timeout_.timeout.connect(bind(&GuiView::autoSave, this));
d.autosave_timeout_.setTimeout(lyxrc.autosave * 1000);
d.autosave_timeout_.start();
}

View File

@ -68,7 +68,7 @@
#include <QToolTip>
#include <QMenuBar>
#include <boost/bind.hpp>
#include "support/bind.h"
#include <cmath>
@ -296,7 +296,7 @@ void GuiWorkArea::init()
viewport()->setCursor(Qt::IBeamCursor);
synthetic_mouse_event_.timeout.timeout.connect(
boost::bind(&GuiWorkArea::generateSyntheticMouseEvent,
bind(&GuiWorkArea::generateSyntheticMouseEvent,
this));
// Initialize the vertical Scroll Bar

View File

@ -23,7 +23,7 @@
#include "support/gettext.h"
#include "support/lstrings.h"
#include <boost/bind.hpp>
#include "support/bind.h"
#include <algorithm>

View File

@ -26,7 +26,7 @@
#include "support/filetools.h"
#include "support/FileMonitor.h"
#include <boost/bind.hpp>
#include "support/bind.h"
using namespace std;
using namespace lyx::support;
@ -208,7 +208,7 @@ CacheItem::Impl::Impl(FileName const & file)
remove_loaded_file_(false),
status_(WaitingToLoad)
{
monitor_.connect(boost::bind(&Impl::startLoading, this));
monitor_.connect(bind(&Impl::startLoading, this));
}
@ -428,7 +428,7 @@ void CacheItem::Impl::convertToDisplayFormat()
// the graphics converter so that we can load the modified file
// on completion of the conversion process.
converter_.reset(new Converter(filename, to_file_base.absFileName(), from, to_));
converter_->connect(boost::bind(&Impl::imageConverted, this, _1));
converter_->connect(bind(&Impl::imageConverted, this, _1));
converter_->startConversion();
}

View File

@ -24,7 +24,7 @@
#include "support/lstrings.h"
#include "support/os.h"
#include <boost/bind.hpp>
#include "support/bind.h"
#include <sstream>
#include <fstream>
@ -178,7 +178,7 @@ void Converter::Impl::startConversion()
ForkedCall::SignalTypePtr ptr =
ForkedCallQueue::add(script_command_);
ptr->connect(boost::bind(&Impl::converted, this, _1, _2));
ptr->connect(bind(&Impl::converted, this, _1, _2));
}

View File

@ -20,7 +20,7 @@
#include "support/debug.h"
#include "support/Timeout.h"
#include <boost/bind.hpp>
#include "support/bind.h"
#include <set>
#include <queue>
@ -107,7 +107,7 @@ void LoaderQueue::loadNext()
LoaderQueue::LoaderQueue() : timer(s_millisecs_, Timeout::ONETIME),
running_(false)
{
timer.timeout.connect(boost::bind(&LoaderQueue::loadNext, this));
timer.timeout.connect(bind(&LoaderQueue::loadNext, this));
}
@ -388,7 +388,7 @@ void Loader::Impl::resetFile(FileName const & file)
if (continue_monitoring && !cached_item_->monitoring())
cached_item_->startMonitoring();
sc_ = cached_item_->connect(boost::bind(&Impl::statusChanged, this));
sc_ = cached_item_->connect(bind(&Impl::statusChanged, this));
}

View File

@ -17,7 +17,7 @@
#include "support/FileName.h"
#include <boost/bind.hpp>
#include "support/bind.h"
using namespace std;
using namespace lyx::support;
@ -97,7 +97,7 @@ PreviewImage::Impl::Impl(PreviewImage & p, PreviewLoader & l,
: parent_(p), ploader_(l), iloader_(bf),
snippet_(s), ascent_frac_(af)
{
iloader_.connect(boost::bind(&Impl::statusChanged, this));
iloader_.connect(bind(&Impl::statusChanged, this));
}

View File

@ -37,7 +37,7 @@
#include "support/ForkedCalls.h"
#include "support/lstrings.h"
#include <boost/bind.hpp>
#include "support/bind.h"
#include <sstream>
#include <fstream>
@ -46,7 +46,7 @@
using namespace std;
using namespace lyx::support;
using boost::bind;
namespace {

View File

@ -9,9 +9,11 @@
*
* Full author contact details are available in file CREDITS.
*/
#if 1
#include <config.h>
#include "InsetBox.h"
#include "Buffer.h"
@ -37,6 +39,7 @@
#include <sstream>
using namespace std;
using namespace lyx::support;
@ -272,6 +275,7 @@ int InsetBox::latex(odocstream & os, OutputParams const & runparams) const
if (stdwidth)
os << "\\noindent";
switch (btype) {
case Frameless:
break;
@ -286,14 +290,14 @@ int InsetBox::latex(odocstream & os, OutputParams const & runparams) const
// Special widths, see usrguide §3.5
// FIXME UNICODE
if (params_.special != "none") {
os << "[" << params_.width.value()
os << "["/* << params_.width.value()*/ << (double) 1
<< '\\' << from_utf8(params_.special)
<< ']';
} else
} /*else
os << '[' << from_ascii(width_string)
<< ']';
if (params_.hor_pos != 'c')
os << "[" << params_.hor_pos << "]";
os << "[" << params_.hor_pos << "]";*/
}
os << "{";
@ -314,7 +318,7 @@ int InsetBox::latex(odocstream & os, OutputParams const & runparams) const
os << "\\doublebox{";
break;
}
#if 0
if (params_.inner_box) {
if (params_.use_parbox)
os << "\\parbox";
@ -392,9 +396,11 @@ int InsetBox::latex(odocstream & os, OutputParams const & runparams) const
i += 2;
return i;
#endif
return 1;
}
#else
int InsetBox::plaintext(odocstream & os, OutputParams const & runparams) const
{
BoxType const btype = boxtranslator().find(params_.type);
@ -610,5 +616,6 @@ void InsetBoxParams::read(Lexer & lex)
lex >> "height_special" >> height_special;
}
#endif
} // namespace lyx

View File

@ -45,7 +45,7 @@
#include "support/lyxlib.h"
#include "support/Translator.h"
#include <boost/bind.hpp>
#include "support/bind.h"
#include <sstream>
@ -571,7 +571,7 @@ void InsetExternal::setParams(InsetExternalParams const & p)
RenderMonitoredPreview * preview_ptr = renderer_->asMonitoredPreview();
renderer_.reset(new RenderMonitoredPreview(this));
preview_ptr = renderer_->asMonitoredPreview();
preview_ptr->fileChanged(boost::bind(&InsetExternal::fileChanged, this));
preview_ptr->fileChanged(bind(&InsetExternal::fileChanged, this));
if (preview_ptr->monitoring())
preview_ptr->stopMonitoring();
add_preview_and_start_loading(*preview_ptr, *this, buffer());

View File

@ -57,7 +57,7 @@
#include "support/lstrings.h" // contains
#include "support/lyxalgo.h"
#include <boost/bind.hpp>
#include "support/bind.h"
using namespace std;
using namespace lyx::support;
@ -164,7 +164,7 @@ InsetInclude::InsetInclude(Buffer * buf, InsetCommandParams const & p)
preview_(new RenderMonitoredPreview(this)), failedtoload_(false),
set_label_(false), label_(0), child_buffer_(0)
{
preview_->fileChanged(boost::bind(&InsetInclude::fileChanged, this));
preview_->fileChanged(bind(&InsetInclude::fileChanged, this));
if (isListings(params())) {
InsetListingsParams listing_params(to_utf8(p["lstparams"]));
@ -178,7 +178,7 @@ InsetInclude::InsetInclude(InsetInclude const & other)
preview_(new RenderMonitoredPreview(this)), failedtoload_(false),
set_label_(false), label_(0), child_buffer_(0)
{
preview_->fileChanged(boost::bind(&InsetInclude::fileChanged, this));
preview_->fileChanged(bind(&InsetInclude::fileChanged, this));
if (other.label_)
label_ = new InsetLabel(*other.label_);

View File

@ -58,14 +58,12 @@
#include "support/gettext.h"
#include "support/lstrings.h"
#include <boost/bind.hpp>
#include "support/bind.h"
#include "support/lassert.h"
using namespace std;
using namespace lyx::support;
using boost::bind;
using boost::ref;
namespace lyx {

View File

@ -27,7 +27,7 @@
#include "support/filetools.h"
#include "support/gettext.h"
#include <boost/bind.hpp>
#include "support/bind.h"
using namespace std;
@ -36,14 +36,14 @@ namespace lyx {
RenderGraphic::RenderGraphic(Inset const * inset)
{
loader_.connect(boost::bind(&Inset::updateFrontend, inset));
loader_.connect(bind(&Inset::updateFrontend, inset));
}
RenderGraphic::RenderGraphic(RenderGraphic const & other, Inset const * inset)
: RenderBase(other), loader_(other.loader_), params_(other.params_)
{
loader_.connect(boost::bind(&Inset::updateFrontend, inset));
loader_.connect(bind(&Inset::updateFrontend, inset));
}

View File

@ -31,7 +31,7 @@
#include "support/lassert.h"
#include "support/lstrings.h"
#include <boost/bind.hpp>
#include "support/bind.h"
using namespace std;
using namespace lyx::support;
@ -216,7 +216,7 @@ void RenderPreview::addPreview(docstring const & latex_snippet,
// is ready for loading.
if (!ploader_connection_.connected()) {
ploader_connection_ = ploader.connect(
boost::bind(&RenderPreview::imageReady, this, _1));
bind(&RenderPreview::imageReady, this, _1));
}
ploader.add(snippet_);

View File

@ -42,6 +42,7 @@ using namespace std;
using namespace lyx::support;
namespace lyx {
static docstring verboseHLine(int n)

View File

@ -15,7 +15,7 @@
#include "support/FileName.h"
#include "support/Timeout.h"
#include <boost/bind.hpp>
#include "support/bind.h"
#include <boost/signals/trackable.hpp>
using namespace std;
@ -145,7 +145,7 @@ FileMonitor::Impl::Impl(FileName const & file_with_path, int interval)
timestamp_(0),
checksum_(0)
{
timer_.timeout.connect(boost::bind(&Impl::monitorFile, this));
timer_.timeout.connect(bind(&Impl::monitorFile, this));
}

View File

@ -21,7 +21,7 @@
#include "support/os.h"
#include "support/Timeout.h"
#include <boost/bind.hpp>
#include "support/bind.h"
#include <cerrno>
#include <queue>
@ -46,7 +46,7 @@
using namespace std;
using boost::bind;
namespace lyx {
namespace support {
@ -84,7 +84,7 @@ private:
Murder(int secs, pid_t pid)
: timeout_(1000*secs, Timeout::ONETIME), pid_(pid)
{
timeout_.timeout.connect(boost::bind(&Murder::kill, this));
timeout_.timeout.connect(bind(&Murder::kill, this));
timeout_.start();
}
@ -442,7 +442,7 @@ void callNext()
Process pro = callQueue_.front();
callQueue_.pop();
// Bind our chain caller
pro.second->connect(boost::bind(&ForkedCallQueue::callback, _1, _2));
pro.second->connect(bind(&ForkedCallQueue::callback, _1, _2));
ForkedCall call;
//If we fail to fork the process, then emit the signal
//to tell the outside world that it failed.

34
src/support/bind.h Normal file
View File

@ -0,0 +1,34 @@
// -*- C++ -*-
/**
* \file bind.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Peter Kümmel
*
* Full author contact details are available in file CREDITS.
*/
#ifndef LYX_BIND_H
#define LYX_BIND_H
#if defined(_MSC_VER) && (_MSC_VER >= 1600)
#include <functional>
using std::tr1::bind;
using std::tr1::placeholders::_1;
using std::tr1::placeholders::_2;
using std::tr1::ref;
#else
#include "support/bind.h"
using boost::bind;
using boost::_1;
using boost::_2;
using boost::ref;
#endif
#endif

View File

@ -54,6 +54,7 @@ public:
/// File stream for writing files in 8bit encoding \p encoding with automatic
/// conversion from UCS4.
class ofdocstream : public std::basic_ofstream<char_type> {
typedef std::basic_ofstream<char_type> base;
public:
@ -66,6 +67,10 @@ public:
void reset(std::string const & encoding);
};
extern template class std::numpunct<lyx::char_type>;
extern template class std::basic_ofstream<char_type>;
/// UCS4 input stringstream
typedef std::basic_istringstream<char_type> idocstringstream;