00001 /* 00002 * Copyright (c) 2010 Ferruccio Vitale <unixo@devzero.it> 00003 * All rights reserved. 00004 * 00005 * $Id: Basket.h 75 2010-09-13 09:25:53Z unixo $ 00006 */ 00007 00008 #ifndef __BASKET_H__ 00009 #define __BASKET_H__ 00010 00011 #include "common.h" 00012 00013 // forward declaration 00014 class Product; 00015 class ProductProxy; 00016 00022 class Basket : public std::map<int, int> 00023 { 00024 private: 00025 float _tot; 00026 void _realAddProduct(int pid, int qty); 00027 00028 public: 00029 Basket(); 00030 ~Basket(); 00031 00032 bool addProduct(Product *p, int aQty = 1); 00033 bool addProduct(ProductProxy *p, int aQty = 1); 00034 float total() const; 00035 void empty(); 00036 void removeProduct(Product *p, int aQty = 1); 00037 int itemCount(); 00038 00039 friend std::ostream & operator<<(std::ostream &, Basket &); 00040 }; 00041 00042 #endif /* __BASKET_H__ */