/** @brief New product creation Static method to create a new product (without saving into the database): product details are filled with given parameters. @param[in] aName Product name @param[in] aCid Category ID @param[in] aPrice Product price @param[in] aDescr Product detailed description @param[in] aQty Number of stocked items @param[in] isDel True if the product is not available @return An instance of the new product */ Product *Product::factory(string aName, int aCid, float aPrice, string aDescr, int aQty, bool isDel) { Product *newProduct = new Product(); newProduct->setIntForKey(KEY_PRD_PID, 0); newProduct->setIntForKey(KEY_PRD_CID, aCid); newProduct->setValueForKey(KEY_PRD_NAME, aName); newProduct->setValueForKey(KEY_PRD_DESCR, aDescr); newProduct->setFloatForKey(KEY_PRD_PRICE, aPrice); newProduct->setIntForKey(KEY_PRD_AVAILABILITY, aQty); newProduct->setBoolForKey(KEY_PRD_DELETED, isDel); return newProduct; }