summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2018-04-14 15:59:31 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2018-04-14 15:59:31 +0100
commitd31636a127ce81dcf3af40ae3832e0adbb3e8d56 (patch)
tree0940dabf604978262ef9e078d6f3988df2558fbc
parentIce 3.7 (diff)
downloadslicer-d31636a127ce81dcf3af40ae3832e0adbb3e8d56.tar.bz2
slicer-d31636a127ce81dcf3af40ae3832e0adbb3e8d56.tar.xz
slicer-d31636a127ce81dcf3af40ae3832e0adbb3e8d56.zip
C++17
Remove more references to boost things now in std
-rw-r--r--slicer/db/sqlInsertSerializer.cpp12
-rw-r--r--slicer/db/sqlTablePatchSerializer.cpp4
-rw-r--r--slicer/db/sqlUpdateSerializer.cpp8
-rw-r--r--slicer/ice/testSpecifics.cpp2
-rw-r--r--slicer/json/serializer.cpp26
-rw-r--r--slicer/slicer/metadata.cpp4
-rw-r--r--slicer/slicer/metadata.h4
-rw-r--r--slicer/slicer/modelParts.h8
-rw-r--r--slicer/slicer/modelPartsTypes.cpp1
-rw-r--r--slicer/slicer/modelPartsTypes.h2
-rw-r--r--slicer/slicer/modelPartsTypes.impl.h8
-rw-r--r--slicer/test/compilation.cpp6
-rw-r--r--slicer/test/conversions.h3
-rw-r--r--slicer/test/serializers.cpp23
-rw-r--r--slicer/tool/parser.cpp7
-rw-r--r--slicer/tool/parser.h3
-rw-r--r--slicer/xml/serializer.cpp36
-rw-r--r--slicer/xml/serializer.h2
18 files changed, 83 insertions, 76 deletions
diff --git a/slicer/db/sqlInsertSerializer.cpp b/slicer/db/sqlInsertSerializer.cpp
index 9647847..90f97bb 100644
--- a/slicer/db/sqlInsertSerializer.cpp
+++ b/slicer/db/sqlInsertSerializer.cpp
@@ -7,9 +7,11 @@
#include <modifycommand.h>
#include <slicer/metadata.h>
#include <boost/numeric/conversion/cast.hpp>
-#include <boost/bind.hpp>
+#include <functional>
namespace Slicer {
+ using namespace std::placeholders;
+
SqlInsertSerializer::SqlInsertSerializer(DB::Connection * const c, const std::string & t) :
connection(c),
tableName(t)
@@ -21,10 +23,10 @@ namespace Slicer {
{
switch (mp->GetType()) {
case Slicer::mpt_Sequence:
- mp->OnEachChild(boost::bind(&SqlInsertSerializer::SerializeSequence, this, _2));
+ mp->OnEachChild(std::bind(&SqlInsertSerializer::SerializeSequence, this, _2));
return;
case Slicer::mpt_Complex:
- mp->OnEachChild(boost::bind(&SqlInsertSerializer::SerializeObject, this, _2));
+ mp->OnEachChild(std::bind(&SqlInsertSerializer::SerializeObject, this, _2));
return;
default:
throw UnsupportedModelType();
@@ -51,7 +53,7 @@ namespace Slicer {
SqlInsertSerializer::bindObjectAndExecute(Slicer::ModelPartPtr cmp, DB::ModifyCommand * ins) const
{
int paramNo = 0;
- cmp->OnEachChild(boost::bind(&SqlInsertSerializer::bindObjectAndExecuteField, this, boost::ref(paramNo), ins, _2, _3));
+ cmp->OnEachChild(std::bind(&SqlInsertSerializer::bindObjectAndExecuteField, this, std::ref(paramNo), ins, _2, _3));
ins->execute();
}
@@ -118,7 +120,7 @@ namespace Slicer {
AdHoc::Buffer insert;
insert.appendbf("INSERT INTO %s(", tableName);
int fieldNo = 0;
- mp->OnEachChild(boost::bind(&SqlInsertSerializer::createInsertField, this, boost::ref(fieldNo), boost::ref(insert), _1, _3));
+ mp->OnEachChild(std::bind(&SqlInsertSerializer::createInsertField, this, std::ref(fieldNo), std::ref(insert), _1, _3));
insert.append(") VALUES (", AdHoc::Buffer::Use);
for (; fieldNo > 1; --fieldNo) {
insert.append("?, ");
diff --git a/slicer/db/sqlTablePatchSerializer.cpp b/slicer/db/sqlTablePatchSerializer.cpp
index 08aa14d..a83357f 100644
--- a/slicer/db/sqlTablePatchSerializer.cpp
+++ b/slicer/db/sqlTablePatchSerializer.cpp
@@ -4,7 +4,7 @@
#include <slicer/metadata.h>
#include <compileTimeFormatter.h>
#include <scopeExit.h>
-#include <boost/bind.hpp>
+#include <functional>
namespace Slicer {
AdHocFormatter(ttname, "slicer_tmp_%?");
@@ -26,7 +26,7 @@ namespace Slicer {
tablePatch.cols.clear();
createTemporaryTable();
- AdHoc::ScopeExit tidy(boost::bind(&SqlTablePatchSerializer::dropTemporaryTable, this));
+ AdHoc::ScopeExit tidy(std::bind(&SqlTablePatchSerializer::dropTemporaryTable, this));
SqlInsertSerializer ins(db, tablePatch.src);
ins.Serialize(mpr);
diff --git a/slicer/db/sqlUpdateSerializer.cpp b/slicer/db/sqlUpdateSerializer.cpp
index c322ef1..7629573 100644
--- a/slicer/db/sqlUpdateSerializer.cpp
+++ b/slicer/db/sqlUpdateSerializer.cpp
@@ -6,9 +6,11 @@
#include <buffer.h>
#include <modifycommand.h>
#include <slicer/metadata.h>
-#include <boost/bind.hpp>
+#include <functional>
namespace Slicer {
+ using namespace std::placeholders;
+
SqlUpdateSerializer::SqlUpdateSerializer(DB::Connection * const c, const std::string & t) :
connection(c),
tableName(t)
@@ -20,10 +22,10 @@ namespace Slicer {
{
switch (mp->GetType()) {
case Slicer::mpt_Sequence:
- mp->OnEachChild(boost::bind(&SqlUpdateSerializer::SerializeSequence, this, _2));
+ mp->OnEachChild(std::bind(&SqlUpdateSerializer::SerializeSequence, this, _2));
return;
case Slicer::mpt_Complex:
- mp->OnEachChild(boost::bind(&SqlUpdateSerializer::SerializeObject, this, _2));
+ mp->OnEachChild(std::bind(&SqlUpdateSerializer::SerializeObject, this, _2));
return;
default:
throw UnsupportedModelType();
diff --git a/slicer/ice/testSpecifics.cpp b/slicer/ice/testSpecifics.cpp
index d45cf2c..9832352 100644
--- a/slicer/ice/testSpecifics.cpp
+++ b/slicer/ice/testSpecifics.cpp
@@ -21,7 +21,7 @@ testCompare(const X & x)
template<typename X>
void
-testCompare(const X & x, const boost::function<bool(const X &, const X &)> & cmp)
+testCompare(const X & x, const std::function<bool(const X &, const X &)> & cmp)
{
BOOST_TEST_CHECKPOINT(typeid(X).name());
std::stringstream strm;
diff --git a/slicer/json/serializer.cpp b/slicer/json/serializer.cpp
index 2145d17..bf0af58 100644
--- a/slicer/json/serializer.cpp
+++ b/slicer/json/serializer.cpp
@@ -2,7 +2,7 @@
#include <slicer/metadata.h>
#include <jsonpp.h>
#include <boost/lexical_cast.hpp>
-#include <boost/bind.hpp>
+#include <functional>
#include <stdexcept>
#include <fstream>
#include <glibmm/ustring.h>
@@ -21,6 +21,8 @@ namespace Slicer {
const std::string keyName = "key";
const std::string valueName = "value";
+ using namespace std::placeholders;
+
class JsonValueSource : public ValueSource {
public:
JsonValueSource(const json::Value & s) :
@@ -242,21 +244,21 @@ namespace Slicer {
mp = mp->GetSubclassModelPart(*typeId);
}
}
- mp->OnEachChild(boost::bind(&JsonSerializer::ModelTreeIterate, boost::get<json::Object>(*n).insert({name, nn}).first->second.get(), _1, _2));
+ mp->OnEachChild(std::bind(&JsonSerializer::ModelTreeIterate, boost::get<json::Object>(*n).insert({name, nn}).first->second.get(), _1, _2));
}
break;
case mpt_Sequence:
if (mp->HasValue()) {
- mp->OnEachChild(boost::bind(&JsonSerializer::ModelTreeIterateSeq, boost::get<json::Object>(*n).insert({name, json::ValuePtr(new json::Value(json::Array()))}).first->second.get(), _2));
+ mp->OnEachChild(std::bind(&JsonSerializer::ModelTreeIterateSeq, boost::get<json::Object>(*n).insert({name, json::ValuePtr(new json::Value(json::Array()))}).first->second.get(), _2));
}
break;
case mpt_Dictionary:
if (mp->HasValue()) {
if (metaDataFlagSet(mp->GetMetadata(), md_object)) {
- mp->OnEachChild(boost::bind(&JsonSerializer::ModelTreeIterateDictObj, boost::get<json::Object>(*n).insert({name, json::ValuePtr(new json::Value(json::Object()))}).first->second.get(), _2));
+ mp->OnEachChild(std::bind(&JsonSerializer::ModelTreeIterateDictObj, boost::get<json::Object>(*n).insert({name, json::ValuePtr(new json::Value(json::Object()))}).first->second.get(), _2));
}
else {
- mp->OnEachChild(boost::bind(&JsonSerializer::ModelTreeIterateSeq, boost::get<json::Object>(*n).insert({name, json::ValuePtr(new json::Value(json::Array()))}).first->second.get(), _2));
+ mp->OnEachChild(std::bind(&JsonSerializer::ModelTreeIterateSeq, boost::get<json::Object>(*n).insert({name, json::ValuePtr(new json::Value(json::Array()))}).first->second.get(), _2));
}
}
break;
@@ -282,20 +284,20 @@ namespace Slicer {
mp = mp->GetSubclassModelPart(*typeId);
}
}
- mp->OnEachChild(boost::bind(&JsonSerializer::ModelTreeIterate, n, _1, _2));
+ mp->OnEachChild(std::bind(&JsonSerializer::ModelTreeIterate, n, _1, _2));
break;
case mpt_Sequence:
*n = json::Array();
- mp->OnEachChild(boost::bind(&JsonSerializer::ModelTreeIterateSeq, n, _2));
+ mp->OnEachChild(std::bind(&JsonSerializer::ModelTreeIterateSeq, n, _2));
break;
case mpt_Dictionary:
if (metaDataFlagSet(mp->GetMetadata(), md_object)) {
*n = json::Object();
- mp->OnEachChild(boost::bind(&JsonSerializer::ModelTreeIterateDictObj, n, _2));
+ mp->OnEachChild(std::bind(&JsonSerializer::ModelTreeIterateDictObj, n, _2));
}
else {
*n = json::Array();
- mp->OnEachChild(boost::bind(&JsonSerializer::ModelTreeIterate, n, _1, _2));
+ mp->OnEachChild(std::bind(&JsonSerializer::ModelTreeIterate, n, _1, _2));
}
break;
}
@@ -324,7 +326,7 @@ namespace Slicer {
JsonStreamSerializer::Serialize(ModelPartForRootPtr modelRoot)
{
json::Value doc;
- modelRoot->OnEachChild(boost::bind(&JsonSerializer::ModelTreeIterateRoot, &doc, _2));
+ modelRoot->OnEachChild(std::bind(&JsonSerializer::ModelTreeIterateRoot, &doc, _2));
json::serializeValue(doc, strm, "utf-8");
}
@@ -351,7 +353,7 @@ namespace Slicer {
JsonFileSerializer::Serialize(ModelPartForRootPtr modelRoot)
{
json::Value doc;
- modelRoot->OnEachChild(boost::bind(&JsonSerializer::ModelTreeIterateRoot, &doc, _2));
+ modelRoot->OnEachChild(std::bind(&JsonSerializer::ModelTreeIterateRoot, &doc, _2));
std::ofstream outFile(path.string());
json::serializeValue(doc, outFile, "utf-8");
}
@@ -376,7 +378,7 @@ namespace Slicer {
void
JsonValueSerializer::Serialize(ModelPartForRootPtr modelRoot)
{
- modelRoot->OnEachChild(boost::bind(&JsonSerializer::ModelTreeIterateRoot, &value, _2));
+ modelRoot->OnEachChild(std::bind(&JsonSerializer::ModelTreeIterateRoot, &value, _2));
}
}
diff --git a/slicer/slicer/metadata.cpp b/slicer/slicer/metadata.cpp
index da861ca..8658be6 100644
--- a/slicer/slicer/metadata.cpp
+++ b/slicer/slicer/metadata.cpp
@@ -35,7 +35,7 @@ Slicer::metaDataSplit(const std::string & metadata)
return parts;
}
-boost::optional<std::string>
+std::optional<std::string>
Slicer::metaDataValue(const std::string & prefix, const std::list<std::string> & metadata)
{
for (const auto & md : metadata) {
@@ -43,6 +43,6 @@ Slicer::metaDataValue(const std::string & prefix, const std::list<std::string> &
return md.substr(prefix.length());
}
}
- return boost::optional<std::string>();
+ return std::optional<std::string>();
}
diff --git a/slicer/slicer/metadata.h b/slicer/slicer/metadata.h
index fb3e1d3..79baf13 100644
--- a/slicer/slicer/metadata.h
+++ b/slicer/slicer/metadata.h
@@ -4,7 +4,7 @@
#include <string>
#include <list>
#include <vector>
-#include <boost/optional.hpp>
+#include <optional>
namespace Slicer {
#pragma GCC visibility push(default)
@@ -12,7 +12,7 @@ namespace Slicer {
bool metaDataFlagSet(const std::list<std::string> &, const std::string & flag);
bool metaDataFlagNotSet(const std::list<std::string> &, const std::string & flag);
// Values
- boost::optional<std::string> metaDataValue(const std::string & prefix, const std::list<std::string> & metadata);
+ std::optional<std::string> metaDataValue(const std::string & prefix, const std::list<std::string> & metadata);
std::list<std::string> metaDataValues(const std::string & prefix, const std::list<std::string> & metadata);
std::vector<std::string> metaDataSplit(const std::string & metadata);
#pragma GCC visibility pop
diff --git a/slicer/slicer/modelParts.h b/slicer/slicer/modelParts.h
index 4994c68..7f5cd6a 100644
--- a/slicer/slicer/modelParts.h
+++ b/slicer/slicer/modelParts.h
@@ -5,7 +5,7 @@
#include <Ice/InputStream.h>
#include <Ice/OutputStream.h>
#include <stdexcept>
-#include <boost/function.hpp>
+#include <functional>
#include <vector>
#include <list>
#include <visibility.h>
@@ -70,10 +70,10 @@ namespace Slicer {
typedef std::unique_ptr<HookCommon> HookCommonPtr;
typedef Ice::optional<std::string> TypeId;
- typedef boost::function<void(const std::string &, ModelPartPtr, const HookCommon *)> ChildHandler;
+ typedef std::function<void(const std::string &, ModelPartPtr, const HookCommon *)> ChildHandler;
- typedef boost::function<ModelPartPtr(void *)> ClassRef;
- typedef boost::function<bool(const HookCommon *)> HookFilter;
+ typedef std::function<ModelPartPtr(void *)> ClassRef;
+ typedef std::function<bool(const HookCommon *)> HookFilter;
typedef std::list<std::string> Metadata;
DLL_PUBLIC extern const Metadata emptyMetadata;
diff --git a/slicer/slicer/modelPartsTypes.cpp b/slicer/slicer/modelPartsTypes.cpp
index 37b9fce..bca297f 100644
--- a/slicer/slicer/modelPartsTypes.cpp
+++ b/slicer/slicer/modelPartsTypes.cpp
@@ -1,6 +1,7 @@
#include "modelPartsTypes.impl.h"
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/algorithm/string/predicate.hpp>
+#include <cxxabi.h>
namespace Slicer {
typedef std::map<std::string, ClassRef> ClassRefMap;
diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h
index 89f09c7..45ba1f6 100644
--- a/slicer/slicer/modelPartsTypes.h
+++ b/slicer/slicer/modelPartsTypes.h
@@ -360,7 +360,7 @@ namespace Slicer {
template<typename T>
class DLL_PUBLIC Stream {
public:
- typedef boost::function<void(const T &)> Consumer;
+ typedef std::function<void(const T &)> Consumer;
typedef T element_type;
virtual void Produce(const Consumer & c) = 0;
diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h
index dfef37d..408327d 100644
--- a/slicer/slicer/modelPartsTypes.impl.h
+++ b/slicer/slicer/modelPartsTypes.impl.h
@@ -58,7 +58,7 @@ namespace Slicer {
void
typeWrite(::Ice::OutputStream & s, const ::Ice::optional<T> & m)
{
- if constexpr (!Slicer::isLocal<T>::value) {
+ if constexpr (!isLocal<T>::value) {
typedef Ice::StreamableTraits<T> traits;
typedef Ice::StreamOptionalHelper<T, traits::helper, traits::fixedLength> SOH;
s.startEncapsulation();
@@ -76,7 +76,7 @@ namespace Slicer {
void
typeWrite(::Ice::OutputStream & s, const T & m)
{
- if constexpr (!Slicer::isLocal<T>::value) {
+ if constexpr (!isLocal<T>::value) {
s.write(m);
}
else {
@@ -88,7 +88,7 @@ namespace Slicer {
void
typeRead(::Ice::InputStream & s, ::Ice::optional<T> & m)
{
- if constexpr (!Slicer::isLocal<T>::value) {
+ if constexpr (!isLocal<T>::value) {
typedef Ice::StreamableTraits<T> traits;
typedef Ice::StreamOptionalHelper<T, traits::helper, traits::fixedLength> SOH;
s.startEncapsulation();
@@ -110,7 +110,7 @@ namespace Slicer {
void
typeRead(::Ice::InputStream & s, T & m)
{
- if constexpr (!Slicer::isLocal<T>::value) {
+ if constexpr (!isLocal<T>::value) {
s.read(m);
}
else {
diff --git a/slicer/test/compilation.cpp b/slicer/test/compilation.cpp
index 85e13ce..e6e9d02 100644
--- a/slicer/test/compilation.cpp
+++ b/slicer/test/compilation.cpp
@@ -10,6 +10,8 @@
BOOST_TEST_DONT_PRINT_LOG_VALUE(std::type_info);
// LCOV_EXCL_STOP
+namespace pl = std::placeholders;
+
#define TypeTest(Var, Expr, Explicit, Expected) \
Var obj = Expr; \
Slicer::ModelPartPtr mpp = Slicer::ModelPart::CreateFor(obj); \
@@ -51,7 +53,7 @@ BOOST_AUTO_TEST_CASE( compile_auto_modelpart_type_sequenceclasses )
BOOST_REQUIRE(cmpp);
BOOST_REQUIRE_EQUAL(Slicer::mpt_Complex, cmpp->GetType());
std::vector<std::string> names;
- cmpp->OnEachChild(boost::bind(&hookHandler, &names, _1, _2, _3));
+ cmpp->OnEachChild(std::bind(&hookHandler, &names, pl::_1, pl::_2, pl::_3));
BOOST_REQUIRE_EQUAL(2, names.size());
BOOST_REQUIRE_EQUAL("a", names.front());
BOOST_REQUIRE_EQUAL("b", names.back());
@@ -64,7 +66,7 @@ BOOST_AUTO_TEST_CASE( compile_auto_modelpart_type_sequencestructs )
BOOST_REQUIRE(cmpp);
BOOST_REQUIRE_EQUAL(Slicer::mpt_Complex, cmpp->GetType());
std::vector<std::string> names;
- cmpp->OnEachChild(boost::bind(&hookHandler, &names, _1, _2, _3));
+ cmpp->OnEachChild(std::bind(&hookHandler, &names, pl::_1, pl::_2, pl::_3));
BOOST_REQUIRE_EQUAL(2, names.size());
BOOST_REQUIRE_EQUAL("a", names.front());
BOOST_REQUIRE_EQUAL("b", names.back());
diff --git a/slicer/test/conversions.h b/slicer/test/conversions.h
index 5d45f7e..537fe42 100644
--- a/slicer/test/conversions.h
+++ b/slicer/test/conversions.h
@@ -2,9 +2,8 @@
#define SLICER_TEST_CONVERSIONS_H
#include <boost/date_time/posix_time/posix_time_types.hpp>
-#include <boost/multi_index/sequenced_index.hpp>
#include <visibility.h>
-#include <slicer/modelPartsTypes.h>
+#include <slicer/modelPartsTypes.impl.h>
#include <types.h>
namespace TestModule {
diff --git a/slicer/test/serializers.cpp b/slicer/test/serializers.cpp
index e298fbd..7e1040f 100644
--- a/slicer/test/serializers.cpp
+++ b/slicer/test/serializers.cpp
@@ -11,7 +11,7 @@
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/convenience.hpp>
#include <boost/format.hpp>
-#include <boost/function.hpp>
+#include <functional>
#include <types.h>
#include <json.h>
#include <xml.h>
@@ -22,6 +22,7 @@
#include "conversions.h"
namespace fs = boost::filesystem;
+namespace pl = std::placeholders;
// LCOV_EXCL_START
BOOST_TEST_DONT_PRINT_LOG_VALUE ( TestModule::ClassMap::iterator )
@@ -38,14 +39,14 @@ class FileBased {
public:
template<typename T, typename DeserializerIn>
void
- verifyByFile(const fs::path & infile, const boost::function<void(const T &)> & check = NULL)
+ verifyByFile(const fs::path & infile, const std::function<void(const T &)> & check = NULL)
{
verifyByFile<T, DeserializerIn>(infile, infile, check);
}
template<typename T, typename DeserializerIn>
void
- verifyByFile(const fs::path & infile, const fs::path & expOutFile, const boost::function<void(const T &)> & check = NULL)
+ verifyByFile(const fs::path & infile, const fs::path & expOutFile, const std::function<void(const T &)> & check = NULL)
{
const fs::path input = rootDir / "initial" / infile;
const fs::path expected = rootDir / "initial" / expOutFile;
@@ -81,10 +82,10 @@ class FileBased {
template<typename T, typename Deserializer, typename Serializer, typename Internal>
void
verifyByHelper(const fs::path & infile,
- const boost::function<Internal(const fs::path &)> & in,
- const boost::function<void(const Internal &, const fs::path &)> & out,
- const boost::function<void(Internal &)> & ifree,
- const boost::function<void(const T &)> & check = NULL)
+ const std::function<Internal(const fs::path &)> & in,
+ const std::function<void(const Internal &, const fs::path &)> & out,
+ const std::function<void(Internal &)> & ifree,
+ const std::function<void(const T &)> & check = NULL)
{
const fs::path input = rootDir / "initial" / infile;
const fs::path tmph = binDir / "byHandler";
@@ -378,22 +379,22 @@ BOOST_AUTO_TEST_CASE( structtype_json )
BOOST_AUTO_TEST_CASE( simplestring_xml )
{
- verifyByFile<std::string, Slicer::XmlFileDeserializer>("string.xml", boost::bind(checkAssertEq<std::string>, "test string", _1));
+ verifyByFile<std::string, Slicer::XmlFileDeserializer>("string.xml", std::bind(checkAssertEq<std::string>, "test string", pl::_1));
}
BOOST_AUTO_TEST_CASE( simpleint_xml )
{
- verifyByFile<Ice::Int, Slicer::XmlFileDeserializer>("int.xml", boost::bind(checkAssertEq<Ice::Int>, 27, _1));
+ verifyByFile<Ice::Int, Slicer::XmlFileDeserializer>("int.xml", std::bind(checkAssertEq<Ice::Int>, 27, pl::_1));
}
BOOST_AUTO_TEST_CASE( simplestring_json )
{
- verifyByFile<std::string, Slicer::JsonFileDeserializer>("string2.json", boost::bind(checkAssertEq<std::string>, "test string", _1));
+ verifyByFile<std::string, Slicer::JsonFileDeserializer>("string2.json", std::bind(checkAssertEq<std::string>, "test string", pl::_1));
}
BOOST_AUTO_TEST_CASE( simpleint_json )
{
- verifyByFile<Ice::Int, Slicer::JsonFileDeserializer>("int2.json", boost::bind(checkAssertEq<Ice::Int>, 27, _1));
+ verifyByFile<Ice::Int, Slicer::JsonFileDeserializer>("int2.json", std::bind(checkAssertEq<Ice::Int>, 27, pl::_1));
}
BOOST_AUTO_TEST_CASE( complexClass_xmlattrAndText )
diff --git a/slicer/tool/parser.cpp b/slicer/tool/parser.cpp
index d743f57..0004f36 100644
--- a/slicer/tool/parser.cpp
+++ b/slicer/tool/parser.cpp
@@ -8,7 +8,6 @@
#include <boost/algorithm/string/trim.hpp>
#include <boost/algorithm/string/split.hpp>
#include <Slice/CPlusPlusUtil.h>
-#include <boost/shared_ptr.hpp>
#include <boost/filesystem/convenience.hpp>
#include <fprintbf.h>
#include <safeMapFind.h>
@@ -261,7 +260,7 @@ namespace Slicer {
if (!t) {
t = Slice::ClassDefPtr::dynamicCast(dm->container())->declaration();
}
- auto name = metaDataValue("slicer:name:", dm->getMetaData()).value_or_eval(std::bind(&Slice::DataMember::name, dm));
+ auto name = metaDataValue("slicer:name:", dm->getMetaData()).value_or(dm->name());
fprintbf(cpp, "\t\tC%d::addHook<C%d::",
components, components);
auto type = dm->type();
@@ -575,9 +574,9 @@ namespace Slicer {
if (cpp != NULL && !cppPath.empty()) {
throw CompilerError("Both file handle and path provided.");
}
- FilePtr cppfile(
+ auto cppfile = std::unique_ptr<FILE, decltype(&fclose)>(
cpp || cppPath.empty() ? cpp : fopen(cppPath.string(), "w"),
- cppPath.empty() ? fflush : fclose);
+ cppPath.empty() ? fflush : fclose);
if (!cppfile && !cppPath.empty()) {
throw CompilerError("Failed to open output file");
}
diff --git a/slicer/tool/parser.h b/slicer/tool/parser.h
index 02c7dfe..3410dc5 100644
--- a/slicer/tool/parser.h
+++ b/slicer/tool/parser.h
@@ -2,13 +2,10 @@
#define SLICER_PARSER_H
#include <Slice/Parser.h>
-#include <boost/optional.hpp>
#include <boost/filesystem/path.hpp>
#include <visibility.h>
namespace Slicer {
- typedef boost::shared_ptr<FILE> FilePtr;
-
class DLL_PUBLIC Slicer : public Slice::ParserVisitor {
public:
typedef std::vector<std::string> Args;
diff --git a/slicer/xml/serializer.cpp b/slicer/xml/serializer.cpp
index f0ef251..b5719a1 100644
--- a/slicer/xml/serializer.cpp
+++ b/slicer/xml/serializer.cpp
@@ -4,8 +4,7 @@
#include <libxml++/document.h>
#include <libxml++/parsers/domparser.h>
#include <boost/lexical_cast.hpp>
-#include <boost/bind.hpp>
-#include <boost/intrusive_ptr.hpp>
+#include <functional>
#include <stdexcept>
#include <glibmm/ustring.h>
#include <compileTimeFormatter.h>
@@ -16,6 +15,8 @@ NAMEDFACTORY("application/xml", Slicer::XmlStreamSerializer, Slicer::StreamSeria
NAMEDFACTORY("application/xml", Slicer::XmlStreamDeserializer, Slicer::StreamDeserializerFactory);
namespace Slicer {
+ using namespace std::placeholders;
+
const std::string md_attribute = "xml:attribute";
const std::string md_text = "xml:text";
const std::string md_bare = "xml:bare";
@@ -23,7 +24,8 @@ namespace Slicer {
const std::string md_elements = "xml:elements";
const std::string keyName = "key";
const std::string valueName = "value";
- const auto defaultElementCreator = boost::bind(&xmlpp::Element::add_child_element, _1, _2, Glib::ustring());
+ typedef xmlpp::Element * (xmlpp::Element::* ElementCreatorF) (const Glib::ustring &, const Glib::ustring &);
+ const auto defaultElementCreator = std::bind((ElementCreatorF)&xmlpp::Element::add_child_element, _1, _2, Glib::ustring());
static const Glib::ustring TrueText("true");
static const Glib::ustring FalseText("false");
@@ -103,7 +105,7 @@ namespace Slicer {
class XmlValueTarget : public ValueTarget {
public:
- XmlValueTarget(boost::function<void(const Glib::ustring &)> a) :
+ XmlValueTarget(std::function<void(const Glib::ustring &)> a) :
apply(a)
{
}
@@ -154,14 +156,14 @@ namespace Slicer {
}
private:
- const boost::function<void(const Glib::ustring &)> apply;
+ const std::function<void(const Glib::ustring &)> apply;
};
class XmlAttributeValueTarget : public XmlValueTarget {
public:
XmlAttributeValueTarget(xmlpp::Element * p, const std::string & n) :
- XmlValueTarget(boost::bind(&xmlpp::Element::set_attribute, p, Glib::ustring(n), _1, Glib::ustring()))
+ XmlValueTarget(std::bind(&xmlpp::Element::set_attribute, p, Glib::ustring(n), _1, Glib::ustring()))
{
}
};
@@ -169,12 +171,12 @@ namespace Slicer {
class XmlContentValueTarget : public XmlValueTarget {
public:
XmlContentValueTarget(xmlpp::Element * p) :
- XmlValueTarget(boost::bind(&xmlpp::Element::set_first_child_text, p, _1))
+ XmlValueTarget(std::bind(&xmlpp::Element::set_first_child_text, p, _1))
{
}
XmlContentValueTarget(const CurrentElementCreator & cec) :
- XmlValueTarget(boost::bind(&xmlpp::Element::set_first_child_text, boost::bind(&CurrentElementCreator::deref, &cec), _1))
+ XmlValueTarget(std::bind(&xmlpp::Element::set_first_child_text, std::bind(&CurrentElementCreator::deref, &cec), _1))
{
}
};
@@ -254,7 +256,7 @@ namespace Slicer {
while (node) {
if (auto element = dynamic_cast<const xmlpp::Element *>(node)) {
auto smpr = mp->GetChildRef(element->get_name(),
- boost::bind(metaDataFlagNotSet, boost::bind(&Slicer::HookCommon::GetMetadata, _1), md_attribute));
+ std::bind(metaDataFlagNotSet, std::bind(&Slicer::HookCommon::GetMetadata, _1), md_attribute));
if (smpr) {
auto smp = smpr.Child();
if (metaDataFlagSet(smpr.ChildMetaData(), md_bare)) {
@@ -267,7 +269,7 @@ namespace Slicer {
}
else if (auto attribute = dynamic_cast<const xmlpp::Attribute *>(node)) {
auto smp = mp->GetChild(attribute->get_name(),
- boost::bind(metaDataFlagSet, boost::bind(&Slicer::HookCommon::GetMetadata, _1), md_attribute));
+ std::bind(metaDataFlagSet, std::bind(&Slicer::HookCommon::GetMetadata, _1), md_attribute));
if (smp) {
smp->Create();
smp->SetValue(XmlAttributeValueSource(attribute));
@@ -277,7 +279,7 @@ namespace Slicer {
else if (auto content = dynamic_cast<const xmlpp::ContentNode *>(node)) {
ModelPartPtr smp;
if (!content->is_white_space()) {
- smp = mp->GetAnonChild(boost::bind(metaDataFlagSet, boost::bind(&Slicer::HookCommon::GetMetadata, _1), md_text));
+ smp = mp->GetAnonChild(std::bind(metaDataFlagSet, std::bind(&Slicer::HookCommon::GetMetadata, _1), md_text));
}
if (smp) {
smp->SetValue(XmlContentValueSource(content));
@@ -316,10 +318,10 @@ namespace Slicer {
}
else {
if (hp && metaDataFlagSet(hp->GetMetadata(), md_bare)) {
- ModelTreeProcessElement(n, mp, boost::bind(&xmlpp::Element::add_child_element, _1, name, Glib::ustring()));
+ ModelTreeProcessElement(n, mp, std::bind((ElementCreatorF)&xmlpp::Element::add_child_element, _1, name, Glib::ustring()));
}
else {
- CurrentElementCreator cec(boost::bind(ec, n, name));
+ CurrentElementCreator cec(std::bind(ec, n, name));
ModelTreeProcessElement(cec, mp, defaultElementCreator);
}
}
@@ -364,7 +366,7 @@ namespace Slicer {
element->set_attribute(*typeIdPropName, *typeId);
mp = mp->GetSubclassModelPart(*typeId);
}
- mp->OnEachChild(boost::bind(&XmlSerializer::ModelTreeIterate, element, _1, _2, _3, ec));
+ mp->OnEachChild(std::bind(&XmlSerializer::ModelTreeIterate, element, _1, _2, _3, ec));
}
}
@@ -397,7 +399,7 @@ namespace Slicer {
XmlStreamSerializer::Serialize(ModelPartForRootPtr modelRoot)
{
xmlpp::Document doc;
- modelRoot->OnEachChild(boost::bind(&XmlSerializer::ModelTreeIterateRoot, &doc, _1, _2));
+ modelRoot->OnEachChild(std::bind(&XmlSerializer::ModelTreeIterateRoot, &doc, _1, _2));
doc.write_to_stream(strm);
}
@@ -423,7 +425,7 @@ namespace Slicer {
XmlFileSerializer::Serialize(ModelPartForRootPtr modelRoot)
{
xmlpp::Document doc;
- modelRoot->OnEachChild(boost::bind(&XmlSerializer::ModelTreeIterateRoot, &doc, _1, _2));
+ modelRoot->OnEachChild(std::bind(&XmlSerializer::ModelTreeIterateRoot, &doc, _1, _2));
doc.write_to_file_formatted(path.string());
}
@@ -447,7 +449,7 @@ namespace Slicer {
XmlDocumentSerializer::Serialize(ModelPartForRootPtr modelRoot)
{
doc = new xmlpp::Document();
- modelRoot->OnEachChild(boost::bind(&XmlSerializer::ModelTreeIterateRoot, doc, _1, _2));
+ modelRoot->OnEachChild(std::bind(&XmlSerializer::ModelTreeIterateRoot, doc, _1, _2));
}
AdHocFormatter(BadBooleanValueMsg, "Bad boolean value [%?]");
diff --git a/slicer/xml/serializer.h b/slicer/xml/serializer.h
index 2a50522..e3b40f0 100644
--- a/slicer/xml/serializer.h
+++ b/slicer/xml/serializer.h
@@ -12,7 +12,7 @@ namespace Slicer {
class DLL_PUBLIC XmlSerializer : public Serializer {
protected:
- typedef boost::function<xmlpp::Element *(xmlpp::Element *, const Glib::ustring &)> ElementCreator;
+ typedef std::function<xmlpp::Element *(xmlpp::Element *, const Glib::ustring &)> ElementCreator;
static void ModelTreeIterate(xmlpp::Element *, const std::string &, ModelPartPtr mp, const HookCommon * hp, const ElementCreator &);
static void ModelTreeIterateRoot(xmlpp::Document *, const std::string &, ModelPartPtr mp);