diff options
author | Dan Goodliffe <daniel.goodliffe@pressassociation.com> | 2016-10-21 11:41:26 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-10-22 12:45:17 +0100 |
commit | 8525be202a02892e5485f47eac30482bf22ec9a0 (patch) | |
tree | add2ebb6a419e3447c5787fa73310d15ea689626 | |
parent | Reference classes by type not handle type in model parts (diff) | |
download | slicer-8525be202a02892e5485f47eac30482bf22ec9a0.tar.bz2 slicer-8525be202a02892e5485f47eac30482bf22ec9a0.tar.xz slicer-8525be202a02892e5485f47eac30482bf22ec9a0.zip |
Remove a layer of templating from hooks
-rw-r--r-- | slicer/slicer/modelPartsTypes.h | 14 | ||||
-rw-r--r-- | slicer/tool/parser.cpp | 14 |
2 files changed, 12 insertions, 16 deletions
diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h index d53be93..ca381af 100644 --- a/slicer/slicer/modelPartsTypes.h +++ b/slicer/slicer/modelPartsTypes.h @@ -112,10 +112,10 @@ namespace Slicer { }; typedef IceUtil::Handle<HookBase> HookPtr; - template <typename MT, typename CT, typename MP> + template <typename MT, typename MP> class DLL_PRIVATE Hook : public HookBase { public: - Hook(MT CT::* m, const std::string & n) : + Hook(MT T::* m, const std::string & n) : member(m), name(n) { @@ -132,15 +132,15 @@ namespace Slicer { } private: - const MT CT::* member; + const MT T::* member; const std::string name; }; - template <typename MT, typename CT, typename MP> - class DLL_PRIVATE HookMetadata : public Hook<MT, CT, MP> { + template <typename MT, typename MP> + class DLL_PRIVATE HookMetadata : public Hook<MT, MP> { public: - HookMetadata(MT CT::* member, const std::string & n, const Metadata & md) : - Hook<MT, CT, MP>(member, n), + HookMetadata(MT T::* member, const std::string & n, const Metadata & md) : + Hook<MT, MP>(member, n), metadata(md) { } diff --git a/slicer/tool/parser.cpp b/slicer/tool/parser.cpp index 466f4dd..23a804b 100644 --- a/slicer/tool/parser.cpp +++ b/slicer/tool/parser.cpp @@ -280,10 +280,8 @@ namespace Slicer { else { fprintbf(cpp, "::Hook<"); } - fprintbf(cpp, " %s", + fprintbf(cpp, " %s, ", Slice::typeToString(type, dm->optional())); - fprintbf(cpp, ", %s, ", - boost::algorithm::trim_right_copy_if(dm->container()->thisScope(), ispunct)); if (dm->optional()) { fprintbf(cpp, "ModelPartForOptional< "); } @@ -418,19 +416,17 @@ namespace Slicer { auto vname = metaDataValue("slicer:value:", d->getMetaData()); fprintbf(cpp, "\t\t"); auto ktype = d->keyType(); - fprintbf(cpp, "new ModelPartForComplex< %s::value_type >::Hook< const %s, %s::value_type, ", + fprintbf(cpp, "new ModelPartForComplex< %s::value_type >::Hook< const %s, ", d->scoped(), - Slice::typeToString(ktype), - d->scoped()); + Slice::typeToString(ktype)); createNewModelPartPtrFor(ktype); fprintbf(cpp, " >(&%s::value_type::first, \"%s\"),\n\t\t", d->scoped(), kname ? *kname : "key"); auto vtype = d->valueType(); - fprintbf(cpp, "new ModelPartForComplex< %s::value_type >::Hook< %s, %s::value_type, ", + fprintbf(cpp, "new ModelPartForComplex< %s::value_type >::Hook< %s, ", d->scoped(), - Slice::typeToString(vtype), - d->scoped()); + Slice::typeToString(vtype)); createNewModelPartPtrFor(vtype); fprintbf(cpp, " >(&%s::value_type::second, \"%s\"),\n", d->scoped(), |