[niepce] Remove boost::bind and boost::function to use std::
- From: Hubert Figuière <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [niepce] Remove boost::bind and boost::function to use std::
- Date: Sat, 8 Jun 2013 00:11:55 +0000 (UTC)
commit f65ce8c194537471a207c355afab8a28f0b426b5
Author: Hubert Figuière <hub figuiere net>
Date: Wed Jun 5 22:28:39 2013 -0400
Remove boost::bind and boost::function to use std::
src/engine/library/test_opqueue.cpp | 6 ++--
src/fwk/toolkit/metadatawidget.cpp | 7 +++--
src/fwk/toolkit/notificationcenter.cpp | 4 +-
src/fwk/utils/db/sqlite/sqlitecnxdrv.cpp | 11 ++++-----
src/fwk/utils/modulemanager.cpp | 8 ++++--
src/fwk/utils/testfiles.cpp | 10 +++++---
src/libraryclient/clientimpl.cpp | 37 +++++++++++++++--------------
src/libraryclient/test_worker.cpp | 12 +++++-----
src/niepce/ui/dialogs/importdialog.cpp | 12 +++++----
src/niepce/ui/metadatapanecontroller.cpp | 7 +++--
src/niepce/ui/workspacecontroller.cpp | 17 ++++++++-----
11 files changed, 71 insertions(+), 60 deletions(-)
---
diff --git a/src/engine/library/test_opqueue.cpp b/src/engine/library/test_opqueue.cpp
index 739face..6a09168 100644
--- a/src/engine/library/test_opqueue.cpp
+++ b/src/engine/library/test_opqueue.cpp
@@ -1,7 +1,7 @@
/*
* niepce - library/test_opqueue.cpp
*
- * Copyright (C) 2007-2008 Hubert Figuiere
+ * Copyright (C) 2007-2013 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@
#include "op.hpp"
#include "opqueue.hpp"
-#include <boost/bind.hpp>
+#include <functional>
#include <boost/test/minimal.hpp>
@@ -37,7 +37,7 @@ int test_main(int, char *[])
{
OpQueue q;
- Op::Ptr p(new Op(1, boost::bind(&foo, eng::Library::Ptr())));
+ Op::Ptr p(new Op(1, std::bind(&foo, eng::Library::Ptr())));
BOOST_CHECK(q.empty());
diff --git a/src/fwk/toolkit/metadatawidget.cpp b/src/fwk/toolkit/metadatawidget.cpp
index 6da89ed..0070ba3 100644
--- a/src/fwk/toolkit/metadatawidget.cpp
+++ b/src/fwk/toolkit/metadatawidget.cpp
@@ -1,7 +1,7 @@
/*
* niepce - fwk/toolkit/metadatawidget.cpp
*
- * Copyright (C) 2008-2012 Hubert Figuiere
+ * Copyright (C) 2008-2013 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,9 +19,9 @@
#include <utility>
+#include <functional>
#include <boost/lexical_cast.hpp>
-#include <boost/bind.hpp>
#include <glibmm/i18n.h>
#include <gtkmm/label.h>
#include <gtkmm/entry.h>
@@ -215,8 +215,9 @@ void MetaDataWidget::set_data_source(const fwk::PropertyBag & properties)
DBG_OUT("set data source");
m_current_data = properties;
if(!m_data_map.empty()) {
+ using std::placeholders::_1;
std::for_each(m_data_map.begin(), m_data_map.end(),
- boost::bind(&MetaDataWidget::clear_widget, this, _1));
+ std::bind(&MetaDataWidget::clear_widget, this, _1));
}
set_sensitive(!properties.empty());
if(properties.empty()) {
diff --git a/src/fwk/toolkit/notificationcenter.cpp b/src/fwk/toolkit/notificationcenter.cpp
index 010c4b0..978e7ae 100644
--- a/src/fwk/toolkit/notificationcenter.cpp
+++ b/src/fwk/toolkit/notificationcenter.cpp
@@ -1,7 +1,7 @@
/*
* niepce - fwk/toolkit/notification.cpp
*
- * Copyright (C) 2007-2009 Hubert Figuiere
+ * Copyright (C) 2007-2013 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -58,7 +58,7 @@ void NotificationCenter::subscribe(int type, const subscriber_t & s)
void NotificationCenter::unsubscribe(int /*type*/, const subscriber_t & /*s*/)
{
-// m_subscribers.remove_if(boost::bind(&boost::function_equal, _1, s));
+// m_subscribers.remove_if(std::bind(&boost::function_equal, _1, s));
}
void NotificationCenter::post(const Notification::Ptr & n)
diff --git a/src/fwk/utils/db/sqlite/sqlitecnxdrv.cpp b/src/fwk/utils/db/sqlite/sqlitecnxdrv.cpp
index 490e542..ca47263 100644
--- a/src/fwk/utils/db/sqlite/sqlitecnxdrv.cpp
+++ b/src/fwk/utils/db/sqlite/sqlitecnxdrv.cpp
@@ -1,5 +1,5 @@
/*
- * (c) 2007-2008 Hubert Figuiere
+ * (c) 2007-2013 Hubert Figuiere
*
***********************************************************
*This file was part of the Nemiver Project.
@@ -31,8 +31,7 @@
#include <string.h>
#include <string>
#include <list>
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
+#include <functional>
#include <sqlite3.h>
#include "fwk/utils/exception.hpp"
@@ -126,7 +125,7 @@ namespace db { namespace sqlite {
//the result of the last sqlite3_step() function, or -333
int last_execution_result ;
- std::list<boost::function<void (void)> > userfunctions;
+ std::list<std::function<void (void)> > userfunctions;
Priv():
sqlite(NULL),
@@ -346,8 +345,8 @@ namespace db { namespace sqlite {
void wrapper(sqlite3_context* ctx, int, sqlite3_value**)
{
- boost::function<void (void)> *f;
- f = (boost::function<void (void)>*)sqlite3_user_data(ctx);
+ std::function<void (void)> *f;
+ f = (std::function<void (void)>*)sqlite3_user_data(ctx);
(*f)();
}
diff --git a/src/fwk/utils/modulemanager.cpp b/src/fwk/utils/modulemanager.cpp
index 5f3276b..045d203 100644
--- a/src/fwk/utils/modulemanager.cpp
+++ b/src/fwk/utils/modulemanager.cpp
@@ -3,7 +3,7 @@
* copied from
* gnote
*
- * Copyright (C) 2009 Hubert Figuiere
+ * Copyright (C) 2009-2013 Hubert Figuiere
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -28,7 +28,7 @@
#include <dlfcn.h>
-#include <boost/bind.hpp>
+#include <functional>
#include <gmodule.h>
#include <glibmm/module.h>
@@ -61,13 +61,15 @@ namespace fwk {
void ModuleManager::load_modules()
{
+ using std::placeholders::_1;
+
std::string ext = std::string(".") + G_MODULE_SUFFIX;
for(std::set<std::string>::const_iterator iter = m_dirs.begin();
iter != m_dirs.end(); ++iter) {
fwk::FileList::Ptr l;
- l = FileList::getFilesFromDirectory(*iter, boost::bind(&fwk::filter_ext, _1, ext));
+ l = FileList::getFilesFromDirectory(*iter, std::bind(&fwk::filter_ext, _1, ext));
for(FileList::const_iterator mod_iter = l->begin();
mod_iter != l->end(); ++mod_iter) {
diff --git a/src/fwk/utils/testfiles.cpp b/src/fwk/utils/testfiles.cpp
index a875da4..87ae13f 100644
--- a/src/fwk/utils/testfiles.cpp
+++ b/src/fwk/utils/testfiles.cpp
@@ -1,7 +1,7 @@
/*
* niepce - utils/testfiles.cpp
*
- * Copyright (C) 2007 Hubert Figuiere
+ * Copyright (C) 2007-2013 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,8 +18,9 @@
*/
/** @brief unit test for files */
+#include <functional>
+
#include <boost/test/minimal.hpp>
-#include <boost/bind.hpp>
#include <stdlib.h>
@@ -27,6 +28,7 @@
#include "init.hpp"
using fwk::FileList;
+using std::placeholders::_1;
int test_main( int, char *[] ) // note the name!
{
@@ -39,10 +41,10 @@ int test_main( int, char *[] ) // note the name!
FileList::Ptr files;
- files = FileList::getFilesFromDirectory( "foo", boost::bind(fwk::filter_none, _1) );
+ files = FileList::getFilesFromDirectory( "foo", std::bind(fwk::filter_none, _1) );
BOOST_CHECK( !files );
- files = FileList::getFilesFromDirectory( "AAtest", boost::bind(fwk::filter_none, _1));
+ files = FileList::getFilesFromDirectory( "AAtest", std::bind(fwk::filter_none, _1));
BOOST_CHECK( files );
BOOST_CHECK( files->size() == 3 );
diff --git a/src/libraryclient/clientimpl.cpp b/src/libraryclient/clientimpl.cpp
index 4ed1884..f808f8d 100644
--- a/src/libraryclient/clientimpl.cpp
+++ b/src/libraryclient/clientimpl.cpp
@@ -1,7 +1,7 @@
/*
* niepce - libraryclient/clientimpl.cpp
*
- * Copyright (C) 2007-2009 Hubert Figuiere
+ * Copyright (C) 2007-2013 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <boost/bind.hpp>
+#include <functional>
#include "fwk/base/debug.hpp"
#include "fwk/utils/files.hpp"
@@ -31,9 +31,10 @@ using fwk::FileList;
using eng::Op;
using eng::Commands;
using eng::tid_t;
+using std::placeholders::_1;
namespace libraryclient {
-
+
ClientImpl *ClientImpl::makeClientImpl(const fwk::Moniker & moniker,
const fwk::NotificationCenter::Ptr & nc)
{
@@ -57,7 +58,7 @@ ClientImpl::~ClientImpl()
tid_t ClientImpl::getAllKeywords()
{
tid_t id = LibraryClient::newTid();
- Op::Ptr op(new Op(id, boost::bind(&Commands::cmdListAllKeywords, _1)));
+ Op::Ptr op(new Op(id, std::bind(&Commands::cmdListAllKeywords, _1)));
m_localLibrary->schedule(op);
return id;
}
@@ -66,7 +67,7 @@ tid_t ClientImpl::getAllKeywords()
tid_t ClientImpl::getAllFolders()
{
tid_t id = LibraryClient::newTid();
- Op::Ptr op(new Op(id, boost::bind(&Commands::cmdListAllFolders, _1)));
+ Op::Ptr op(new Op(id, std::bind(&Commands::cmdListAllFolders, _1)));
m_localLibrary->schedule(op);
return id;
}
@@ -74,7 +75,7 @@ tid_t ClientImpl::getAllFolders()
tid_t ClientImpl::queryFolderContent(eng::library_id_t folder_id)
{
tid_t id = LibraryClient::newTid();
- Op::Ptr op(new Op(id, boost::bind(&Commands::cmdQueryFolderContent,
+ Op::Ptr op(new Op(id, std::bind(&Commands::cmdQueryFolderContent,
_1, folder_id)));
m_localLibrary->schedule(op);
return id;
@@ -84,7 +85,7 @@ tid_t ClientImpl::queryFolderContent(eng::library_id_t folder_id)
tid_t ClientImpl::countFolder(eng::library_id_t folder_id)
{
tid_t id = LibraryClient::newTid();
- Op::Ptr op(new Op(id, boost::bind(&Commands::cmdCountFolder,
+ Op::Ptr op(new Op(id, std::bind(&Commands::cmdCountFolder,
_1, folder_id)));
m_localLibrary->schedule(op);
return id;
@@ -94,7 +95,7 @@ tid_t ClientImpl::countFolder(eng::library_id_t folder_id)
tid_t ClientImpl::queryKeywordContent(eng::library_id_t keyword_id)
{
tid_t id = LibraryClient::newTid();
- Op::Ptr op(new Op(id, boost::bind(&Commands::cmdQueryKeywordContent,
+ Op::Ptr op(new Op(id, std::bind(&Commands::cmdQueryKeywordContent,
_1, keyword_id)));
m_localLibrary->schedule(op);
return id;
@@ -104,7 +105,7 @@ tid_t ClientImpl::queryKeywordContent(eng::library_id_t keyword_id)
tid_t ClientImpl::requestMetadata(eng::library_id_t file_id)
{
tid_t id = LibraryClient::newTid();
- Op::Ptr op(new Op(id, boost::bind(&Commands::cmdRequestMetadata,
+ Op::Ptr op(new Op(id, std::bind(&Commands::cmdRequestMetadata,
_1, file_id)));
m_localLibrary->schedule(op);
return id;
@@ -114,7 +115,7 @@ tid_t ClientImpl::requestMetadata(eng::library_id_t file_id)
tid_t ClientImpl::setMetadata(eng::library_id_t file_id, int meta, const fwk::PropertyValue & value)
{
tid_t id = LibraryClient::newTid();
- Op::Ptr op(new Op(id, boost::bind(&Commands::cmdSetMetadata, _1,
+ Op::Ptr op(new Op(id, std::bind(&Commands::cmdSetMetadata, _1,
file_id, meta, value)));
m_localLibrary->schedule(op);
return id;
@@ -124,7 +125,7 @@ tid_t ClientImpl::moveFileToFolder(eng::library_id_t file_id, eng::library_id_t
eng::library_id_t to_folder_id)
{
tid_t id = LibraryClient::newTid();
- Op::Ptr op(new Op(id, boost::bind(&Commands::cmdMoveFileToFolder, _1,
+ Op::Ptr op(new Op(id, std::bind(&Commands::cmdMoveFileToFolder, _1,
file_id, from_folder_id, to_folder_id)));
m_localLibrary->schedule(op);
return id;
@@ -134,7 +135,7 @@ tid_t ClientImpl::moveFileToFolder(eng::library_id_t file_id, eng::library_id_t
tid_t ClientImpl::getAllLabels()
{
tid_t id = LibraryClient::newTid();
- Op::Ptr op(new Op(id, boost::bind(&Commands::cmdListAllLabels,
+ Op::Ptr op(new Op(id, std::bind(&Commands::cmdListAllLabels,
_1)));
m_localLibrary->schedule(op);
return id;
@@ -144,7 +145,7 @@ tid_t ClientImpl::getAllLabels()
tid_t ClientImpl::createLabel(const std::string & s, const std::string & color)
{
tid_t id = LibraryClient::newTid();
- Op::Ptr op(new Op(id, boost::bind(&Commands::cmdCreateLabel,
+ Op::Ptr op(new Op(id, std::bind(&Commands::cmdCreateLabel,
_1, s, color)));
m_localLibrary->schedule(op);
return id;
@@ -153,7 +154,7 @@ tid_t ClientImpl::createLabel(const std::string & s, const std::string & color)
tid_t ClientImpl::deleteLabel(int label_id)
{
tid_t id = LibraryClient::newTid();
- Op::Ptr op(new Op(id, boost::bind(&Commands::cmdDeleteLabel,
+ Op::Ptr op(new Op(id, std::bind(&Commands::cmdDeleteLabel,
_1, label_id)));
m_localLibrary->schedule(op);
return id;
@@ -163,7 +164,7 @@ tid_t ClientImpl::updateLabel(eng::library_id_t label_id, const std::string & ne
const std::string & new_color)
{
tid_t id = LibraryClient::newTid();
- Op::Ptr op(new Op(id, boost::bind(&Commands::cmdUpdateLabel,
+ Op::Ptr op(new Op(id, std::bind(&Commands::cmdUpdateLabel,
_1, label_id, new_name, new_color)));
m_localLibrary->schedule(op);
return id;
@@ -173,7 +174,7 @@ tid_t ClientImpl::updateLabel(eng::library_id_t label_id, const std::string & ne
tid_t ClientImpl::processXmpUpdateQueue(bool write_xmp)
{
tid_t id = LibraryClient::newTid();
- Op::Ptr op(new Op(id, boost::bind(&Commands::cmdProcessXmpUpdateQueue,
+ Op::Ptr op(new Op(id, std::bind(&Commands::cmdProcessXmpUpdateQueue,
_1, write_xmp)));
m_localLibrary->schedule(op);
return id;
@@ -185,10 +186,10 @@ tid_t ClientImpl::importFromDirectory(const std::string & dir, bool manage)
FileList::Ptr files;
files = FileList::getFilesFromDirectory(dir,
- boost::bind(&fwk::filter_none, _1));
+ std::bind(&fwk::filter_none, _1));
tid_t id = LibraryClient::newTid();
- Op::Ptr op(new Op(id, boost::bind(&Commands::cmdImportFiles,
+ Op::Ptr op(new Op(id, std::bind(&Commands::cmdImportFiles,
_1, dir, files, manage)));
m_localLibrary->schedule(op);
return id;
diff --git a/src/libraryclient/test_worker.cpp b/src/libraryclient/test_worker.cpp
index 4608c2e..703bcc7 100644
--- a/src/libraryclient/test_worker.cpp
+++ b/src/libraryclient/test_worker.cpp
@@ -1,7 +1,7 @@
/*
* niepce - library/test_worker.cpp
*
- * Copyright (C) 2007-2008 Hubert Figuiere
+ * Copyright (C) 2007-2013 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@
#define BOOST_AUTO_TEST_MAIN
#include "locallibraryserver.hpp"
-#include <boost/bind.hpp>
+#include <functional>
#include <boost/test/minimal.hpp>
@@ -38,7 +38,7 @@ void foo(const Library::Ptr &)
//BOOST_AUTO_TEST_CASE(worker_test)
int test_main(int, char *[])
-{
+{
fwk::utils::init();
char templ[] = "/tmp/niepce-tmpXXXXXX";
@@ -47,10 +47,10 @@ int test_main(int, char *[])
{
fwk::DirectoryDisposer d(ptempl);
LocalLibraryServer w(std::string("") + ptempl, fwk::NotificationCenter::Ptr());
-
+
BOOST_CHECK(w._tasks().empty());
-
- Op::Ptr p(new Op(0, boost::bind(&foo, eng::Library::Ptr())));
+
+ Op::Ptr p(new Op(0, std::bind(&foo, eng::Library::Ptr())));
w.schedule(p);
}
return 0;
diff --git a/src/niepce/ui/dialogs/importdialog.cpp b/src/niepce/ui/dialogs/importdialog.cpp
index 0f423c1..9fd4ccb 100644
--- a/src/niepce/ui/dialogs/importdialog.cpp
+++ b/src/niepce/ui/dialogs/importdialog.cpp
@@ -18,7 +18,7 @@
*/
-#include <boost/bind.hpp>
+#include <functional>
#include <glibmm/i18n.h>
#include <gtkmm/button.h>
@@ -108,15 +108,17 @@ void ImportDialog::do_select_directories()
void ImportDialog::set_to_import(const Glib::ustring & f)
{
+ using std::placeholders::_1;
+
m_folder_path_to_import = f;
m_destinationFolder->set_text(fwk::path_basename(f));
m_directory_name->set_text(f);
//
m_imagesListModel->clear();
- fwk::FileList::Ptr list_to_import
- = fwk::FileList::getFilesFromDirectory(f,
- boost::bind(&fwk::filter_xmp_out, _1));
- for(std::list<std::string>::const_iterator i = list_to_import->begin();
+ fwk::FileList::Ptr list_to_import
+ = fwk::FileList::getFilesFromDirectory(f,
+ std::bind(&fwk::filter_xmp_out, _1));
+ for(auto i = list_to_import->begin();
i != list_to_import->end(); ++i) {
DBG_OUT("selected %s", i->c_str());
Gtk::TreeIter iter = m_imagesListModel->append();
diff --git a/src/niepce/ui/metadatapanecontroller.cpp b/src/niepce/ui/metadatapanecontroller.cpp
index b90a759..df0d3a9 100644
--- a/src/niepce/ui/metadatapanecontroller.cpp
+++ b/src/niepce/ui/metadatapanecontroller.cpp
@@ -1,7 +1,7 @@
/*
* niepce - niepce/ui/metadatapanecontroller.cpp
*
- * Copyright (C) 2008-2009 Hubert Figuiere
+ * Copyright (C) 2008-2013 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <boost/bind.hpp>
+#include <functional>
#include <glibmm/i18n.h>
#include <gtkmm/label.h>
@@ -155,8 +155,9 @@ void MetaDataPaneController::display(eng::library_id_t file_id, const eng::LibMe
const fwk::PropertySet & propset = get_property_set();
meta->to_properties(propset, properties);
}
+ using std::placeholders::_1;
std::for_each(m_widgets.begin(), m_widgets.end(),
- boost::bind(&fwk::MetaDataWidget::set_data_source,
+ std::bind(&fwk::MetaDataWidget::set_data_source,
_1, properties));
}
diff --git a/src/niepce/ui/workspacecontroller.cpp b/src/niepce/ui/workspacecontroller.cpp
index 43bbdbd..cd99210 100644
--- a/src/niepce/ui/workspacecontroller.cpp
+++ b/src/niepce/ui/workspacecontroller.cpp
@@ -1,7 +1,7 @@
/*
* niepce - ui/workspacecontroller.cpp
*
- * Copyright (C) 2007-2009 Hubert Figuiere
+ * Copyright (C) 2007-2013 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,8 +17,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <functional>
+
#include <boost/any.hpp>
-#include <boost/bind.hpp>
#include <glibmm/i18n.h>
@@ -77,15 +78,17 @@ libraryclient::LibraryClient::Ptr WorkspaceController::getLibraryClient()
void WorkspaceController::on_lib_notification(const eng::LibNotification &ln)
{
+ using std::placeholders::_1;
+
DBG_OUT("notification for workspace");
switch(ln.type) {
case eng::Library::NOTIFY_ADDED_FOLDERS:
{
- eng::LibFolder::ListPtr l
+ eng::LibFolder::ListPtr l
= boost::any_cast<eng::LibFolder::ListPtr>(ln.param);
DBG_OUT("received added folders # %lu", l->size());
- for_each(l->begin(), l->end(),
- boost::bind(&WorkspaceController::add_folder_item,
+ for_each(l->begin(), l->end(),
+ std::bind(&WorkspaceController::add_folder_item,
this, _1));
break;
}
@@ -102,8 +105,8 @@ void WorkspaceController::on_lib_notification(const eng::LibNotification &ln)
eng::Keyword::ListPtr l
= boost::any_cast<eng::Keyword::ListPtr>(ln.param);
DBG_ASSERT(static_cast<bool>(l), "keyword list must not be NULL");
- for_each(l->begin(), l->end(),
- boost::bind(&WorkspaceController::add_keyword_item,
+ for_each(l->begin(), l->end(),
+ std::bind(&WorkspaceController::add_keyword_item,
this, _1));
break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]