C++: new COPY_PROPERTYLIST macro that actually copies a list, not just
authorjani <jani@asema.com>
Fri, 2 Nov 2018 07:26:56 +0000 (09:26 +0200)
committerjani <jani@asema.com>
Fri, 2 Nov 2018 07:26:56 +0000 (09:26 +0200)
references it

Common/C++/SmartAPI/smartapi/model/Offering.cpp
Common/C++/SmartAPI/smartapi/rdf/PropertyList.h

index e1c8650c7a51c112a43c38717e6dbd8a3c36f2d7..f7417a820188a41f14b7b392ac1bd0cabb4452a9 100755 (executable)
@@ -30,7 +30,7 @@ Offering::Offering(Offering* o) : GrObj(o)
        SET_PROPERTY_REFERENCE(PROPERTY__HASBUSINESSFUNCTION,mBusinessFunction,Variant);
        SET_PROPERTYLIST_REFERENCE(PROPERTY__INCLUDES,mIncludes,SomeItems)
        SET_PROPERTYLIST_REFERENCE(PROPERTY__INCLUDESOBJECT,mTypeAndQuantityNodes,TypeAndQuantityNode)
-       SET_PROPERTYLIST_REFERENCE(PROPERTY__HASPRICESPECIFICATION,mPriceSpecifications,PriceSpecification)
+       COPY_PROPERTYLIST(PROPERTY__HASPRICESPECIFICATION,mPriceSpecifications,PriceSpecification)
        setType(RESOURCE__OFFERING);
 }
 
index f34db3c805026a19d9ab5406681342047dbb57b5..3f223748c879ba3d3e6a7c51a363cf910dd7b394 100644 (file)
@@ -6,6 +6,7 @@
 #define CLEAR_PROPERTYLIST(list,trashHolder) list.destroyCascade(trashHolder);
 //#define COPY_PROPERTYLIST(from,toList,getter) if (from != NULL) toList = from->getter();
 #define SET_PROPERTYLIST_REFERENCE(property,local,klass) if (has(property)) { PropertyList<GraphItem*> l = getAll(property); PropertyList<klass*> pl; for (int i = 0; i < l.length(); i++) { pl.append((klass*)l.at(i)); } local = pl; }
+#define COPY_PROPERTYLIST(property,local,klass) if (has(property)) { PropertyList<GraphItem*> l = getAll(property); PropertyList<klass*> pl; for (int i = 0; i < l.length(); i++) { klass* o = new klass((klass*)l.at(i)); pl.append(o); } local = pl; }
 
 #include <QList>
 #include <QSet>