summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slicer/db/sqlInsertSerializer.cpp22
-rw-r--r--slicer/db/sqlInsertSerializer.h18
-rw-r--r--slicer/db/sqlSelectDeserializer.cpp8
-rw-r--r--slicer/db/sqlSelectDeserializer.h8
-rw-r--r--slicer/db/sqlUpdateSerializer.cpp18
-rw-r--r--slicer/db/sqlUpdateSerializer.h8
-rw-r--r--slicer/json/serializer.cpp8
-rw-r--r--slicer/json/serializer.h8
-rw-r--r--slicer/slicer/any_ptr.h52
-rw-r--r--slicer/slicer/modelParts.cpp2
-rw-r--r--slicer/slicer/modelParts.h6
-rw-r--r--slicer/test/compilation.cpp2
-rw-r--r--slicer/xml/serializer.cpp20
-rw-r--r--slicer/xml/serializer.h24
14 files changed, 128 insertions, 76 deletions
diff --git a/slicer/db/sqlInsertSerializer.cpp b/slicer/db/sqlInsertSerializer.cpp
index b4d46e6..c120f10 100644
--- a/slicer/db/sqlInsertSerializer.cpp
+++ b/slicer/db/sqlInsertSerializer.cpp
@@ -42,23 +42,23 @@ namespace Slicer {
}
void
- SqlInsertSerializer::SerializeObject(const Slicer::ModelPartPtr & mp) const
+ SqlInsertSerializer::SerializeObject(ModelPartParam mp) const
{
auto ins = createInsert(mp);
bindObjectAndExecute(mp, ins.get());
}
void
- SqlInsertSerializer::SerializeSequence(const Slicer::ModelPartPtr & mp) const
+ SqlInsertSerializer::SerializeSequence(ModelPartParam mp) const
{
auto ins = createInsert(mp->GetContainedModelPart());
- mp->OnEachChild([&ins, this](const std::string &, const ModelPartPtr & cmp, const HookCommon *) {
+ mp->OnEachChild([&ins, this](auto &&, auto && cmp, auto &&) {
bindObjectAndExecute(cmp, ins.get());
});
}
void
- SqlInsertSerializer::bindObjectAndExecute(const Slicer::ModelPartPtr & cmp, DB::ModifyCommand * ins) const
+ SqlInsertSerializer::bindObjectAndExecute(ModelPartParam cmp, DB::ModifyCommand * ins) const
{
unsigned int paramNo = 0;
cmp->OnEachChild([this, &paramNo, ins](auto &&, auto && PH2, auto && PH3) {
@@ -103,10 +103,10 @@ namespace Slicer {
};
void
- SqlFetchIdInsertSerializer::bindObjectAndExecute(const Slicer::ModelPartPtr & mp, DB::ModifyCommand * ins) const
+ SqlFetchIdInsertSerializer::bindObjectAndExecute(ModelPartParam mp, DB::ModifyCommand * ins) const
{
SqlAutoIdInsertSerializer::bindObjectAndExecute(mp, ins);
- mp->OnEachChild([this](const std::string &, const ModelPartPtr & cmp, const HookCommon * h) {
+ mp->OnEachChild([this](auto &&, auto && cmp, auto && h) {
if (isAuto(h)) {
cmp->SetValue(IdSave(connection));
}
@@ -114,8 +114,8 @@ namespace Slicer {
}
void
- SqlInsertSerializer::bindObjectAndExecuteField(unsigned int & paramNo, DB::ModifyCommand * ins,
- const Slicer::ModelPartPtr & cmp, const HookCommon * h) const
+ SqlInsertSerializer::bindObjectAndExecuteField(
+ unsigned int & paramNo, DB::ModifyCommand * ins, ModelPartParam cmp, const HookCommon * h) const
{
if (isBind(h)) {
if (!cmp->GetValue(SqlBinder(*ins, paramNo))) {
@@ -126,8 +126,8 @@ namespace Slicer {
}
void
- SqlAutoIdInsertSerializer::bindObjectAndExecuteField(unsigned int & paramNo, DB::ModifyCommand * ins,
- const Slicer::ModelPartPtr & cmp, const HookCommon * h) const
+ SqlAutoIdInsertSerializer::bindObjectAndExecuteField(
+ unsigned int & paramNo, DB::ModifyCommand * ins, ModelPartParam cmp, const HookCommon * h) const
{
if (isNotAuto(h)) {
SqlInsertSerializer::bindObjectAndExecuteField(paramNo, ins, cmp, h);
@@ -135,7 +135,7 @@ namespace Slicer {
}
DB::ModifyCommandPtr
- SqlInsertSerializer::createInsert(const Slicer::ModelPartPtr & mp) const
+ SqlInsertSerializer::createInsert(ModelPartParam mp) const
{
using namespace AdHoc::literals;
std::stringstream insert;
diff --git a/slicer/db/sqlInsertSerializer.h b/slicer/db/sqlInsertSerializer.h
index 4a6a423..3451455 100644
--- a/slicer/db/sqlInsertSerializer.h
+++ b/slicer/db/sqlInsertSerializer.h
@@ -21,14 +21,14 @@ namespace Slicer {
void Serialize(Slicer::ModelPartForRootPtr) override;
protected:
- void SerializeObject(const Slicer::ModelPartPtr &) const;
- void SerializeSequence(const Slicer::ModelPartPtr &) const;
- DB::ModifyCommandPtr createInsert(const Slicer::ModelPartPtr &) const;
+ void SerializeObject(ModelPartParam) const;
+ void SerializeSequence(ModelPartParam) const;
+ [[nodiscard]] DB::ModifyCommandPtr createInsert(ModelPartParam) const;
virtual void createInsertField(
unsigned int & fieldNo, std::ostream & insert, const std::string & name, const HookCommon * h) const;
- virtual void bindObjectAndExecute(const Slicer::ModelPartPtr &, DB::ModifyCommand *) const;
+ virtual void bindObjectAndExecute(ModelPartParam, DB::ModifyCommand *) const;
virtual void bindObjectAndExecuteField(
- unsigned int & paramNo, DB::ModifyCommand *, const Slicer::ModelPartPtr &, const HookCommon *) const;
+ unsigned int & paramNo, DB::ModifyCommand *, ModelPartParam, const HookCommon *) const;
DB::Connection * const connection;
const std::string tableName;
@@ -42,10 +42,10 @@ namespace Slicer {
}
protected:
- virtual void createInsertField(unsigned int & fieldNo, std::ostream & insert, const std::string & name,
+ void createInsertField(unsigned int & fieldNo, std::ostream & insert, const std::string & name,
const HookCommon * h) const override;
- virtual void bindObjectAndExecuteField(unsigned int & paramNo, DB::ModifyCommand *,
- const Slicer::ModelPartPtr &, const HookCommon *) const override;
+ void bindObjectAndExecuteField(
+ unsigned int & paramNo, DB::ModifyCommand *, ModelPartParam, const HookCommon *) const override;
};
class DLL_PUBLIC SqlFetchIdInsertSerializer : public SqlAutoIdInsertSerializer {
@@ -56,7 +56,7 @@ namespace Slicer {
}
protected:
- virtual void bindObjectAndExecute(const Slicer::ModelPartPtr &, DB::ModifyCommand *) const override;
+ void bindObjectAndExecute(ModelPartParam, DB::ModifyCommand *) const override;
};
}
diff --git a/slicer/db/sqlSelectDeserializer.cpp b/slicer/db/sqlSelectDeserializer.cpp
index f3f3c07..554703f 100644
--- a/slicer/db/sqlSelectDeserializer.cpp
+++ b/slicer/db/sqlSelectDeserializer.cpp
@@ -38,7 +38,7 @@ namespace Slicer {
}
void
- SqlSelectDeserializer::DeserializeSimple(const Slicer::ModelPartPtr & mp)
+ SqlSelectDeserializer::DeserializeSimple(ModelPartParam mp)
{
if (!cmd->fetch()) {
if (!mp->IsOptional()) {
@@ -58,7 +58,7 @@ namespace Slicer {
}
void
- SqlSelectDeserializer::DeserializeSequence(const Slicer::ModelPartPtr & omp)
+ SqlSelectDeserializer::DeserializeSequence(ModelPartParam omp)
{
auto mp = omp->GetAnonChild();
while (cmd->fetch()) {
@@ -67,7 +67,7 @@ namespace Slicer {
}
void
- SqlSelectDeserializer::DeserializeObject(const Slicer::ModelPartPtr & mp)
+ SqlSelectDeserializer::DeserializeObject(ModelPartParam mp)
{
if (!cmd->fetch()) {
if (!mp->IsOptional()) {
@@ -83,7 +83,7 @@ namespace Slicer {
}
void
- SqlSelectDeserializer::DeserializeRow(const Slicer::ModelPartPtr & mp)
+ SqlSelectDeserializer::DeserializeRow(ModelPartParam mp)
{
auto rmp = mp->GetAnonChild();
if (rmp) {
diff --git a/slicer/db/sqlSelectDeserializer.h b/slicer/db/sqlSelectDeserializer.h
index 9e9d499..32106d7 100644
--- a/slicer/db/sqlSelectDeserializer.h
+++ b/slicer/db/sqlSelectDeserializer.h
@@ -20,10 +20,10 @@ namespace Slicer {
void Deserialize(Slicer::ModelPartForRootPtr) override;
protected:
- void DLL_PRIVATE DeserializeSimple(const Slicer::ModelPartPtr &);
- void DLL_PRIVATE DeserializeObject(const Slicer::ModelPartPtr &);
- void DLL_PRIVATE DeserializeSequence(const Slicer::ModelPartPtr &);
- void DLL_PRIVATE DeserializeRow(const Slicer::ModelPartPtr &);
+ void DLL_PRIVATE DeserializeSimple(ModelPartParam);
+ void DLL_PRIVATE DeserializeObject(ModelPartParam);
+ void DLL_PRIVATE DeserializeSequence(ModelPartParam);
+ void DLL_PRIVATE DeserializeRow(ModelPartParam);
DB::SelectCommand * cmd;
unsigned int columnCount;
diff --git a/slicer/db/sqlUpdateSerializer.cpp b/slicer/db/sqlUpdateSerializer.cpp
index 038f28e..8a3c3a4 100644
--- a/slicer/db/sqlUpdateSerializer.cpp
+++ b/slicer/db/sqlUpdateSerializer.cpp
@@ -40,26 +40,26 @@ namespace Slicer {
}
void
- SqlUpdateSerializer::SerializeObject(const Slicer::ModelPartPtr & mp) const
+ SqlUpdateSerializer::SerializeObject(ModelPartParam mp) const
{
auto ins = createUpdate(mp);
bindObjectAndExecute(mp, ins.get());
}
void
- SqlUpdateSerializer::SerializeSequence(const Slicer::ModelPartPtr & mp) const
+ SqlUpdateSerializer::SerializeSequence(ModelPartParam mp) const
{
auto ins = createUpdate(mp->GetContainedModelPart());
- mp->OnEachChild([&ins](const std::string &, const ModelPartPtr & cmp, const HookCommon *) {
+ mp->OnEachChild([&ins](auto &&, auto && cmp, auto &&) {
bindObjectAndExecute(cmp, ins.get());
});
}
void
- SqlUpdateSerializer::bindObjectAndExecute(const Slicer::ModelPartPtr & mp, DB::ModifyCommand * upd)
+ SqlUpdateSerializer::bindObjectAndExecute(ModelPartParam mp, DB::ModifyCommand * upd)
{
unsigned int paramNo = 0;
- mp->OnEachChild([&upd, &paramNo](const std::string &, const ModelPartPtr & cmp, const HookCommon * h) {
+ mp->OnEachChild([&upd, &paramNo](auto &&, auto && cmp, auto && h) {
if (isValue(h)) {
if (!cmp->GetValue(SqlBinder(*upd, paramNo))) {
upd->bindNull(paramNo);
@@ -67,7 +67,7 @@ namespace Slicer {
paramNo++;
}
});
- mp->OnEachChild([&upd, &paramNo](const std::string &, const ModelPartPtr & cmp, const HookCommon * h) {
+ mp->OnEachChild([&upd, &paramNo](auto &&, auto && cmp, auto && h) {
if (isPKey(h)) {
cmp->GetValue(SqlBinder(*upd, paramNo++));
}
@@ -78,13 +78,13 @@ namespace Slicer {
}
DB::ModifyCommandPtr
- SqlUpdateSerializer::createUpdate(const Slicer::ModelPartPtr & mp) const
+ SqlUpdateSerializer::createUpdate(ModelPartParam mp) const
{
using namespace AdHoc::literals;
std::stringstream update;
"UPDATE %? SET "_fmt(update, tableName);
int fieldNo = 0;
- mp->OnEachChild([&update, &fieldNo](const std::string & name, const ModelPartPtr &, const HookCommon * h) {
+ mp->OnEachChild([&update, &fieldNo](auto && name, auto &&, auto && h) {
if (isValue(h)) {
if (fieldNo++) {
update << ", ";
@@ -94,7 +94,7 @@ namespace Slicer {
});
update << " WHERE ";
fieldNo = 0;
- mp->OnEachChild([&update, &fieldNo](const std::string & name, const ModelPartPtr &, const HookCommon * h) {
+ mp->OnEachChild([&update, &fieldNo](auto && name, auto &&, auto && h) {
if (isPKey(h)) {
if (fieldNo++) {
update << " AND ";
diff --git a/slicer/db/sqlUpdateSerializer.h b/slicer/db/sqlUpdateSerializer.h
index 54a5f82..07ee5bb 100644
--- a/slicer/db/sqlUpdateSerializer.h
+++ b/slicer/db/sqlUpdateSerializer.h
@@ -20,10 +20,10 @@ namespace Slicer {
void Serialize(Slicer::ModelPartForRootPtr) override;
protected:
- void SerializeObject(const Slicer::ModelPartPtr &) const;
- void SerializeSequence(const Slicer::ModelPartPtr &) const;
- DB::ModifyCommandPtr createUpdate(const Slicer::ModelPartPtr &) const;
- static void bindObjectAndExecute(const Slicer::ModelPartPtr &, DB::ModifyCommand *);
+ void SerializeObject(ModelPartParam) const;
+ void SerializeSequence(ModelPartParam) const;
+ [[nodiscard]] DB::ModifyCommandPtr createUpdate(ModelPartParam) const;
+ static void bindObjectAndExecute(ModelPartParam, DB::ModifyCommand *);
DB::Connection * const connection;
const std::string tableName;
diff --git a/slicer/json/serializer.cpp b/slicer/json/serializer.cpp
index d20efeb..4c37d71 100644
--- a/slicer/json/serializer.cpp
+++ b/slicer/json/serializer.cpp
@@ -221,7 +221,7 @@ namespace Slicer {
};
void
- JsonSerializer::ModelTreeIterateSeq(json::Value * n, const ModelPartPtr & mp)
+ JsonSerializer::ModelTreeIterateSeq(json::Value * n, ModelPartParam mp)
{
if (!mp->HasValue()) {
return;
@@ -232,7 +232,7 @@ namespace Slicer {
}
void
- JsonSerializer::ModelTreeIterateDictObj(json::Value * n, const ModelPartPtr & mp)
+ JsonSerializer::ModelTreeIterateDictObj(json::Value * n, ModelPartParam mp)
{
if (!mp->HasValue()) {
return;
@@ -249,7 +249,7 @@ namespace Slicer {
}
void
- JsonSerializer::ModelTreeIterate(json::Value * n, const std::string & name, const ModelPartPtr & mp)
+ JsonSerializer::ModelTreeIterate(json::Value * n, const std::string & name, ModelPartParam mp)
{
if (name.empty() || !n || !mp) {
return;
@@ -314,7 +314,7 @@ namespace Slicer {
}
void
- JsonSerializer::ModelTreeIterateRoot(json::Value * n, const ModelPartPtr & mp)
+ JsonSerializer::ModelTreeIterateRoot(json::Value * n, ModelPartParam mp)
{
if (mp) {
switch (mp->GetType()) {
diff --git a/slicer/json/serializer.h b/slicer/json/serializer.h
index 3d92053..230f1c9 100644
--- a/slicer/json/serializer.h
+++ b/slicer/json/serializer.h
@@ -13,10 +13,10 @@
namespace Slicer {
class JsonSerializer : public Serializer {
protected:
- static void ModelTreeIterate(json::Value *, const std::string &, const ModelPartPtr & mp);
- static void ModelTreeIterateDictObj(json::Value *, const ModelPartPtr & mp);
- static void ModelTreeIterateSeq(json::Value *, const ModelPartPtr & mp);
- static void ModelTreeIterateRoot(json::Value *, const ModelPartPtr & mp);
+ static void ModelTreeIterate(json::Value *, const std::string &, ModelPartParam mp);
+ static void ModelTreeIterateDictObj(json::Value *, ModelPartParam mp);
+ static void ModelTreeIterateSeq(json::Value *, ModelPartParam mp);
+ static void ModelTreeIterateRoot(json::Value *, ModelPartParam mp);
};
class DLL_PUBLIC JsonValueSerializer : public JsonSerializer {
diff --git a/slicer/slicer/any_ptr.h b/slicer/slicer/any_ptr.h
new file mode 100644
index 0000000..34f8529
--- /dev/null
+++ b/slicer/slicer/any_ptr.h
@@ -0,0 +1,52 @@
+#pragma once
+
+#include <memory>
+#include <vector>
+
+namespace Slicer {
+ template<typename T> struct any_ptr {
+ // cppcheck-suppress noExplicitConstructor
+ // NOLINTNEXTLINE(hicpp-explicit-conversions)
+ inline constexpr any_ptr(T * p) noexcept : ptr {p} { }
+
+ template<typename S>
+ requires requires(S p) { p.get(); }
+ // cppcheck-suppress noExplicitConstructor
+ // NOLINTNEXTLINE(hicpp-explicit-conversions)
+ inline constexpr any_ptr(const S & p) noexcept : ptr {p.get()}
+ {
+ }
+
+ inline constexpr auto
+ get() const noexcept
+ {
+ return ptr;
+ }
+
+ inline constexpr auto
+ operator->() const noexcept
+ {
+ return ptr;
+ }
+
+ inline constexpr auto &
+ operator*() const noexcept
+ {
+ return *ptr;
+ }
+
+ inline constexpr explicit operator bool() const noexcept
+ {
+ return ptr;
+ }
+
+ inline constexpr bool
+ operator!() const noexcept
+ {
+ return !ptr;
+ }
+
+ private:
+ T * ptr;
+ };
+}
diff --git a/slicer/slicer/modelParts.cpp b/slicer/slicer/modelParts.cpp
index 7a31b05..e46d3f7 100644
--- a/slicer/slicer/modelParts.cpp
+++ b/slicer/slicer/modelParts.cpp
@@ -79,7 +79,7 @@ namespace Slicer {
}
void
- HookCommon::apply(const ChildHandler & ch, const ModelPartPtr & modelPart) const
+ HookCommon::apply(const ChildHandler & ch, const ModelPartParam & modelPart) const
{
ch(*this->nameStr, modelPart, this);
}
diff --git a/slicer/slicer/modelParts.h b/slicer/slicer/modelParts.h
index d0a1f06..f2e26e1 100644
--- a/slicer/slicer/modelParts.h
+++ b/slicer/slicer/modelParts.h
@@ -1,6 +1,7 @@
#ifndef SLICER_MODELPARTS_H
#define SLICER_MODELPARTS_H
+#include "any_ptr.h"
#include "metadata.h"
#include <Ice/Config.h>
#include <c++11Helpers.h>
@@ -79,8 +80,9 @@ namespace Slicer {
using ModelPartPtr = std::shared_ptr<ModelPart>;
using ModelPartForRootPtr = std::shared_ptr<ModelPartForRootBase>;
+ using ModelPartParam = any_ptr<ModelPart>;
using TypeId = std::optional<std::string>;
- using ChildHandler = std::function<void(const std::string &, const ModelPartPtr &, const HookCommon *)>;
+ using ChildHandler = std::function<void(const std::string &, const ModelPartParam &, const HookCommon *)>;
using ClassRef = std::function<ModelPartPtr(void *)>;
using HookFilter = std::function<bool(const HookCommon *)>;
using Metadata = MetaData<>;
@@ -126,7 +128,7 @@ namespace Slicer {
SPECIAL_MEMBERS_DEFAULT(HookCommon);
[[nodiscard]] bool filter(const HookFilter & flt) const;
- void apply(const ChildHandler & ch, const ModelPartPtr & modelPart) const;
+ void apply(const ChildHandler & ch, const ModelPartParam & modelPart) const;
[[nodiscard]] virtual const Metadata & GetMetadata() const = 0;
diff --git a/slicer/test/compilation.cpp b/slicer/test/compilation.cpp
index 2920e99..6bc6993 100644
--- a/slicer/test/compilation.cpp
+++ b/slicer/test/compilation.cpp
@@ -48,7 +48,7 @@ BOOST_AUTO_TEST_CASE(compile_auto_modelpart_type_class)
}
static void
-hookHandler(std::vector<std::string> * names, const std::string & name, const Slicer::ModelPartPtr & mpp,
+hookHandler(std::vector<std::string> * names, const std::string & name, Slicer::ModelPartParam mpp,
const Slicer::HookCommon * h)
{
names->push_back(name);
diff --git a/slicer/xml/serializer.cpp b/slicer/xml/serializer.cpp
index 7494c6e..7053756 100644
--- a/slicer/xml/serializer.cpp
+++ b/slicer/xml/serializer.cpp
@@ -228,7 +228,7 @@ namespace Slicer {
void
XmlDeserializer::DocumentTreeIterateDictAttrs(
- const xmlpp::Element::const_AttributeList & attrs, const ModelPartPtr & dict)
+ const xmlpp::Element::const_AttributeList & attrs, ModelPartParam dict)
{
for (const auto & attr : attrs) {
auto emp = dict->GetAnonChild();
@@ -244,7 +244,7 @@ namespace Slicer {
}
void
- XmlDeserializer::DocumentTreeIterateDictElements(const xmlpp::Element * element, const ModelPartPtr & dict)
+ XmlDeserializer::DocumentTreeIterateDictElements(const xmlpp::Element * element, ModelPartParam dict)
{
auto node = element->get_first_child();
while (node) {
@@ -264,7 +264,7 @@ namespace Slicer {
void
XmlDeserializer::DocumentTreeIterateElement(
- const xmlpp::Element * element, const ModelPartPtr & smp, const ChildRef & smpr)
+ const xmlpp::Element * element, ModelPartParam smp, const ChildRef & smpr)
{
auto oec = [&smpr, element](const auto & lmp) {
lmp->Create();
@@ -302,7 +302,7 @@ namespace Slicer {
}
void
- XmlDeserializer::DocumentTreeIterate(const xmlpp::Node * node, const ModelPartPtr & mp)
+ XmlDeserializer::DocumentTreeIterate(const xmlpp::Node * node, ModelPartParam mp)
{
while (node) {
if (auto element = dynamic_cast<const xmlpp::Element *>(node)) {
@@ -348,13 +348,13 @@ namespace Slicer {
}
void
- XmlDeserializer::DocumentTreeIterate(const xmlpp::Document * doc, const ModelPartPtr & mp)
+ XmlDeserializer::DocumentTreeIterate(const xmlpp::Document * doc, ModelPartParam mp)
{
DocumentTreeIterate(doc->get_root_node(), mp);
}
void
- XmlSerializer::ModelTreeIterate(xmlpp::Element * n, const std::string & name, const ModelPartPtr & mp,
+ XmlSerializer::ModelTreeIterate(xmlpp::Element * n, const std::string & name, ModelPartParam mp,
const HookCommon * hp, const ElementCreator & ec)
{
if (name.empty()) {
@@ -388,7 +388,7 @@ namespace Slicer {
}
void
- XmlSerializer::ModelTreeIterateDictAttrs(xmlpp::Element * element, const ModelPartPtr & dict)
+ XmlSerializer::ModelTreeIterateDictAttrs(xmlpp::Element * element, ModelPartParam dict)
{
dict->OnEachChild([element](const auto &, const auto & mp, const auto &) {
if (mp->HasValue()) {
@@ -400,7 +400,7 @@ namespace Slicer {
}
void
- XmlSerializer::ModelTreeIterateDictElements(xmlpp::Element * element, const ModelPartPtr & dict)
+ XmlSerializer::ModelTreeIterateDictElements(xmlpp::Element * element, ModelPartParam dict)
{
dict->OnEachChild([element](const auto &, const auto & mp, const auto &) {
if (mp->HasValue()) {
@@ -416,7 +416,7 @@ namespace Slicer {
void
XmlSerializer::ModelTreeProcessElement(
- const CurrentElementCreator & cec, const ModelPartPtr & mp, const ElementCreator & ec)
+ const CurrentElementCreator & cec, ModelPartParam mp, const ElementCreator & ec)
{
if (mp->GetType() == ModelPartType::Simple) {
mp->GetValue(XmlContentValueTarget(cec));
@@ -439,7 +439,7 @@ namespace Slicer {
}
void
- XmlSerializer::ModelTreeIterateRoot(xmlpp::Document * doc, const std::string & name, const ModelPartPtr & mp)
+ XmlSerializer::ModelTreeIterateRoot(xmlpp::Document * doc, const std::string & name, ModelPartParam mp)
{
ModelTreeProcessElement(doc->create_root_node(name), mp, defaultElementCreator);
}
diff --git a/slicer/xml/serializer.h b/slicer/xml/serializer.h
index 9b8fa21..4ee818a 100644
--- a/slicer/xml/serializer.h
+++ b/slicer/xml/serializer.h
@@ -30,15 +30,14 @@ namespace Slicer {
class DLL_PUBLIC XmlSerializer : public Serializer {
protected:
using ElementCreator = std::function<xmlpp::Element *(xmlpp::Element *, const Glib::ustring &)>;
- static void ModelTreeIterate(xmlpp::Element *, const std::string &, const ModelPartPtr & mp,
- const HookCommon * hp, const ElementCreator &);
- static void ModelTreeIterateRoot(xmlpp::Document *, const std::string &, const ModelPartPtr & mp);
+ static void ModelTreeIterate(xmlpp::Element *, const std::string &, ModelPartParam mp, const HookCommon * hp,
+ const ElementCreator &);
+ static void ModelTreeIterateRoot(xmlpp::Document *, const std::string &, ModelPartParam mp);
protected:
- static void ModelTreeProcessElement(
- const CurrentElementCreator &, const ModelPartPtr & mp, const ElementCreator &);
- static void ModelTreeIterateDictAttrs(xmlpp::Element * element, const ModelPartPtr & dict);
- static void ModelTreeIterateDictElements(xmlpp::Element * element, const ModelPartPtr & dict);
+ static void ModelTreeProcessElement(const CurrentElementCreator &, ModelPartParam mp, const ElementCreator &);
+ static void ModelTreeIterateDictAttrs(xmlpp::Element * element, ModelPartParam dict);
+ static void ModelTreeIterateDictElements(xmlpp::Element * element, ModelPartParam dict);
};
class DLL_PUBLIC XmlDocumentSerializer : public XmlSerializer {
@@ -69,13 +68,12 @@ namespace Slicer {
class DLL_PUBLIC XmlDeserializer : public Deserializer {
protected:
- static void DocumentTreeIterate(const xmlpp::Node * node, const ModelPartPtr & mp);
- static void DocumentTreeIterateElement(
- const xmlpp::Element * element, const ModelPartPtr & mp, const ChildRef & c);
- static void DocumentTreeIterate(const xmlpp::Document * doc, const ModelPartPtr & mp);
+ static void DocumentTreeIterate(const xmlpp::Node * node, ModelPartParam mp);
+ static void DocumentTreeIterateElement(const xmlpp::Element * element, ModelPartParam mp, const ChildRef & c);
+ static void DocumentTreeIterate(const xmlpp::Document * doc, ModelPartParam mp);
static void DocumentTreeIterateDictAttrs(
- const xmlpp::Element::const_AttributeList & attrs, const ModelPartPtr & dict);
- static void DocumentTreeIterateDictElements(const xmlpp::Element * parent, const ModelPartPtr & dict);
+ const xmlpp::Element::const_AttributeList & attrs, ModelPartParam dict);
+ static void DocumentTreeIterateDictElements(const xmlpp::Element * parent, ModelPartParam dict);
};
class DLL_PUBLIC XmlStreamDeserializer : public XmlDeserializer {