From 628fbf1304bff4de9be752d2f4be77d58a5ab689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Sun, 12 Mar 2023 17:08:09 +0800 Subject: Product is constructed using C struct copy --- interchange/product.hxx | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/interchange/product.hxx b/interchange/product.hxx index eda700a..b8e6714 100644 --- a/interchange/product.hxx +++ b/interchange/product.hxx @@ -23,30 +23,30 @@ namespace QInterchange { }; Product() {} - Product(struct interchange_product* product) : - price{product->price}, - weight{product->weight} + Product(struct interchange_product product) : + price{product.price}, + weight{product.weight} { - if (product->sku) - sku = QString{product->sku}; - if (product->description) - description = QString{product->description}; - if (product->title) - title = QString{product->title}; - if (product->comment) - comment = QString{product->comment}; - if (product->thumb) - thumb = QString{product->thumb}; - if (product->image) - image = QString{product->image}; - if (product->prod_group) - prodGroup = QString{product->prod_group}; - if (product->category) - category = QString{product->category}; - if (product->author) - author = QString{product->author}; - if (product->crosssell) { - auto crosssell = product->crosssell; + if (product.sku) + sku = QString{product.sku}; + if (product.description) + description = QString{product.description}; + if (product.title) + title = QString{product.title}; + if (product.comment) + comment = QString{product.comment}; + if (product.thumb) + thumb = QString{product.thumb}; + if (product.image) + image = QString{product.image}; + if (product.prod_group) + prodGroup = QString{product.prod_group}; + if (product.category) + category = QString{product.category}; + if (product.author) + author = QString{product.author}; + if (product.crosssell) { + auto crosssell = product.crosssell; for (size_t i = 0; i < crosssell->length; i++) crossSell << QString{crosssell->skus[i]}; } -- cgit v1.2.3