The class Basket represents the basket of the customer who wants to buy one or more products: it's intended to be used by User class only. More...
#include <Basket.h>
Public Member Functions | |
Basket () | |
void | addProduct (Product *p, int aQty=1) |
void | addProduct (ProductProxy *p, int aQty=1) |
Add a product to the basket. | |
float | total () const |
Return the total cost of the basket. | |
void | empty () |
void | removeProduct (Product *p, int aQty=1) |
Private Attributes | |
float | _tot |
Friends | |
std::ostream & | operator<< (std::ostream &, Basket &) |
The class Basket represents the basket of the customer who wants to buy one or more products: it's intended to be used by User class only.
Basket::Basket | ( | ) |
References _tot.
void Basket::addProduct | ( | ProductProxy * | p, | |
int | aQty = 1 | |||
) |
Add a product to the basket.
It's possibile to specify how many pieces of the same product.
[in] | p | An instance to ProductProxy |
[in] | aQty | How many pieces of the same product (default is 1) |
References _tot, ProductProxy::getPrice(), and ProductProxy::uniqueID().
void Basket::addProduct | ( | Product * | p, | |
int | aQty = 1 | |||
) |
References _tot, Product::getPrice(), ManagedObject::intForKey(), and Product::primaryKey().
Referenced by UserMenu::placeNewOrder().
void Basket::empty | ( | ) |
References _tot.
void Basket::removeProduct | ( | Product * | p, | |
int | aQty = 1 | |||
) |
References ManagedObject::intForKey(), and Product::primaryKey().
float Basket::total | ( | ) | const |
Return the total cost of the basket.
References _tot.
Referenced by Order::create().
std::ostream& operator<< | ( | std::ostream & | aStream, | |
Basket & | p | |||
) | [friend] |
float Basket::_tot [private] |
Referenced by addProduct(), Basket(), empty(), and total().